[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6615 - in GNUnet/src: applications/advertising application
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6615 - in GNUnet/src: applications/advertising applications/bootstrap_http applications/chat applications/datastore applications/dht/module applications/dstore_mysql applications/dstore_sqlite applications/fragmentation applications/fs applications/fs/ecrs applications/fs/fsui applications/fs/gap applications/fs/lib applications/getoption applications/hostlist applications/identity applications/pingpong applications/rpc applications/session applications/sqstore_mysql applications/sqstore_sqlite applications/stats applications/tbench applications/template applications/topology_default applications/tracekit applications/traffic applications/transport applications/vpn include server transports util/crypto util/network util/os |
Date: |
Tue, 25 Mar 2008 00:23:14 -0600 (MDT) |
Author: grothoff
Date: 2008-03-25 00:23:12 -0600 (Tue, 25 Mar 2008)
New Revision: 6615
Modified:
GNUnet/src/applications/advertising/advertising.c
GNUnet/src/applications/advertising/bootstrap.c
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/dht/module/cs.c
GNUnet/src/applications/dht/module/routing.c
GNUnet/src/applications/dht/module/routing.h
GNUnet/src/applications/dht/module/table.c
GNUnet/src/applications/dstore_mysql/dstore_mysql.c
GNUnet/src/applications/dstore_sqlite/dstore.c
GNUnet/src/applications/fragmentation/fragmentation.c
GNUnet/src/applications/fragmentation/fragmentationtest.c
GNUnet/src/applications/fs/ecrs/download.c
GNUnet/src/applications/fs/ecrs/downloadtest.c
GNUnet/src/applications/fs/ecrs/ecrs.h
GNUnet/src/applications/fs/ecrs/ecrstest.c
GNUnet/src/applications/fs/ecrs/keyspace.c
GNUnet/src/applications/fs/ecrs/namespace.c
GNUnet/src/applications/fs/ecrs/search.c
GNUnet/src/applications/fs/ecrs/tree.h
GNUnet/src/applications/fs/ecrs/unindex.c
GNUnet/src/applications/fs/ecrs/updowntest.c
GNUnet/src/applications/fs/ecrs/upload.c
GNUnet/src/applications/fs/ecrs/uri.c
GNUnet/src/applications/fs/ecrs/uri.h
GNUnet/src/applications/fs/ecrs_core.c
GNUnet/src/applications/fs/ecrs_core_test.c
GNUnet/src/applications/fs/fsui/upload.c
GNUnet/src/applications/fs/gap/anonymity.c
GNUnet/src/applications/fs/gap/fs.c
GNUnet/src/applications/fs/gap/fs_dht.c
GNUnet/src/applications/fs/gap/gap.c
GNUnet/src/applications/fs/gap/gap.h
GNUnet/src/applications/fs/gap/migration.c
GNUnet/src/applications/fs/gap/migration.h
GNUnet/src/applications/fs/gap/ondemand.c
GNUnet/src/applications/fs/gap/ondemand.h
GNUnet/src/applications/fs/gap/plan.c
GNUnet/src/applications/fs/gap/querymanager.c
GNUnet/src/applications/fs/gap/querymanager.h
GNUnet/src/applications/fs/gap/shared.c
GNUnet/src/applications/fs/gap/shared.h
GNUnet/src/applications/fs/gap/test_linear_topology.c
GNUnet/src/applications/fs/gap/test_loopback.c
GNUnet/src/applications/fs/gap/test_multi_results.c
GNUnet/src/applications/fs/gap/test_star_topology.c
GNUnet/src/applications/fs/lib/fslib.c
GNUnet/src/applications/fs/lib/fslibtest.c
GNUnet/src/applications/getoption/getoption.c
GNUnet/src/applications/hostlist/hostlist.c
GNUnet/src/applications/identity/identity.c
GNUnet/src/applications/identity/identitytest.c
GNUnet/src/applications/pingpong/pingpong.c
GNUnet/src/applications/rpc/rpc.c
GNUnet/src/applications/session/connect.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/stats/sqstats.c
GNUnet/src/applications/stats/statistics.c
GNUnet/src/applications/tbench/tbench.c
GNUnet/src/applications/template/template.c
GNUnet/src/applications/topology_default/topology.c
GNUnet/src/applications/tracekit/tracekit.c
GNUnet/src/applications/traffic/traffic.c
GNUnet/src/applications/transport/transport.c
GNUnet/src/applications/vpn/cs.c
GNUnet/src/applications/vpn/p2p.c
GNUnet/src/applications/vpn/vpn.c
GNUnet/src/include/core.h
GNUnet/src/include/dht.h
GNUnet/src/include/ecrs_core.h
GNUnet/src/include/fs.h
GNUnet/src/include/gnunet_chat_lib.h
GNUnet/src/include/gnunet_core.h
GNUnet/src/include/gnunet_datastore_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_protocols.h
GNUnet/src/include/gnunet_remote_lib.h
GNUnet/src/include/gnunet_transport.h
GNUnet/src/include/gnunet_transport_service.h
GNUnet/src/include/gnunet_util_core.h
GNUnet/src/include/platform.h
GNUnet/src/server/connection.c
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/tcpserver.c
GNUnet/src/server/tcpserver.h
GNUnet/src/transports/common.c
GNUnet/src/transports/http.c
GNUnet/src/transports/nat.c
GNUnet/src/transports/smtp.c
GNUnet/src/transports/tcp.c
GNUnet/src/transports/test.c
GNUnet/src/transports/test_repeat.c
GNUnet/src/transports/udp.c
GNUnet/src/util/crypto/hashing.c
GNUnet/src/util/network/select.c
GNUnet/src/util/os/priority.c
Log:
larger refactoring of internal APIs to improve consistency
Modified: GNUnet/src/applications/advertising/advertising.c
===================================================================
--- GNUnet/src/applications/advertising/advertising.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/advertising/advertising.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -196,7 +196,7 @@
GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR; /* message invalid */
}
- if ((GNUNET_Int32Time) ntohl (msg->expirationTime) >
+ if ((GNUNET_Int32Time) ntohl (msg->expiration_time) >
GNUNET_get_time_int32 (NULL) + GNUNET_MAX_HELLO_EXPIRES)
{
GNUNET_GE_LOG (ectx,
@@ -206,7 +206,7 @@
GNUNET_GE_BREAK_OP (ectx, 0);
return GNUNET_SYSERR;
}
- if (GNUNET_SYSERR == transport->verifyhello (msg))
+ if (GNUNET_SYSERR == transport->hello_verify (msg))
{
#if DEBUG_ADVERTISING
IF_GELOG (ectx,
@@ -385,7 +385,7 @@
/* build message to send, ping must contain return-information,
such as a selection of our hellos... */
- mtu = transport->getMTU (tsession->ttype);
+ mtu = transport->mtu_get (tsession->ttype);
if (mtu == 0)
{
mtu = 2048; /* bound size */
@@ -413,8 +413,9 @@
buffer = GNUNET_malloc (mtu);
if (mtu > ntohs (ping->size))
{
- helloEnd = transport->getAdvertisedhellos (mtu - ntohs (ping->size),
- buffer);
+ helloEnd =
+ transport->hello_advertisements_get (mtu - ntohs (ping->size),
+ buffer);
GNUNET_GE_ASSERT (ectx, mtu - ntohs (ping->size) >= helloEnd);
}
else
@@ -449,8 +450,7 @@
/* ok, finally we can send! */
if ((res == GNUNET_OK) &&
- (GNUNET_SYSERR ==
- coreAPI->connection_send_plaintext (tsession, buffer, helloEnd)))
+ (GNUNET_SYSERR == coreAPI->plaintext_send (tsession, buffer, helloEnd)))
{
if (stats != NULL)
@@ -515,14 +515,15 @@
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)))
+ if (0 == memcmp (hi, coreAPI->my_identity, sizeof (GNUNET_PeerIdentity)))
return GNUNET_OK; /* never advertise to myself... */
prio = (int) getConnectPriority ();
if (prio >= GNUNET_EXTREME_PRIORITY)
prio = GNUNET_EXTREME_PRIORITY / 4;
- if (GNUNET_OK == coreAPI->queryPeerStatus (hi, NULL, NULL))
+ if (GNUNET_OK == coreAPI->p2p_connection_status_check (hi, NULL, NULL))
{
- coreAPI->unicast (hi, &sd->m->header, prio, HELLO_BROADCAST_FREQUENCY);
+ coreAPI->ciphertext_send (hi, &sd->m->header, prio,
+ HELLO_BROADCAST_FREQUENCY);
if (stats != NULL)
stats->change (stat_hello_out, 1);
return GNUNET_OK;
@@ -562,9 +563,9 @@
}
if (stats != NULL)
stats->change (stat_hello_out, 1);
- coreAPI->connection_send_plaintext (tsession,
- (char *) &sd->m->header,
- GNUNET_sizeof_hello (sd->m));
+ coreAPI->plaintext_send (tsession,
+ (char *) &sd->m->header,
+ GNUNET_sizeof_hello (sd->m));
transport->disconnect (tsession, __FILE__);
#if DEBUG_ADVERTISING
GNUNET_GE_LOG (ectx,
@@ -593,14 +594,14 @@
return; /* ignore */
now = GNUNET_get_time ();
sd.n = identity->forEachHost (now, NULL, NULL); /* just count */
- sd.m = transport->createhello (tapi->protocolNumber);
+ sd.m = transport->hello_create (tapi->protocol_number);
if (sd.m == NULL)
return;
#if DEBUG_ADVERTISING
GNUNET_GE_LOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("Advertising my transport %d to selected peers.\n"),
- tapi->protocolNumber);
+ tapi->protocol_number);
#endif
identity->addHost (sd.m);
if (sd.n < 1)
@@ -631,9 +632,9 @@
return; /* network load too high... */
if (GNUNET_cpu_get_load (coreAPI->ectx, coreAPI->cfg) > 100)
return; /* CPU load too high... */
- i = transport->forEach (NULL, NULL);
+ i = transport->iterate_available (NULL, NULL);
if (i > 0)
- transport->forEach (&broadcasthelloTransport, &i);
+ transport->iterate_available (&broadcasthelloTransport, &i);
}
typedef struct
@@ -659,8 +660,8 @@
to the same peer! */
if (stats != NULL)
stats->change (stat_hello_fwd, 1);
- coreAPI->unicast (peer, &fcc->msg->header, 0, /* priority */
- HELLO_BROADCAST_FREQUENCY);
+ coreAPI->ciphertext_send (peer, &fcc->msg->header, 0, /* priority */
+ HELLO_BROADCAST_FREQUENCY);
}
/**
@@ -688,7 +689,7 @@
return GNUNET_OK; /* this should not happen */
/* do not forward expired hellos */
GNUNET_get_time_int32 (&now);
- if ((GNUNET_Int32Time) ntohl (hello->expirationTime) < now)
+ if ((GNUNET_Int32Time) ntohl (hello->expiration_time) < now)
{
#if DEBUG_ADVERTISING
GNUNET_EncName enc;
@@ -699,7 +700,7 @@
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));
+ &enc, now - ntohl (hello->expiration_time));
#endif
identity->delHostFromKnown (peer, protocol);
GNUNET_free (hello);
@@ -712,12 +713,12 @@
return GNUNET_OK; /* only forward with a certain chance,
(on average: 1 peer per run!) */
}
- count = coreAPI->forAllConnectedNodes (NULL, NULL);
+ count = coreAPI->p2p_connections_iterate (NULL, NULL);
if (count > 0)
{
fcc.msg = hello;
fcc.prob = count;
- coreAPI->forAllConnectedNodes (&forwardCallback, &fcc);
+ coreAPI->p2p_connections_iterate (&forwardCallback, &fcc);
}
GNUNET_free (hello);
return GNUNET_OK;
@@ -756,7 +757,8 @@
/* if the hello was ok, update traffic preference
for the peer (depending on how much we like
to learn about other peers) */
- coreAPI->preferTrafficFrom (sender, getConnectPriority ());
+ coreAPI->p2p_connection_preference_increase (sender,
+ getConnectPriority ());
}
return GNUNET_OK; /* even if we had errors processing the hello,
keep going */
}
@@ -845,43 +847,43 @@
{
coreAPI = capi;
ectx = capi->ectx;
- identity = capi->request_service ("identity");
+ identity = capi->service_request ("identity");
if (identity == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
- transport = capi->request_service ("transport");
+ transport = capi->service_request ("transport");
if (transport == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
- capi->release_service (identity);
+ capi->service_release (identity);
identity = NULL;
return GNUNET_SYSERR;
}
- pingpong = capi->request_service ("pingpong");
+ pingpong = capi->service_request ("pingpong");
if (pingpong == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
- capi->release_service (identity);
+ capi->service_release (identity);
identity = NULL;
- capi->release_service (transport);
+ capi->service_release (transport);
transport = NULL;
return GNUNET_SYSERR;
}
- topology = capi->request_service ("topology");
+ topology = capi->service_request ("topology");
if (topology == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
- capi->release_service (identity);
+ capi->service_release (identity);
identity = NULL;
- capi->release_service (transport);
+ capi->service_release (transport);
transport = NULL;
- capi->release_service (pingpong);
+ capi->service_release (pingpong);
pingpong = NULL;
return GNUNET_SYSERR;
}
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_hello_in =
@@ -929,8 +931,10 @@
("`%s' registering handler %d (plaintext and ciphertext)\n"),
"advertising", GNUNET_P2P_PROTO_HELLO);
- capi->registerHandler (GNUNET_P2P_PROTO_HELLO, &ehelloHandler);
- capi->plaintext_register_handler (GNUNET_P2P_PROTO_HELLO, &phelloHandler);
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_HELLO,
+ &ehelloHandler);
+ capi->p2p_plaintext_handler_register (GNUNET_P2P_PROTO_HELLO,
+ &phelloHandler);
if (0 !=
GNUNET_GC_attach_change_listener (capi->cfg,
&configurationUpdateCallback, NULL))
@@ -967,20 +971,21 @@
GNUNET_cron_del_job (coreAPI->cron, &forwardhello,
HELLO_FORWARD_FREQUENCY, NULL); /* seven minutes: exchange */
activeCronJobs -= ACJ_FORWARD;
}
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_HELLO, &ehelloHandler);
- coreAPI->plaintext_unregister_handler (GNUNET_P2P_PROTO_HELLO,
- &phelloHandler);
- coreAPI->release_service (transport);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_HELLO,
+ &ehelloHandler);
+ coreAPI->p2p_plaintext_handler_unregister (GNUNET_P2P_PROTO_HELLO,
+ &phelloHandler);
+ coreAPI->service_release (transport);
transport = NULL;
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
- coreAPI->release_service (pingpong);
+ coreAPI->service_release (pingpong);
pingpong = NULL;
- coreAPI->release_service (topology);
+ coreAPI->service_release (topology);
topology = NULL;
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
coreAPI = NULL;
Modified: GNUnet/src/applications/advertising/bootstrap.c
===================================================================
--- GNUnet/src/applications/advertising/bootstrap.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/advertising/bootstrap.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -87,9 +87,9 @@
hcq->hellos[rndidx] = hcq->hellos[hcq->hellosCount - 1];
GNUNET_array_grow (hcq->hellos, hcq->hellosCount, hcq->hellosCount - 1);
- coreAPI->p2p_inject_message (NULL,
- (const char *) msg,
- ntohs (msg->header.size), GNUNET_NO, NULL);
+ coreAPI->loopback_send (NULL,
+ (const char *) msg,
+ ntohs (msg->header.size), GNUNET_NO, NULL);
GNUNET_free (msg);
if ((hcq->hellosCount > 0) && (!hlc.do_shutdown))
{
@@ -148,7 +148,7 @@
char *data;
now = GNUNET_get_time ();
- if (coreAPI->forAllConnectedNodes (NULL, NULL) >=
+ if (coreAPI->p2p_connections_iterate (NULL, NULL) >=
GNUNET_MIN_CONNECTION_TARGET)
{
/* still change delta and lastTest; even
@@ -227,9 +227,9 @@
startBootstrap (GNUNET_CoreAPIForPlugins * capi)
{
coreAPI = capi;
- state = capi->request_service ("state");
+ state = capi->service_request ("state");
GNUNET_GE_ASSERT (capi->ectx, state != NULL);
- bootstrap = capi->request_service ("bootstrap");
+ bootstrap = capi->service_request ("bootstrap");
GNUNET_GE_ASSERT (capi->ectx, bootstrap != NULL);
hlc.do_shutdown = GNUNET_NO;
pt = GNUNET_thread_create (&processThread, NULL, 64 * 1024);
@@ -248,9 +248,9 @@
GNUNET_thread_stop_sleep (pt);
GNUNET_thread_join (pt, &unused);
pt = NULL;
- coreAPI->release_service (bootstrap);
+ coreAPI->service_release (bootstrap);
bootstrap = NULL;
- coreAPI->release_service (state);
+ coreAPI->service_release (state);
state = NULL;
coreAPI = NULL;
}
Modified: GNUnet/src/applications/bootstrap_http/http.c
===================================================================
--- GNUnet/src/applications/bootstrap_http/http.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/bootstrap_http/http.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -231,7 +231,7 @@
{
if (transport == NULL)
protocols |= (1LL << i);
- else if (transport->isAvailable ((unsigned short) i))
+ else if (transport->test_available ((unsigned short) i))
protocols |= (1LL << i);
}
sprintf (purl, "%s?p=%llu", url, protocols);
@@ -417,8 +417,8 @@
coreAPI = capi;
ectx = capi->ectx;
- transport = coreAPI->request_service ("transport");
- stats = coreAPI->request_service ("stats");
+ transport = coreAPI->service_request ("transport");
+ stats = coreAPI->service_request ("stats");
if (stats != NULL)
{
stat_hellodownloaded
@@ -432,9 +432,9 @@
release_module_bootstrap ()
{
if (stats != NULL)
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
if (transport != NULL)
- coreAPI->release_service (transport);
+ coreAPI->service_release (transport);
transport = NULL;
coreAPI = NULL;
}
Modified: GNUnet/src/applications/bootstrap_http/httptest.c
===================================================================
--- GNUnet/src/applications/bootstrap_http/httptest.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/bootstrap_http/httptest.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -95,8 +95,8 @@
"http://gnunet.org/hostlist.php");
memset (&capi, 0, sizeof (GNUNET_CoreAPIForPlugins));
capi.cfg = cfg;
- capi.request_service = &rs;
- capi.release_service = &rsx;
+ capi.service_request = &rs;
+ capi.service_release = &rsx;
plugin = GNUNET_plugin_load (NULL, "libgnunetmodule_", "bootstrap");
init =
GNUNET_plugin_resolve_function (plugin, "provide_module_", GNUNET_YES);
Modified: GNUnet/src/applications/chat/chat.c
===================================================================
--- GNUnet/src/applications/chat/chat.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/chat/chat.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -92,8 +92,8 @@
memcpy (&message->nick[0], compare_pos->nick,
strlen (compare_pos->nick));
- coreAPI->cs_send_to_client (pos->client, &message->header,
- GNUNET_YES);
+ coreAPI->cs_send_message (pos->client, &message->header,
+ GNUNET_YES);
}
compare_pos = compare_pos->next;
}
@@ -181,8 +181,7 @@
{
fprintf (stderr,
"room names match, must send message to others!!\n");
- coreAPI->cs_send_to_client (tempClient->client, message,
- GNUNET_YES);
+ coreAPI->cs_send_message (tempClient->client, message, GNUNET_YES);
}
tempClient = tempClient->next;
@@ -378,8 +377,8 @@
pos = client_list_head;
while (pos != NULL)
{
- coreAPI->cs_send_to_client (pos->client, &message->header,
- GNUNET_YES);
+ coreAPI->cs_send_message (pos->client, &message->header,
+ GNUNET_YES);
pos = pos->next;
}
@@ -406,19 +405,19 @@
"chat", GNUNET_P2P_PROTO_CHAT_MSG, GNUNET_CS_PROTO_CHAT_MSG);
/*if (GNUNET_SYSERR ==
- capi->registerHandler (GNUNET_P2P_PROTO_CHAT_MSG, &handleChatMSG))
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_CHAT_MSG,
&handleChatMSG))
ok = GNUNET_SYSERR; */
if (GNUNET_SYSERR ==
- capi->cs_exit_handler_register (&chatClientExitHandler))
+ capi->cs_disconnect_handler_register (&chatClientExitHandler))
ok = GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_CHAT_JOIN_MSG,
- &csHandleChatJoinRequest))
+ capi->cs_handler_register (GNUNET_CS_PROTO_CHAT_JOIN_MSG,
+ &csHandleChatJoinRequest))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerClientHandler (GNUNET_CS_PROTO_CHAT_MSG,
- &csHandleChatMSG))
+ if (GNUNET_SYSERR == capi->cs_handler_register (GNUNET_CS_PROTO_CHAT_MSG,
+ &csHandleChatMSG))
ok = GNUNET_SYSERR;
GNUNET_GE_ASSERT (capi->ectx,
@@ -435,12 +434,11 @@
done_module_chat ()
{
shutdown_flag = GNUNET_YES;
- /*coreAPI->unregisterHandler (GNUNET_P2P_PROTO_CHAT_MSG, &handleChatMSG); */
- coreAPI->cs_exit_handler_unregister (&chatClientExitHandler);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_CHAT_MSG,
- &csHandleChatMSG);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_CHAT_JOIN_MSG,
- &csHandleChatJoinRequest);
+ /*coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_CHAT_MSG,
&handleChatMSG); */
+ coreAPI->cs_disconnect_handler_unregister (&chatClientExitHandler);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_CHAT_MSG, &csHandleChatMSG);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_CHAT_JOIN_MSG,
+ &csHandleChatJoinRequest);
GNUNET_mutex_destroy (chatMutex);
coreAPI = NULL;
Modified: GNUnet/src/applications/chat/chat.h
===================================================================
--- GNUnet/src/applications/chat/chat.h 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/chat/chat.h 2008-03-25 06:23:12 UTC (rev 6615)
@@ -87,16 +87,12 @@
GNUNET_CHAT_MemberListCallback member_list_callback;
- GNUNET_CHAT_MemberRemoveCallback member_remove_callback;
-
int shutdown_flag;
void *callback_cls;
void *member_list_callback_cls;
- void *member_remove_callback_cls;
-
};
int GNUNET_CHAT_rejoin_room (struct GNUNET_CHAT_Room *chat_room);
Modified: GNUnet/src/applications/chat/clientapi.c
===================================================================
--- GNUnet/src/applications/chat/clientapi.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/chat/clientapi.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -107,7 +107,8 @@
if (GNUNET_OK !=
room->member_list_callback (room->member_list_callback_cls,
- nick, GNUNET_get_time ()))
+ nick, GNUNET_YES,
+ GNUNET_get_time ()))
{
GNUNET_GE_BREAK (NULL, 0);
GNUNET_client_connection_close_temporarily (room->sock);
@@ -186,9 +187,7 @@
const char *memberInfo,
GNUNET_CHAT_MessageCallback callback, void *cls,
GNUNET_CHAT_MemberListCallback memberCallback,
- void *membercls,
- GNUNET_CHAT_MemberRemoveCallback removeCallback,
- void *removecls)
+ void *membercls)
{
CS_chat_JOIN_MESSAGE *join_msg;
GNUNET_HashCode hash_of_me;
@@ -240,8 +239,6 @@
chat_room->callback_cls = cls;
chat_room->member_list_callback = memberCallback;
chat_room->member_list_callback_cls = membercls;
- chat_room->member_remove_callback = removeCallback;
- chat_room->member_remove_callback_cls = removecls;
chat_room->ectx = ectx;
chat_room->cfg = cfg;
chat_room->memberInfo = GNUNET_strdup (memberInfo);
@@ -353,15 +350,4 @@
return ret;
}
-/**
- * List all of the (known) chat members.
- * @return number of rooms on success, GNUNET_SYSERR if iterator aborted
- */
-int
-GNUNET_CHAT_list_members (struct GNUNET_CHAT_Room *room,
- GNUNET_CHAT_MemberIterator it, void *cls)
-{
- return GNUNET_SYSERR;
-}
-
/* end of clientapi.c */
Modified: GNUnet/src/applications/chat/gnunet-chat.c
===================================================================
--- GNUnet/src/applications/chat/gnunet-chat.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/chat/gnunet-chat.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -90,18 +90,11 @@
static int
member_list_callback (void *cls, const char *senderNick,
- GNUNET_CronTime timestamp)
+ int is_joining, GNUNET_CronTime timestamp)
{
return GNUNET_OK;
}
-static int
-member_remove_callback (void *cls, const char *senderNick,
- GNUNET_CronTime timestamp)
-{
- return GNUNET_OK;
-}
-
/**
* Message delivery confirmations.
*
@@ -165,8 +158,7 @@
cfg,
nickname, room_name,
&my_pub, my_priv, "", &receive_callback,
- NULL, &member_list_callback, NULL,
- &member_remove_callback, NULL);
+ NULL, &member_list_callback, NULL);
if (room == NULL)
{
fprintf (stderr, _("Failed to join room `%s'\n"), room_name);
Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/datastore/datastore.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -220,7 +220,7 @@
ntohl (value->size) - sizeof (GNUNET_DatastoreValue))))
return GNUNET_OK; /* found another value, but different content!
*/
ce->uid = uid;
- ce->expiration = GNUNET_ntohll (value->expirationTime);
+ ce->expiration = GNUNET_ntohll (value->expiration_time);
ce->exists = GNUNET_YES;
return GNUNET_SYSERR; /* abort iteration! */
}
@@ -255,15 +255,16 @@
sq->get (key, &vhc, GNUNET_ECRS_BLOCKTYPE_ONDEMAND, &checkExists, &cls);
if (cls.exists)
{
- if ((ntohl (value->prio) == 0) &&
- (GNUNET_ntohll (value->expirationTime) <= cls.expiration))
+ if ((ntohl (value->priority) == 0) &&
+ (GNUNET_ntohll (value->expiration_time) <= cls.expiration))
{
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
}
- /* update prio */
+ /* update priority */
sq->update (cls.uid,
- ntohl (value->prio), GNUNET_ntohll (value->expirationTime));
+ ntohl (value->priority),
+ GNUNET_ntohll (value->expiration_time));
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
}
@@ -273,22 +274,22 @@
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);
+ ntohl (value->priority) + comp_prio);
#endif
/* check if we have enough space / priority */
if ((available < ntohl (value->size)) &&
- (minPriority > ntohl (value->prio) + comp_prio))
+ (minPriority > ntohl (value->priority) + comp_prio))
{
GNUNET_mutex_unlock (lock);
return GNUNET_NO; /* new content has such a low priority that
we should not even bother! */
}
- if (ntohl (value->prio) + comp_prio < minPriority)
- minPriority = ntohl (value->prio) + comp_prio;
+ if (ntohl (value->priority) + comp_prio < minPriority)
+ minPriority = ntohl (value->priority) + comp_prio;
/* construct new value with comp'ed priority */
nvalue = GNUNET_malloc (ntohl (value->size));
memcpy (nvalue, value, ntohl (value->size));
- nvalue->prio = htonl (comp_priority () + ntohl (value->prio));
+ nvalue->priority = htonl (comp_priority () + ntohl (value->priority));
/* add the content */
ok = sq->put (key, nvalue);
GNUNET_free (nvalue);
@@ -313,7 +314,7 @@
{
if ((available > 0) && (available >= MIN_GNUNET_free))
return GNUNET_SYSERR;
- if (GNUNET_get_time () < GNUNET_ntohll (value->expirationTime))
+ if (GNUNET_get_time () < GNUNET_ntohll (value->expiration_time))
return GNUNET_SYSERR; /* not expired */
available += ntohl (value->size);
return GNUNET_NO;
@@ -326,7 +327,7 @@
{
if ((available > 0) && (available >= MIN_GNUNET_free))
return GNUNET_SYSERR;
- minPriority = ntohl (value->prio);
+ minPriority = ntohl (value->priority);
available += ntohl (value->size);
return GNUNET_NO;
}
@@ -380,7 +381,7 @@
return NULL; /* OOPS */
}
quota = lquota * 1024 * 1024; /* MB to bytes */
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_filtered =
@@ -392,13 +393,13 @@
create (gettext_noop ("# bytes allowed in datastore")),
quota);
}
- state = capi->request_service ("state");
+ state = capi->service_request ("state");
if (state != NULL)
{
sqot = GNUNET_htonll (lquota);
state->write (capi->ectx,
"FS-LAST-QUOTA", sizeof (unsigned long long), &sqot);
- capi->release_service (state);
+ capi->service_release (state);
}
else
{
@@ -408,12 +409,12 @@
_
("Failed to load state service. Trying to do
without.\n"));
}
- sq = capi->request_service ("sqstore");
+ sq = capi->service_request ("sqstore");
if (sq == NULL)
{
if (stats != NULL)
{
- capi->release_service (stats);
+ capi->service_release (stats);
stats = NULL;
}
GNUNET_GE_BREAK (capi->ectx, 0);
@@ -425,10 +426,10 @@
{
GNUNET_GE_BREAK (capi->ectx, 0);
donePrefetch ();
- capi->release_service (sq);
+ capi->service_release (sq);
if (stats != NULL)
{
- capi->release_service (stats);
+ capi->service_release (stats);
stats = NULL;
}
return NULL;
@@ -475,10 +476,10 @@
cron = NULL;
donePrefetch ();
doneFilters ();
- coreAPI->release_service (sq);
+ coreAPI->service_release (sq);
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
GNUNET_mutex_destroy (lock);
@@ -520,7 +521,7 @@
-1) / 1024 / 1024,
1024, "a))
return; /* OOPS */
- state = uapi->request_service ("state");
+ state = uapi->service_request ("state");
lq = NULL;
if ((state != NULL) &&
(sizeof (unsigned long long) == state->read (uapi->ectx,
@@ -528,7 +529,7 @@
(void **) &lq)) &&
(GNUNET_ntohll (*lq) == quota))
{
- uapi->release_service (state);
+ uapi->service_release (state);
GNUNET_free (lq);
return; /* no change */
}
@@ -536,11 +537,11 @@
/* ok, need to convert! */
deleteFilter (uapi->ectx, uapi->cfg);
initFilters (uapi->ectx, uapi->cfg);
- sq = uapi->request_service ("sqstore");
+ sq = uapi->service_request ("sqstore");
if (sq != NULL)
{
sq->iterateAllNow (&filterAddAll, NULL);
- uapi->release_service (sq);
+ uapi->service_release (sq);
}
else
{
@@ -557,7 +558,7 @@
lastQuota = GNUNET_htonll (quota);
state->write (uapi->ectx,
"FS-LAST-QUOTA", sizeof (unsigned long long), &lastQuota);
- uapi->release_service (state);
+ uapi->service_release (state);
}
}
Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/dht/module/cs.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -125,13 +125,13 @@
__FUNCTION__, __FILE__, __LINE__, size, value);
#endif
if (GNUNET_OK !=
- coreAPI->cs_send_to_client (record->client, &msg->header, GNUNET_YES))
+ coreAPI->cs_send_message (record->client, &msg->header, GNUNET_YES))
{
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_ERROR | GNUNET_GE_IMMEDIATE | GNUNET_GE_USER,
_("`%s' failed. Terminating connection to client.\n"),
"cs_send_to_client");
- coreAPI->cs_terminate_client_connection (record->client);
+ coreAPI->cs_disconnect_now (record->client);
}
GNUNET_free (msg);
return GNUNET_OK;
@@ -211,7 +211,7 @@
{
int status;
- dhtAPI = capi->request_service ("dht");
+ dhtAPI = capi->service_request ("dht");
if (dhtAPI == NULL)
return GNUNET_SYSERR;
coreAPI = capi;
@@ -223,12 +223,12 @@
status = GNUNET_OK;
lock = GNUNET_mutex_create (GNUNET_NO);
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_DHT_REQUEST_PUT, &csPut))
+ capi->cs_handler_register (GNUNET_CS_PROTO_DHT_REQUEST_PUT, &csPut))
status = GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_DHT_REQUEST_GET, &csGet))
+ capi->cs_handler_register (GNUNET_CS_PROTO_DHT_REQUEST_GET, &csGet))
status = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->cs_exit_handler_register (&csClientExit))
+ if (GNUNET_SYSERR == capi->cs_disconnect_handler_register (&csClientExit))
status = GNUNET_SYSERR;
GNUNET_GE_ASSERT (capi->ectx,
0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
@@ -288,19 +288,19 @@
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"DHT: shutdown\n");
if (GNUNET_OK !=
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_DHT_REQUEST_PUT,
- &csPut))
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_DHT_REQUEST_PUT,
+ &csPut))
status = GNUNET_SYSERR;
if (GNUNET_OK !=
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_DHT_REQUEST_GET,
- &csGet))
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_DHT_REQUEST_GET,
+ &csGet))
status = GNUNET_SYSERR;
- if (GNUNET_OK != coreAPI->cs_exit_handler_unregister (&csClientExit))
+ if (GNUNET_OK != coreAPI->cs_disconnect_handler_unregister (&csClientExit))
status = GNUNET_SYSERR;
while (getRecords != NULL)
kill_record (getRecords);
- coreAPI->release_service (dhtAPI);
+ coreAPI->service_release (dhtAPI);
dhtAPI = NULL;
coreAPI = NULL;
GNUNET_mutex_destroy (lock);
Modified: GNUnet/src/applications/dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dht/module/routing.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/dht/module/routing.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -346,7 +346,8 @@
continue;
}
if (0 != memcmp (&pos->source,
- coreAPI->myIdentity, sizeof (GNUNET_PeerIdentity)))
+ coreAPI->my_identity,
+ sizeof (GNUNET_PeerIdentity)))
{
#if DEBUG_ROUTING
GNUNET_hash_to_enc (&pos->source.hashPubKey, &enc);
@@ -355,8 +356,9 @@
GNUNET_GE_DEVELOPER,
"Routing result to `%s'\n", &enc);
#endif
- coreAPI->unicast (&pos->source,
- &result->header, DHT_PRIORITY, DHT_DELAY);
+ coreAPI->ciphertext_send (&pos->source,
+ &result->header, DHT_PRIORITY,
+ DHT_DELAY);
if (stats != NULL)
stats->change (stat_replies_routed, 1);
}
@@ -461,7 +463,7 @@
if (sender != NULL)
pos->source = *sender;
else
- pos->source = *coreAPI->myIdentity;
+ pos->source = *coreAPI->my_identity;
pos->expire = expire;
pos->receiver = handler;
pos->receiver_closure = cls;
@@ -564,7 +566,8 @@
GNUNET_GE_DEVELOPER,
"Forwarding DHT GET request to peer `%s'.\n", &enc);
#endif
- coreAPI->unicast (&next[i], &aget.header, DHT_PRIORITY, DHT_DELAY);
+ coreAPI->ciphertext_send (&next[i], &aget.header, DHT_PRIORITY,
+ DHT_DELAY);
}
return GNUNET_OK;
}
@@ -631,7 +634,7 @@
continue;
}
if (1 == GNUNET_hash_xorcmp (&next[j].hashPubKey,
- &coreAPI->myIdentity->hashPubKey,
+ &coreAPI->my_identity->hashPubKey,
&put->key))
store = 1; /* we're closer than the selected target */
#if DEBUG_ROUTING
@@ -641,7 +644,8 @@
GNUNET_GE_DEVELOPER,
"Forwarding DHT PUT request to peer `%s'.\n", &enc);
#endif
- coreAPI->unicast (&next[j], &aput->header, DHT_PRIORITY, DHT_DELAY);
+ coreAPI->ciphertext_send (&next[j], &aput->header, DHT_PRIORITY,
+ DHT_DELAY);
j++;
}
GNUNET_free (aput);
@@ -800,7 +804,7 @@
* ensure that the datum is certainly deleted by that time (it maybe
* deleted earlier).
*
- * @param expirationTime absolute expiration time
+ * @param expiration_time absolute expiration time
*/
int
GNUNET_DHT_put (const GNUNET_HashCode * key,
@@ -854,13 +858,13 @@
"DHT",
"TABLESIZE",
128, 1024 * 1024, 1024, &rts);
- dstore = coreAPI->request_service ("dstore");
+ dstore = coreAPI->service_request ("dstore");
if (dstore == NULL)
return GNUNET_SYSERR;
GNUNET_array_grow (records, rt_size, rts);
lock = GNUNET_mutex_create (GNUNET_NO);
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_replies_routed =
@@ -880,12 +884,14 @@
_("`%s' registering p2p handlers: %d %d %d\n"),
"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->
- connection_register_send_callback (sizeof (DHT_MESSAGE), 0,
- &extra_get_callback);
+ coreAPI->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_DHT_GET,
+ &handleGet);
+ coreAPI->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_DHT_PUT,
+ &handlePut);
+ coreAPI->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_DHT_RESULT,
+ &handleResult);
+ coreAPI->send_callback_register (sizeof (DHT_MESSAGE), 0,
+ &extra_get_callback);
return GNUNET_OK;
}
@@ -901,14 +907,16 @@
struct DHT_Source_Route *pos;
coreAPI->
- connection_unregister_send_callback (sizeof (DHT_MESSAGE),
- &extra_get_callback);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_GET, &handleGet);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_PUT, &handlePut);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_RESULT, &handleResult);
+ send_callback_unregister (sizeof (DHT_MESSAGE), &extra_get_callback);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_DHT_GET,
+ &handleGet);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_DHT_PUT,
+ &handlePut);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_DHT_RESULT,
+ &handleResult);
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
GNUNET_mutex_destroy (lock);
@@ -923,7 +931,7 @@
GNUNET_array_grow (records[i].results, records[i].result_count, 0);
}
GNUNET_array_grow (records, rt_size, 0);
- coreAPI->release_service (dstore);
+ coreAPI->service_release (dstore);
return GNUNET_OK;
}
Modified: GNUnet/src/applications/dht/module/routing.h
===================================================================
--- GNUnet/src/applications/dht/module/routing.h 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/dht/module/routing.h 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -51,7 +51,7 @@
* expire after a period of time and the client is responsible for
* doing periodic refreshs.
*
- * @param expirationTime absolute expiration time
+ * @param expiration_time absolute expiration time
*/
int GNUNET_DHT_put (const GNUNET_HashCode * key,
unsigned int type, unsigned int size, const char *data);
Modified: GNUnet/src/applications/dht/module/table.c
===================================================================
--- GNUnet/src/applications/dht/module/table.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/dht/module/table.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -272,10 +272,10 @@
unsigned int index;
int i;
- if (0 == memcmp (peer, coreAPI->myIdentity, sizeof (GNUNET_PeerIdentity)))
+ if (0 == memcmp (peer, coreAPI->my_identity, sizeof (GNUNET_PeerIdentity)))
return NULL; /* myself! */
index = get_bit_distance (&peer->hashPubKey,
- &coreAPI->myIdentity->hashPubKey);
+ &coreAPI->my_identity->hashPubKey);
i = bucketCount - 1;
while ((buckets[i].bstart >= index) && (i > 0))
i--;
@@ -447,10 +447,10 @@
stats->change (stat_dht_advertisements, 1);
if (disco != NULL)
{
- coreAPI->unicast (other,
- &disco->header,
- GNUNET_EXTREME_PRIORITY / 4,
- MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
+ coreAPI->ciphertext_send (other,
+ &disco->header,
+ GNUNET_EXTREME_PRIORITY / 4,
+ MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
return;
}
pc = total_peers;
@@ -469,7 +469,7 @@
{
/* put in our own identity (otherwise we get into a
storm of empty discovery messages) */
- pos[0] = *coreAPI->myIdentity;
+ pos[0] = *coreAPI->my_identity;
i = 1;
}
while (i < pc)
@@ -482,8 +482,8 @@
}
disco->header.size =
htons (pc * sizeof (GNUNET_PeerIdentity) + sizeof (P2P_DHT_Discovery));
- coreAPI->unicast (other, &disco->header, 0,
- MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
+ coreAPI->ciphertext_send (other, &disco->header, 0,
+ MAINTAIN_FREQUENCY * MAINTAIN_CHANCE / 2);
GNUNET_free (disco);
}
@@ -508,11 +508,11 @@
disc.header.size = htons (sizeof (P2P_DHT_Discovery));
disc.header.type = htons (GNUNET_P2P_PROTO_DHT_DISCOVERY);
disc.space_available = -1; /* FIXME */
- coreAPI->forAllConnectedNodes (&broadcast_dht_discovery_prob, &disc);
+ coreAPI->p2p_connections_iterate (&broadcast_dht_discovery_prob, &disc);
}
else
{
- coreAPI->forAllConnectedNodes (&broadcast_dht_discovery_prob, NULL);
+ coreAPI->p2p_connections_iterate (&broadcast_dht_discovery_prob, NULL);
}
}
@@ -633,13 +633,13 @@
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 */
- 5 * GNUNET_CRON_SECONDS);
+ coreAPI->ciphertext_send (sender, &ask.header, 0, /* FIXME: priority */
+ 5 * GNUNET_CRON_SECONDS);
return;
}
GNUNET_free (hello);
/* check if connected, if not, send discovery */
- if (GNUNET_OK != coreAPI->queryPeerStatus (peer, NULL, NULL))
+ if (GNUNET_OK != coreAPI->p2p_connection_status_check (peer, NULL, NULL))
{
/* not yet connected; connect sending DISCOVERY */
broadcast_dht_discovery (peer, NULL);
@@ -725,7 +725,8 @@
GNUNET_NO);
if (hello == NULL)
return GNUNET_OK;
- coreAPI->unicast (sender, &hello->header, 0, 5 * GNUNET_CRON_SECONDS);
+ coreAPI->ciphertext_send (sender, &hello->header, 0,
+ 5 * GNUNET_CRON_SECONDS);
GNUNET_free (hello);
return GNUNET_OK;
}
@@ -764,7 +765,7 @@
coreAPI = capi;
/* use less than 50% of peer's ideal number of
connections for DHT table size */
- i = coreAPI->connection_get_slot_count () / MAINTAIN_BUCKET_SIZE / 2;
+ i = coreAPI->core_slots_count () / MAINTAIN_BUCKET_SIZE / 2;
if (i < 4)
i = 4;
GNUNET_array_grow (buckets, bucketCount, i);
@@ -773,8 +774,8 @@
buckets[i].bstart = 512 * i / bucketCount;
buckets[i].bend = 512 * (i + 1) / bucketCount;
}
- lock = capi->connection_get_lock ();
- stats = capi->request_service ("stats");
+ lock = capi->global_lock_get ();
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_dht_total_peers =
@@ -786,16 +787,18 @@
stat_dht_advertisements =
stats->create (gettext_noop ("# dht discovery messages sent"));
}
- identity = coreAPI->request_service ("identity");
+ identity = coreAPI->service_request ("identity");
GNUNET_GE_ASSERT (coreAPI->ectx, identity != NULL);
- pingpong = coreAPI->request_service ("pingpong");
+ pingpong = coreAPI->service_request ("pingpong");
GNUNET_GE_ASSERT (coreAPI->ectx, pingpong != NULL);
- capi->registerHandler (GNUNET_P2P_PROTO_DHT_DISCOVERY, &handleDiscovery);
- capi->registerHandler (GNUNET_P2P_PROTO_DHT_ASK_HELLO, &handleAskHello);
- capi->register_notify_peer_disconnect (&peer_disconnect_handler, NULL);
- GNUNET_cron_add_job (coreAPI->cron,
- &maintain_dht_job,
- MAINTAIN_FREQUENCY, MAINTAIN_FREQUENCY, NULL);
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_DHT_DISCOVERY,
+ &handleDiscovery);
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_DHT_ASK_HELLO,
+ &handleAskHello);
+ capi->peer_disconnect_notification_register (&peer_disconnect_handler,
+ NULL);
+ GNUNET_cron_add_job (coreAPI->cron, &maintain_dht_job, MAINTAIN_FREQUENCY,
+ MAINTAIN_FREQUENCY, NULL);
return GNUNET_OK;
}
@@ -810,21 +813,22 @@
unsigned int i;
unsigned int j;
- coreAPI->unregister_notify_peer_disconnect (&peer_disconnect_handler, NULL);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_DISCOVERY,
- &handleDiscovery);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_DHT_ASK_HELLO,
- &handleAskHello);
+ coreAPI->peer_disconnect_notification_unregister (&peer_disconnect_handler,
+ NULL);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_DHT_DISCOVERY,
+ &handleDiscovery);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_DHT_ASK_HELLO,
+ &handleAskHello);
GNUNET_cron_del_job (coreAPI->cron, &maintain_dht_job, MAINTAIN_FREQUENCY,
NULL);
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
- coreAPI->release_service (pingpong);
+ coreAPI->service_release (pingpong);
pingpong = NULL;
for (i = 0; i < bucketCount; i++)
{
Modified: GNUnet/src/applications/dstore_mysql/dstore_mysql.c
===================================================================
--- GNUnet/src/applications/dstore_mysql/dstore_mysql.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/dstore_mysql/dstore_mysql.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -789,7 +789,7 @@
5);
CLOSE (fd);
}
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_dstore_size = stats->create (gettext_noop ("# bytes in dstore"));
@@ -816,7 +816,7 @@
bloom_name = NULL;
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
#if DEBUG_SQLITE
Modified: GNUnet/src/applications/dstore_sqlite/dstore.c
===================================================================
--- GNUnet/src/applications/dstore_sqlite/dstore.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/dstore_sqlite/dstore.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -593,7 +593,7 @@
5);
CLOSE (fd);
}
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_dstore_size = stats->create (gettext_noop ("# bytes in dstore"));
@@ -623,7 +623,7 @@
bloom_name = NULL;
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
#if DEBUG_SQLITE
Modified: GNUnet/src/applications/fragmentation/fragmentation.c
===================================================================
--- GNUnet/src/applications/fragmentation/fragmentation.c 2008-03-25
03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/fragmentation/fragmentation.c 2008-03-25
06:23:12 UTC (rev 6615)
@@ -229,7 +229,7 @@
printf ("Finished defragmentation!\n");
#endif
/* handle message! */
- coreAPI->p2p_inject_message (&pep->sender, msg, len, GNUNET_YES, NULL);
+ coreAPI->loopback_send (&pep->sender, msg, len, GNUNET_YES, NULL);
GNUNET_free (msg);
CLEANUP:
/* free fragment buffers */
@@ -508,10 +508,10 @@
memcpy (&frag[1],
&((char *) (&ctx[1]))[pos],
mlen - sizeof (P2P_fragmentation_MESSAGE));
- coreAPI->unicast (&ctx->sender,
- &frag->header,
- GNUNET_EXTREME_PRIORITY,
- ctx->transmissionTime - GNUNET_get_time ());
+ coreAPI->ciphertext_send (&ctx->sender,
+ &frag->header,
+ GNUNET_EXTREME_PRIORITY,
+ ctx->transmissionTime - GNUNET_get_time ());
pos += mlen - sizeof (P2P_fragmentation_MESSAGE);
}
GNUNET_GE_ASSERT (NULL, pos == ctx->len);
@@ -557,8 +557,8 @@
}
}
xlen = mtu - sizeof (P2P_fragmentation_MESSAGE);
- coreAPI->connection_send_using_callback (peer, &fragmentBMC, fbmc, mtu, prio
* xlen / len, /* compute new prio */
- targetTime);
+ coreAPI->ciphertext_send_with_callback (peer, &fragmentBMC, fbmc, mtu, prio
* xlen / len, /* compute new priority */
+ targetTime);
}
/**
@@ -571,7 +571,7 @@
int i;
coreAPI = capi;
- stats = coreAPI->request_service ("stats");
+ stats = coreAPI->service_request ("stats");
if (stats != NULL)
{
stat_defragmented =
@@ -591,7 +591,8 @@
GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("`%s' registering handler %d\n"), "fragmentation",
GNUNET_P2P_PROTO_MESSAGE_FRAGMENT);
- capi->registerHandler (GNUNET_P2P_PROTO_MESSAGE_FRAGMENT, &processFragment);
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_MESSAGE_FRAGMENT,
+ &processFragment);
ret.fragment = &fragment;
return &ret;
@@ -605,8 +606,9 @@
{
int i;
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_MESSAGE_FRAGMENT,
- &processFragment);
+ coreAPI->
+ p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_MESSAGE_FRAGMENT,
+ &processFragment);
GNUNET_cron_del_job (coreAPI->cron, &defragmentationPurgeCron,
60 * GNUNET_CRON_SECONDS, NULL);
for (i = 0; i < DEFRAG_BUCKET_COUNT; i++)
@@ -622,7 +624,7 @@
}
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
GNUNET_mutex_destroy (defragCacheLock);
Modified: GNUnet/src/applications/fragmentation/fragmentationtest.c
===================================================================
--- GNUnet/src/applications/fragmentation/fragmentationtest.c 2008-03-25
03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/fragmentation/fragmentationtest.c 2008-03-25
06:23:12 UTC (rev 6615)
@@ -394,10 +394,10 @@
memset (&capi, 0, sizeof (GNUNET_CoreAPIForPlugins));
capi.cron = GNUNET_cron_create (NULL);
- capi.p2p_inject_message = &handleHelper;
- capi.request_service = &request_service;
- capi.registerHandler = &p2p_register_handler;
- capi.unregisterHandler = &p2p_unregister_handler;
+ capi.loopback_send = &handleHelper;
+ capi.service_request = &request_service;
+ capi.p2p_ciphertext_handler_register = &p2p_register_handler;
+ capi.p2p_ciphertext_handler_unregister = &p2p_unregister_handler;
provide_module_fragmentation (&capi);
fprintf (stderr, ".");
Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/download.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -57,9 +57,9 @@
struct Node *next;
/**
- * What is the CHK for this block?
+ * What is the GNUNET_EC_ContentHashKey for this block?
*/
- CHK chk;
+ GNUNET_EC_ContentHashKey chk;
/**
* At what offset (on the respective level!) is this
@@ -175,7 +175,7 @@
* Abort? Flag that can be set at any time
* to abort the RM as soon as possible. Set
* to GNUNET_YES during orderly shutdown,
- * set to GNUNET_SYSERR on error.
+ * set to GNUNET_SYSERR on error.
*/
int abortFlag;
@@ -380,7 +380,7 @@
rsize = DBLOCK_SIZE;
for (i = 0; i < node->level - 1; i++)
rsize *= CHK_PER_INODE;
- spos = rsize * (node->offset / sizeof (CHK));
+ spos = rsize * (node->offset / sizeof (GNUNET_EC_ContentHashKey));
epos = spos + rsize * CHK_PER_INODE;
if (epos > node->ctx->total)
epos = node->ctx->total;
@@ -391,9 +391,10 @@
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));
+ node->offset, node->level,
+ ret * sizeof (GNUNET_EC_ContentHashKey));
#endif
- return ret * sizeof (CHK);
+ return ret * sizeof (GNUNET_EC_ContentHashKey);
}
/**
@@ -422,7 +423,7 @@
/**
- * DOWNLOAD children of this IBlock.
+ * DOWNLOAD children of this GNUNET_EC_IBlock.
*
* @param node the node for which the children should be downloaded
* @param data data for the node
@@ -481,7 +482,7 @@
}
/**
- * DOWNLOAD children of this IBlock.
+ * DOWNLOAD children of this GNUNET_EC_IBlock.
*
* @param node the node that should be downloaded
*/
@@ -493,13 +494,13 @@
int i;
struct Node *child;
unsigned int childcount;
- const CHK *chks;
+ const GNUNET_EC_ContentHashKey *chks;
unsigned int levelSize;
unsigned long long baseOffset;
GNUNET_GE_ASSERT (ectx, node->level > 0);
- childcount = size / sizeof (CHK);
- if (size != childcount * sizeof (CHK))
+ childcount = size / sizeof (GNUNET_EC_ContentHashKey);
+ if (size != childcount * sizeof (GNUNET_EC_ContentHashKey))
{
GNUNET_GE_BREAK (ectx, 0);
return;
@@ -507,14 +508,15 @@
if (node->level == 1)
{
levelSize = DBLOCK_SIZE;
- baseOffset = node->offset / sizeof (CHK) * DBLOCK_SIZE;
+ baseOffset =
+ node->offset / sizeof (GNUNET_EC_ContentHashKey) * DBLOCK_SIZE;
}
else
{
- levelSize = sizeof (CHK) * CHK_PER_INODE;
+ levelSize = sizeof (GNUNET_EC_ContentHashKey) * CHK_PER_INODE;
baseOffset = node->offset * CHK_PER_INODE;
}
- chks = (const CHK *) data;
+ chks = (const GNUNET_EC_ContentHashKey *) data;
for (i = 0; i < childcount; i++)
{
child = GNUNET_malloc (sizeof (struct Node));
@@ -556,7 +558,7 @@
}
/**
- * We received a CHK reply for a block. Decrypt. Note
+ * We received a GNUNET_EC_ContentHashKey reply for a block. Decrypt. Note
* that the caller (fslib) has already aquired the
* RM lock (we sometimes aquire it again in callees,
* mostly because our callees could be also be theoretically
@@ -590,17 +592,18 @@
0 == memcmp (query, &node->chk.query,
sizeof (GNUNET_HashCode)));
size = ntohl (reply->size) - sizeof (GNUNET_DatastoreValue);
- if ((size <= sizeof (DBlock)) ||
- (size - sizeof (DBlock) != get_node_size (node)))
+ if ((size <= sizeof (GNUNET_EC_DBlock)) ||
+ (size - sizeof (GNUNET_EC_DBlock) != get_node_size (node)))
{
GNUNET_GE_BREAK (ectx, 0);
GNUNET_mutex_unlock (rm->lock);
return GNUNET_SYSERR; /* invalid size! */
}
- size -= sizeof (DBlock);
+ size -= sizeof (GNUNET_EC_DBlock);
data = GNUNET_malloc (size);
if (GNUNET_SYSERR ==
- decrypt_content ((const char *) &((const DBlock *) &reply[1])[1], size,
+ decrypt_content ((const char *)
+ &((const GNUNET_EC_DBlock *) &reply[1])[1], size,
&node->chk.key, data))
GNUNET_GE_ASSERT (ectx, 0);
GNUNET_hash (data, size, &hc);
Modified: GNUnet/src/applications/fs/ecrs/downloadtest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/downloadtest.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/fs/ecrs/downloadtest.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -97,7 +97,7 @@
CLOSE (fd);
ret = GNUNET_ECRS_file_upload (NULL, cfg, name, GNUNET_YES, /* index */
0, /* anon */
- 0, /* prio */
+ 0, /* priority */
GNUNET_get_time () + 10 *
GNUNET_CRON_MINUTES, /* expire */
NULL, /* progress */
NULL, &testTerminate, NULL, &uri);
Modified: GNUnet/src/applications/fs/ecrs/ecrs.h
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrs.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/ecrs.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -35,7 +35,7 @@
/**
- * Fixed SBlock updateInterval codes. Positive values
+ * Fixed GNUNET_EC_SBlock updateInterval codes. Positive values
* are interpreted as durations (in seconds) for periodical
* updates.
*/
@@ -50,7 +50,7 @@
/**
* Information about the shared file.
*/
- FileIdentifier fi;
+ GNUNET_EC_FileIdentifier fi;
/**
* Identity of the peer sharing the file.
@@ -64,7 +64,7 @@
GNUNET_Int32Time expirationTime;
/**
- * RSA signature over the FileIdentifier,
+ * RSA signature over the GNUNET_EC_FileIdentifier,
* GNUNET_hash of the peer and expiration time.
*/
GNUNET_RSA_Signature contentSignature;
@@ -89,7 +89,7 @@
GNUNET_HashCode namespace;
GNUNET_HashCode identifier;
} sks;
- FileIdentifier fi;
+ GNUNET_EC_FileIdentifier fi;
Location loc;
} data;
} URI;
Modified: GNUnet/src/applications/fs/ecrs/ecrstest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrstest.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/ecrstest.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -89,7 +89,7 @@
CLOSE (fd);
ret = GNUNET_ECRS_file_upload (NULL, cfg, name, GNUNET_YES, /* index */
0, /* anon */
- 0, /* prio */
+ 0, /* priority */
GNUNET_get_time () + 10 *
GNUNET_CRON_MINUTES, /* expire */
NULL, /* progress */
NULL, &testTerminate, NULL, &uri);
Modified: GNUnet/src/applications/fs/ecrs/keyspace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/keyspace.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/keyspace.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -59,23 +59,24 @@
GNUNET_ECRS_FileInfo fi;
unsigned int size;
GNUNET_HashCode query;
- KBlock *kb;
+ GNUNET_EC_KBlock *kb;
const char *dstURI;
int j;
type = ntohl (value->type);
size = ntohl (value->size) - sizeof (GNUNET_DatastoreValue);
if (GNUNET_OK !=
- GNUNET_EC_file_block_check_and_get_query (size, (DBlock *) & value[1],
- GNUNET_YES, &query))
+ GNUNET_EC_file_block_check_and_get_query (size,
+ (GNUNET_EC_DBlock *) &
+ value[1], GNUNET_YES, &query))
return GNUNET_SYSERR;
GNUNET_GE_ASSERT (ectx, type == GNUNET_ECRS_BLOCKTYPE_KEYWORD);
- if (size < sizeof (KBlock))
+ if (size < sizeof (GNUNET_EC_KBlock))
return GNUNET_SYSERR;
- kb = (KBlock *) & value[1];
- GNUNET_ECRS_decryptInPlace (key, &kb[1], size - sizeof (KBlock));
- j = sizeof (KBlock);
+ kb = (GNUNET_EC_KBlock *) & value[1];
+ GNUNET_ECRS_decryptInPlace (key, &kb[1], size - sizeof (GNUNET_EC_KBlock));
+ j = sizeof (GNUNET_EC_KBlock);
while ((j < size) && (((const char *) kb)[j] != '\0'))
j++;
if (j == size)
@@ -134,7 +135,7 @@
unsigned int mdsize;
struct GNUNET_RSA_PrivateKey *pk;
char *dstURI;
- KBlock *kb;
+ GNUNET_EC_KBlock *kb;
char **keywords;
unsigned int keywordCount;
int i;
@@ -157,15 +158,15 @@
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;
+ size = mdsize + sizeof (GNUNET_EC_KBlock) + strlen (dstURI) + 1;
if (size > MAX_KBLOCK_SIZE)
{
size = MAX_KBLOCK_SIZE;
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
- kb = (KBlock *) & value[1];
+ kb = (GNUNET_EC_KBlock *) & value[1];
kb->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memcpy (&kb[1], dstURI, strlen (dstURI) + 1);
- mdsize = size - sizeof (KBlock) - strlen (dstURI) - 1;
+ mdsize = size - sizeof (GNUNET_EC_KBlock) - strlen (dstURI) - 1;
mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
md,
&((char *)
@@ -179,12 +180,12 @@
GNUNET_free (value);
return GNUNET_SYSERR;
}
- size = sizeof (KBlock) + strlen (dstURI) + 1 + mdsize;
+ size = sizeof (GNUNET_EC_KBlock) + strlen (dstURI) + 1 + mdsize;
}
else
{
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
- kb = (KBlock *) & value[1];
+ kb = (GNUNET_EC_KBlock *) & value[1];
kb->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memcpy (&kb[1], dstURI, strlen (dstURI) + 1);
GNUNET_GE_ASSERT (ectx,
@@ -199,9 +200,9 @@
}
value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
value->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
- value->prio = htonl (priority);
- value->anonymityLevel = htonl (anonymityLevel);
- value->expirationTime = GNUNET_htonll (expirationTime);
+ value->priority = htonl (priority);
+ value->anonymity_level = htonl (anonymityLevel);
+ value->expiration_time = GNUNET_htonll (expirationTime);
sock = GNUNET_client_connection_create (ectx, cfg);
ret = GNUNET_OK;
@@ -241,8 +242,8 @@
GNUNET_GE_ASSERT (ectx,
GNUNET_OK ==
GNUNET_EC_file_block_check_and_get_query (size,
- (DBlock *)
- kb,
+
(GNUNET_EC_DBlock
+ *) kb,
GNUNET_YES,
&hc));
#endif
Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -94,16 +94,16 @@
/**
* Create a new namespace (and publish an advertismement).
- * This publishes both an NBlock in the namespace itself
+ * This publishes both an GNUNET_EC_NBlock in the namespace itself
* as well as KNBlocks under all keywords specified in
* the advertisementURI.
*
* @param name the name for the namespace
- * @param anonymityLevel for the namespace advertismement
+ * @param anonymity_level for the namespace advertismement
* @param priority for the namespace advertisement
* @param expiration for the namespace advertisement
* @param advertisementURI the keyword (!) URI to advertise the
- * namespace under (KNBlock)
+ * namespace under (GNUNET_EC_KNBlock)
* @param meta meta-data for the namespace advertisement
* @param rootEntry name of the root entry in the namespace (for
* the namespace advertisement)
@@ -136,8 +136,8 @@
unsigned int size;
unsigned int mdsize;
struct GNUNET_RSA_PrivateKey *pk;
- NBlock *nb;
- KNBlock *knb;
+ GNUNET_EC_NBlock *nb;
+ GNUNET_EC_KNBlock *knb;
char **keywords;
unsigned int keywordCount;
int i;
@@ -172,14 +172,14 @@
mdsize =
GNUNET_ECRS_meta_data_get_serialized_size (meta,
GNUNET_ECRS_SERIALIZE_PART);
- size = mdsize + sizeof (NBlock);
+ size = mdsize + sizeof (GNUNET_EC_NBlock);
if (size > MAX_NBLOCK_SIZE)
{
size = MAX_NBLOCK_SIZE;
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
- nb = (NBlock *) & value[1];
+ nb = (GNUNET_EC_NBlock *) & value[1];
nb->type = htonl (GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
- mdsize = size - sizeof (NBlock);
+ mdsize = size - sizeof (GNUNET_EC_NBlock);
mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
meta,
(char *) &nb[1],
@@ -192,12 +192,12 @@
GNUNET_RSA_free_key (hk);
return NULL;
}
- size = sizeof (NBlock) + mdsize;
+ size = sizeof (GNUNET_EC_NBlock) + mdsize;
}
else
{
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
- nb = (NBlock *) & value[1];
+ nb = (GNUNET_EC_NBlock *) & value[1];
nb->type = htonl (GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
GNUNET_ECRS_meta_data_serialize (ectx,
meta,
@@ -206,12 +206,12 @@
}
value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
value->type = htonl (GNUNET_ECRS_BLOCKTYPE_NAMESPACE);
- value->prio = htonl (priority);
- value->anonymityLevel = htonl (anonymityLevel);
- value->expirationTime = GNUNET_htonll (expiration);
+ value->priority = htonl (priority);
+ value->anonymity_level = htonl (anonymityLevel);
+ value->expiration_time = GNUNET_htonll (expiration);
sock = GNUNET_client_connection_create (ectx, cfg);
- /* publish NBlock */
+ /* publish GNUNET_EC_NBlock */
memset (&nb->identifier, 0, sizeof (GNUNET_HashCode));
GNUNET_RSA_get_public_key (hk, &nb->subspace);
GNUNET_hash (&nb->subspace, sizeof (GNUNET_RSA_PublicKey), &nb->namespace);
@@ -242,37 +242,41 @@
/* publish KNBlocks */
- size += sizeof (KNBlock) - sizeof (NBlock);
+ size += sizeof (GNUNET_EC_KNBlock) - sizeof (GNUNET_EC_NBlock);
knvalue = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
*knvalue = *value;
knvalue->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE);
knvalue->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
- knb = (KNBlock *) & knvalue[1];
+ knb = (GNUNET_EC_KNBlock *) & knvalue[1];
knb->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE);
- memcpy (&knb->nblock, nb, sizeof (NBlock) + mdsize);
+ memcpy (&knb->nblock, nb, sizeof (GNUNET_EC_NBlock) + mdsize);
if (advertisementURI != NULL)
{
keywords = advertisementURI->data.ksk.keywords;
keywordCount = advertisementURI->data.ksk.keywordCount;
- cpy = GNUNET_malloc (size - sizeof (KBlock) - sizeof (unsigned int));
- memcpy (cpy,
- &knb->nblock, size - sizeof (KBlock) - sizeof (unsigned int));
+ cpy =
+ GNUNET_malloc (size - sizeof (GNUNET_EC_KBlock) -
+ sizeof (unsigned int));
+ memcpy (cpy, &knb->nblock,
+ size - sizeof (GNUNET_EC_KBlock) - sizeof (unsigned int));
for (i = 0; i < keywordCount; i++)
{
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);
GNUNET_GE_ASSERT (ectx,
- size - sizeof (KBlock) - sizeof (unsigned int) ==
- sizeof (NBlock) + mdsize);
+ size - sizeof (GNUNET_EC_KBlock) -
+ sizeof (unsigned int) ==
+ sizeof (GNUNET_EC_NBlock) + mdsize);
GNUNET_ECRS_encryptInPlace (&hc, &knb->nblock,
- size - sizeof (KBlock) -
+ size - sizeof (GNUNET_EC_KBlock) -
sizeof (unsigned int));
GNUNET_GE_ASSERT (ectx,
GNUNET_OK == GNUNET_RSA_sign (pk,
- sizeof (NBlock) +
+ sizeof
+ (GNUNET_EC_NBlock) +
mdsize,
&knb->nblock,
&knb->kblock.
@@ -293,7 +297,8 @@
}
/* restore nblock to avoid re-encryption! */
memcpy (&knb->nblock,
- cpy, size - sizeof (KBlock) - sizeof (unsigned int));
+ cpy,
+ size - sizeof (GNUNET_EC_KBlock) - sizeof (unsigned int));
}
GNUNET_free (cpy);
}
@@ -397,7 +402,7 @@
unsigned int size;
unsigned int mdsize;
struct GNUNET_RSA_PrivateKey *hk;
- SBlock *sb;
+ GNUNET_EC_SBlock *sb;
GNUNET_HashCode namespace;
char *dstURI;
char *destPos;
@@ -439,21 +444,21 @@
if (hk == NULL)
return NULL;
- /* THEN: construct SBlock */
+ /* THEN: construct GNUNET_EC_SBlock */
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;
+ size = mdsize + sizeof (GNUNET_EC_SBlock) + strlen (dstURI) + 1;
if (size > MAX_SBLOCK_SIZE)
{
size = MAX_SBLOCK_SIZE;
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
- sb = (SBlock *) & value[1];
+ sb = (GNUNET_EC_SBlock *) & value[1];
sb->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
destPos = (char *) &sb[1];
memcpy (destPos, dstURI, strlen (dstURI) + 1);
- mdsize = size - sizeof (SBlock) - strlen (dstURI) - 1;
+ mdsize = size - sizeof (GNUNET_EC_SBlock) - strlen (dstURI) - 1;
mdsize = GNUNET_ECRS_meta_data_serialize (ectx,
md,
&destPos[strlen (dstURI) + 1],
@@ -467,12 +472,12 @@
GNUNET_free (value);
return NULL;
}
- size = sizeof (SBlock) + mdsize + strlen (dstURI) + 1;
+ size = sizeof (GNUNET_EC_SBlock) + mdsize + strlen (dstURI) + 1;
}
else
{
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
- sb = (SBlock *) & value[1];
+ sb = (GNUNET_EC_SBlock *) & value[1];
sb->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
destPos = (char *) &sb[1];
memcpy (destPos, dstURI, strlen (dstURI) + 1);
@@ -483,11 +488,11 @@
}
value->size = htonl (sizeof (GNUNET_DatastoreValue) + size);
value->type = htonl (GNUNET_ECRS_BLOCKTYPE_SIGNED);
- value->prio = htonl (priority);
- value->anonymityLevel = htonl (anonymityLevel);
- value->expirationTime = GNUNET_htonll (expiration);
+ value->priority = htonl (priority);
+ value->anonymity_level = htonl (anonymityLevel);
+ value->expiration_time = GNUNET_htonll (expiration);
- /* update SBlock specific data */
+ /* update GNUNET_EC_SBlock specific data */
sb->creationTime = htonl (creationTime);
sb->updateInterval = htonl (updateInterval);
sb->nextIdentifier = *nextId;
@@ -510,7 +515,7 @@
- sizeof (GNUNET_RSA_Signature)
- sizeof (GNUNET_RSA_PublicKey) -
sizeof (GNUNET_HashCode));
- /* FINALLY: GNUNET_RSA_sign & publish SBlock */
+ /* FINALLY: GNUNET_RSA_sign & publish GNUNET_EC_SBlock */
GNUNET_GE_ASSERT (ectx,
GNUNET_OK == GNUNET_RSA_sign (hk,
size
Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/search.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -213,17 +213,17 @@
}
/**
- * Compute the "current" ID of an updateable SBlock. Will set the ID
+ * Compute the "current" ID of an updateable GNUNET_EC_SBlock. Will set the ID
* of the sblock itself for non-updateable content, the ID of the next
* identifier for sporadically updated SBlocks and the ID computed from
* the timing function for periodically updated SBlocks.
*
- * @param sb the SBlock (must be in plaintext)
+ * @param sb the GNUNET_EC_SBlock (must be in plaintext)
* @param now the time for which the ID should be computed
* @param c the resulting current ID (set)
*/
static int
-compute_id_at_time (const SBlock * sb, GNUNET_Int32Time now,
+compute_id_at_time (const GNUNET_EC_SBlock * sb, GNUNET_Int32Time now,
GNUNET_HashCode * c)
{
GNUNET_Int32Time pos;
@@ -261,12 +261,12 @@
}
/**
- * We found an NBlock. Decode the meta-data and call the callback of
+ * We found an GNUNET_EC_NBlock. Decode the meta-data and call the callback of
* the SQC with the root-URI for the namespace, together with the
* namespace advertisement.
*/
static int
-process_nblock_result (const NBlock * nb,
+process_nblock_result (const GNUNET_EC_NBlock * nb,
const GNUNET_HashCode * key,
unsigned int size,
struct GNUNET_ECRS_SearchContext *sqc)
@@ -278,7 +278,8 @@
fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
(const char *) &nb[1],
- size - sizeof (NBlock));
+ size -
+ sizeof (GNUNET_EC_NBlock));
if (fi.meta == NULL)
{
GNUNET_GE_BREAK (ectx, 0); /* nblock malformed */
@@ -330,8 +331,9 @@
#endif
if (GNUNET_OK !=
GNUNET_EC_file_block_check_and_get_query (size,
- (const DBlock *) &value[1],
- GNUNET_YES, &query))
+ (const GNUNET_EC_DBlock *)
+ &value[1], GNUNET_YES,
+ &query))
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
@@ -341,8 +343,8 @@
&& ((ps->type == type) || (ps->type == GNUNET_ECRS_BLOCKTYPE_ANY))
&& (GNUNET_YES ==
GNUNET_EC_is_block_applicable_for_query (type, size,
- (const DBlock *)
- &value[1], &query,
+ (const GNUNET_EC_DBlock
+ *) &value[1], &query,
ps->keyCount,
(GNUNET_HashCode *) &
ps[1]))))
@@ -354,14 +356,14 @@
{
case GNUNET_ECRS_BLOCKTYPE_KEYWORD:
{
- KBlock *kb;
+ GNUNET_EC_KBlock *kb;
const char *dstURI;
#if DEBUG_SEARCH
GNUNET_EncName enc;
#endif
int j;
- if (size < sizeof (KBlock))
+ if (size < sizeof (GNUNET_EC_KBlock))
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
@@ -378,8 +380,8 @@
"Decrypting KBlock with key %s.\n", &enc);
#endif
GNUNET_ECRS_decryptInPlace (&ps->decryptKey,
- &kb[1], size - sizeof (KBlock));
- j = sizeof (KBlock);
+ &kb[1], size - sizeof (GNUNET_EC_KBlock));
+ j = sizeof (GNUNET_EC_KBlock);
while ((j < size) && (((const char *) kb)[j] != '\0'))
j++;
if (j == size)
@@ -423,43 +425,43 @@
}
case GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
{
- const NBlock *nb;
+ const GNUNET_EC_NBlock *nb;
- if (size < sizeof (NBlock))
+ if (size < sizeof (GNUNET_EC_NBlock))
return GNUNET_SYSERR;
- nb = (const NBlock *) &value[1];
+ nb = (const GNUNET_EC_NBlock *) &value[1];
return process_nblock_result (nb, NULL, size, sqc);
}
case GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
{
- KNBlock *kb;
+ GNUNET_EC_KNBlock *kb;
int ret;
- if (size < sizeof (KNBlock))
+ if (size < sizeof (GNUNET_EC_KNBlock))
return GNUNET_SYSERR;
kb = GNUNET_malloc (size);
memcpy (kb, &value[1], size);
GNUNET_ECRS_decryptInPlace (&ps->decryptKey,
&kb->nblock,
- size - sizeof (KBlock) -
+ size - sizeof (GNUNET_EC_KBlock) -
sizeof (unsigned int));
ret =
process_nblock_result (&kb->nblock, &ps->decryptKey,
- size - sizeof (KNBlock) + sizeof (NBlock),
- sqc);
+ size - sizeof (GNUNET_EC_KNBlock) +
+ sizeof (GNUNET_EC_NBlock), sqc);
GNUNET_free (kb);
return ret;
}
case GNUNET_ECRS_BLOCKTYPE_SIGNED:
{
- SBlock *sb;
+ GNUNET_EC_SBlock *sb;
const char *dstURI;
int j;
GNUNET_Int32Time now;
GNUNET_HashCode updateId;
URI updateURI;
- if (size < sizeof (SBlock))
+ if (size < sizeof (GNUNET_EC_SBlock))
return GNUNET_SYSERR;
sb = GNUNET_malloc (size);
memcpy (sb, &value[1], size);
@@ -472,9 +474,9 @@
- sizeof (GNUNET_HashCode));
j = 0;
dstURI = (const char *) &sb[1];
- while ((j < size - sizeof (SBlock)) && (dstURI[j] != '\0'))
+ while ((j < size - sizeof (GNUNET_EC_SBlock)) && (dstURI[j] != '\0'))
j++;
- if (j == size - sizeof (SBlock))
+ if (j == size - sizeof (GNUNET_EC_SBlock))
{
GNUNET_GE_BREAK (ectx, 0); /* sblock malformed */
GNUNET_free (sb);
@@ -485,7 +487,8 @@
fi.meta = GNUNET_ECRS_meta_data_deserialize (ectx,
&dstURI[j],
size - j -
- sizeof (SBlock));
+ sizeof
+ (GNUNET_EC_SBlock));
if (fi.meta == NULL)
{
GNUNET_GE_BREAK (ectx, 0); /* sblock malformed */
@@ -511,7 +514,7 @@
GNUNET_ECRS_uri_destroy (fi.uri);
GNUNET_ECRS_meta_data_destroy (fi.meta);
- /* compute current/NEXT URI (if updateable SBlock) and issue
+ /* compute current/NEXT URI (if updateable GNUNET_EC_SBlock) and issue
respective query automatically! */
GNUNET_get_time_int32 (&now);
if (GNUNET_OK != compute_id_at_time (sb, now, &updateId))
Modified: GNUnet/src/applications/fs/ecrs/tree.h
===================================================================
--- GNUnet/src/applications/fs/ecrs/tree.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/tree.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -24,8 +24,8 @@
#include "ecrs_core.h"
/**
- * Size of a DBlock. Should be a multiple of 8 and larger than
- * sizeof(CHK).
+ * Size of a GNUNET_EC_DBlock. Should be a multiple of 8 and larger than
+ * sizeof(GNUNET_EC_ContentHashKey).
*/
#define DBLOCK_SIZE 32768
@@ -43,7 +43,7 @@
* CHK_PER_INODE is chosen such that
* IBLOCK_SIZE == DBLOCK_SIZE.
*/
-#define IBLOCK_SIZE (CHK_PER_INODE * sizeof(CHK))
+#define IBLOCK_SIZE (CHK_PER_INODE * sizeof(GNUNET_EC_ContentHashKey))
/**
* Compute the depth of the tree.
Modified: GNUnet/src/applications/fs/ecrs/unindex.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/unindex.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/unindex.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -54,18 +54,19 @@
*/
static int
pushBlock (struct GNUNET_ClientServerConnection *sock,
- const CHK * chk, unsigned int level,
+ const GNUNET_EC_ContentHashKey * chk, unsigned int level,
GNUNET_DatastoreValue ** iblocks)
{
unsigned int size;
unsigned int present;
GNUNET_DatastoreValue *value;
- DBlock *db;
- CHK ichk;
+ GNUNET_EC_DBlock *db;
+ GNUNET_EC_ContentHashKey ichk;
size = ntohl (iblocks[level]->size) - sizeof (GNUNET_DatastoreValue);
- present = (size - sizeof (DBlock)) / sizeof (CHK);
- db = (DBlock *) & iblocks[level][1];
+ present =
+ (size - sizeof (GNUNET_EC_DBlock)) / sizeof (GNUNET_EC_ContentHashKey);
+ db = (GNUNET_EC_DBlock *) & iblocks[level][1];
if (present == CHK_PER_INODE)
{
GNUNET_EC_file_block_get_key (db, size, &ichk.key);
@@ -87,12 +88,12 @@
GNUNET_FS_delete (sock, value);
#endif
GNUNET_free (value);
- size = sizeof (DBlock);
+ size = sizeof (GNUNET_EC_DBlock);
}
- /* append CHK */
- memcpy (&((char *) db)[size], chk, sizeof (CHK));
+ /* append GNUNET_EC_ContentHashKey */
+ memcpy (&((char *) db)[size], chk, sizeof (GNUNET_EC_ContentHashKey));
iblocks[level]->size = htonl (size +
- sizeof (CHK) +
+ sizeof (GNUNET_EC_ContentHashKey) +
sizeof (GNUNET_DatastoreValue));
return GNUNET_OK;
}
@@ -179,11 +180,11 @@
unsigned int size;
GNUNET_DatastoreValue **iblocks;
GNUNET_DatastoreValue *dblock;
- DBlock *db;
+ GNUNET_EC_DBlock *db;
GNUNET_DatastoreValue *value;
struct GNUNET_ClientServerConnection *sock;
GNUNET_HashCode fileId;
- CHK chk;
+ GNUNET_EC_ContentHashKey chk;
GNUNET_CronTime eta;
GNUNET_CronTime start;
GNUNET_CronTime now;
@@ -232,14 +233,15 @@
}
dblock =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE +
- sizeof (DBlock));
+ sizeof (GNUNET_EC_DBlock));
dblock->size =
- htonl (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE + sizeof (DBlock));
- dblock->anonymityLevel = htonl (0);
- dblock->prio = htonl (0);
+ htonl (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE +
+ sizeof (GNUNET_EC_DBlock));
+ dblock->anonymity_level = htonl (0);
+ dblock->priority = htonl (0);
dblock->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
- dblock->expirationTime = GNUNET_htonll (0);
- db = (DBlock *) & dblock[1];
+ dblock->expiration_time = GNUNET_htonll (0);
+ db = (GNUNET_EC_DBlock *) & dblock[1];
db->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
iblocks =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue *) * (treedepth + 1));
@@ -247,14 +249,15 @@
{
iblocks[i] =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + IBLOCK_SIZE +
- sizeof (DBlock));
+ sizeof (GNUNET_EC_DBlock));
iblocks[i]->size =
- htonl (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock));
- iblocks[i]->anonymityLevel = htonl (0);
- iblocks[i]->prio = htonl (0);
+ htonl (sizeof (GNUNET_DatastoreValue) + sizeof (GNUNET_EC_DBlock));
+ iblocks[i]->anonymity_level = htonl (0);
+ iblocks[i]->priority = htonl (0);
iblocks[i]->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
- iblocks[i]->expirationTime = GNUNET_htonll (0);
- ((DBlock *) & iblocks[i][1])->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
+ iblocks[i]->expiration_time = GNUNET_htonll (0);
+ ((GNUNET_EC_DBlock *) & iblocks[i][1])->type =
+ htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
}
pos = 0;
@@ -272,7 +275,8 @@
memset (&db[1], 0, DBLOCK_SIZE);
}
dblock->size =
- htonl (sizeof (GNUNET_DatastoreValue) + size + sizeof (DBlock));
+ htonl (sizeof (GNUNET_DatastoreValue) + size +
+ sizeof (GNUNET_EC_DBlock));
if (size != READ (fd, &db[1], size))
{
GNUNET_GE_LOG_STRERROR_FILE (ectx,
@@ -284,8 +288,10 @@
if (tt != NULL)
if (GNUNET_OK != tt (ttClosure))
goto FAILURE;
- GNUNET_EC_file_block_get_key (db, size + sizeof (DBlock), &chk.key);
- GNUNET_EC_file_block_get_query (db, size + sizeof (DBlock), &chk.query);
+ GNUNET_EC_file_block_get_key (db, size + sizeof (GNUNET_EC_DBlock),
+ &chk.key);
+ GNUNET_EC_file_block_get_query (db, size + sizeof (GNUNET_EC_DBlock),
+ &chk.query);
if (GNUNET_OK != pushBlock (sock, &chk, 0, /* dblocks are on
level 0 */
iblocks))
{
@@ -327,7 +333,7 @@
for (i = 0; i < treedepth; i++)
{
size = ntohl (iblocks[i]->size) - sizeof (GNUNET_DatastoreValue);
- db = (DBlock *) & iblocks[i][1];
+ db = (GNUNET_EC_DBlock *) & iblocks[i][1];
GNUNET_EC_file_block_get_key (db, size, &chk.key);
GNUNET_EC_file_block_get_query (db, size, &chk.query);
if (GNUNET_OK != pushBlock (sock, &chk, i + 1, iblocks))
Modified: GNUnet/src/applications/fs/ecrs/updowntest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/updowntest.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/fs/ecrs/updowntest.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -79,7 +79,7 @@
uri = NULL;
ret = GNUNET_ECRS_file_upload (NULL, cfg, name, GNUNET_YES, /* index */
0, /* anon */
- 0, /* prio */
+ 0, /* priority */
GNUNET_get_time () + 10 *
GNUNET_CRON_MINUTES, /* expire */
NULL, /* progress */
NULL, &testTerminate, NULL, &uri);
Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/upload.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -48,7 +48,7 @@
*/
static int
pushBlock (struct GNUNET_ClientServerConnection *sock,
- const CHK * chk,
+ const GNUNET_EC_ContentHashKey * chk,
unsigned int level,
GNUNET_DatastoreValue ** iblocks,
unsigned int prio, GNUNET_CronTime expirationTime)
@@ -56,15 +56,16 @@
unsigned int size;
unsigned int present;
GNUNET_DatastoreValue *value;
- DBlock *db;
- CHK ichk;
+ GNUNET_EC_DBlock *db;
+ GNUNET_EC_ContentHashKey ichk;
size = ntohl (iblocks[level]->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];
+ GNUNET_GE_ASSERT (NULL, size - sizeof (GNUNET_EC_DBlock) <= IBLOCK_SIZE);
+ present =
+ (size - sizeof (GNUNET_EC_DBlock)) / sizeof (GNUNET_EC_ContentHashKey);
+ db = (GNUNET_EC_DBlock *) & iblocks[level][1];
if (present == CHK_PER_INODE)
{
GNUNET_EC_file_block_get_key (db, size, &ichk.key);
@@ -79,19 +80,19 @@
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- value->prio = htonl (prio);
- value->expirationTime = GNUNET_htonll (expirationTime);
+ value->priority = htonl (prio);
+ value->expiration_time = GNUNET_htonll (expirationTime);
if (GNUNET_OK != GNUNET_FS_insert (sock, value))
{
GNUNET_free (value);
return GNUNET_SYSERR;
}
GNUNET_free (value);
- size = sizeof (DBlock); /* type */
+ size = sizeof (GNUNET_EC_DBlock); /* type */
}
- /* append CHK */
- memcpy (&((char *) db)[size], chk, sizeof (CHK));
- size += sizeof (CHK) + sizeof (GNUNET_DatastoreValue);
+ /* append GNUNET_EC_ContentHashKey */
+ memcpy (&((char *) db)[size], chk, sizeof (GNUNET_EC_ContentHashKey));
+ size += sizeof (GNUNET_EC_ContentHashKey) + sizeof (GNUNET_DatastoreValue);
GNUNET_GE_ASSERT (NULL, size < GNUNET_MAX_BUFFER_SIZE);
iblocks[level]->size = htonl (size);
@@ -131,22 +132,22 @@
unsigned int size;
GNUNET_DatastoreValue **iblocks;
GNUNET_DatastoreValue *dblock;
- DBlock *db;
+ GNUNET_EC_DBlock *db;
GNUNET_DatastoreValue *value;
struct GNUNET_ClientServerConnection *sock;
GNUNET_HashCode fileId;
- CHK mchk;
+ GNUNET_EC_ContentHashKey mchk;
GNUNET_CronTime eta;
GNUNET_CronTime start;
GNUNET_CronTime now;
- FileIdentifier fid;
+ GNUNET_EC_FileIdentifier fid;
#if DEBUG_UPLOAD
GNUNET_EncName enc;
#endif
GNUNET_GE_ASSERT (ectx, cfg != NULL);
start = GNUNET_get_time ();
- memset (&mchk, 0, sizeof (CHK));
+ memset (&mchk, 0, sizeof (GNUNET_EC_ContentHashKey));
if (GNUNET_YES != GNUNET_disk_file_test (ectx, filename))
{
GNUNET_GE_LOG (ectx,
@@ -230,14 +231,15 @@
dblock =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE +
- sizeof (DBlock));
+ sizeof (GNUNET_EC_DBlock));
dblock->size =
- htonl (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE + sizeof (DBlock));
- dblock->anonymityLevel = htonl (anonymityLevel);
- dblock->prio = htonl (priority);
+ htonl (sizeof (GNUNET_DatastoreValue) + DBLOCK_SIZE +
+ sizeof (GNUNET_EC_DBlock));
+ dblock->anonymity_level = htonl (anonymityLevel);
+ dblock->priority = htonl (priority);
dblock->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
- dblock->expirationTime = GNUNET_htonll (expirationTime);
- db = (DBlock *) & dblock[1];
+ dblock->expiration_time = GNUNET_htonll (expirationTime);
+ db = (GNUNET_EC_DBlock *) & dblock[1];
db->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
iblocks =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue *) * (treedepth + 1));
@@ -245,14 +247,15 @@
{
iblocks[i] =
GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + IBLOCK_SIZE +
- sizeof (DBlock));
+ sizeof (GNUNET_EC_DBlock));
iblocks[i]->size =
- htonl (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock));
- iblocks[i]->anonymityLevel = htonl (anonymityLevel);
- iblocks[i]->prio = htonl (priority);
+ htonl (sizeof (GNUNET_DatastoreValue) + sizeof (GNUNET_EC_DBlock));
+ iblocks[i]->anonymity_level = htonl (anonymityLevel);
+ iblocks[i]->priority = htonl (priority);
iblocks[i]->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
- iblocks[i]->expirationTime = GNUNET_htonll (expirationTime);
- ((DBlock *) & iblocks[i][1])->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
+ iblocks[i]->expiration_time = GNUNET_htonll (expirationTime);
+ ((GNUNET_EC_DBlock *) & iblocks[i][1])->type =
+ htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
}
pos = 0;
@@ -271,9 +274,10 @@
}
GNUNET_GE_ASSERT (ectx,
sizeof (GNUNET_DatastoreValue) + size +
- sizeof (DBlock) < GNUNET_MAX_BUFFER_SIZE);
+ sizeof (GNUNET_EC_DBlock) < GNUNET_MAX_BUFFER_SIZE);
dblock->size =
- htonl (sizeof (GNUNET_DatastoreValue) + size + sizeof (DBlock));
+ htonl (sizeof (GNUNET_DatastoreValue) + size +
+ sizeof (GNUNET_EC_DBlock));
if (size != READ (fd, &db[1], size))
{
GNUNET_GE_LOG_STRERROR_FILE (ectx,
@@ -285,8 +289,9 @@
if (tt != NULL)
if (GNUNET_OK != tt (ttClosure))
goto FAILURE;
- GNUNET_EC_file_block_get_key (db, size + sizeof (DBlock), &mchk.key);
- GNUNET_EC_file_block_get_query (db, size + sizeof (DBlock),
+ GNUNET_EC_file_block_get_key (db, size + sizeof (GNUNET_EC_DBlock),
+ &mchk.key);
+ GNUNET_EC_file_block_get_query (db, size + sizeof (GNUNET_EC_DBlock),
&mchk.query);
#if DEBUG_UPLOAD
GNUNET_hash_to_enc (&mchk.query, &enc);
@@ -311,7 +316,7 @@
value = NULL;
if (GNUNET_OK !=
GNUNET_EC_file_block_encode (db,
- size + sizeof (DBlock),
+ size + sizeof (GNUNET_EC_DBlock),
&mchk.query, &value))
{
GNUNET_GE_BREAK (ectx, 0);
@@ -352,7 +357,7 @@
{
size = ntohl (iblocks[i]->size) - sizeof (GNUNET_DatastoreValue);
GNUNET_GE_ASSERT (ectx, size < GNUNET_MAX_BUFFER_SIZE);
- if (size == sizeof (DBlock))
+ if (size == sizeof (GNUNET_EC_DBlock))
{
#if DEBUG_UPLOAD
GNUNET_GE_LOG (ectx,
@@ -361,7 +366,7 @@
#endif
continue;
}
- db = (DBlock *) & iblocks[i][1];
+ db = (GNUNET_EC_DBlock *) & iblocks[i][1];
GNUNET_EC_file_block_get_key (db, size, &mchk.key);
#if DEBUG_UPLOAD
GNUNET_GE_LOG (ectx,
@@ -391,8 +396,8 @@
GNUNET_GE_BREAK (ectx, 0);
goto FAILURE;
}
- value->expirationTime = GNUNET_htonll (expirationTime);
- value->prio = htonl (priority);
+ value->expiration_time = GNUNET_htonll (expirationTime);
+ value->priority = htonl (priority);
if ((doIndex != GNUNET_SYSERR) &&
(GNUNET_SYSERR == GNUNET_FS_insert (sock, value)))
{
@@ -413,9 +418,9 @@
#endif
/* build URI */
fid.file_length = GNUNET_htonll (filesize);
- db = (DBlock *) & iblocks[treedepth][1];
+ db = (GNUNET_EC_DBlock *) & iblocks[treedepth][1];
- fid.chk = *(CHK *) & (db[1]);
+ fid.chk = *(GNUNET_EC_ContentHashKey *) & (db[1]);
*uri = GNUNET_malloc (sizeof (URI));
(*uri)->type = chk;
(*uri)->data.fi = fid;
Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/uri.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -141,7 +141,7 @@
* Generate a file URI.
*/
static char *
-createFileURI (const FileIdentifier * fi)
+createFileURI (const GNUNET_EC_FileIdentifier * fi)
{
char *ret;
GNUNET_EncName keyhash;
@@ -359,7 +359,7 @@
*/
static int
parseFileURI (struct GNUNET_GE_Context *ectx, const char *uri,
- FileIdentifier * fi)
+ GNUNET_EC_FileIdentifier * fi)
{
unsigned int pos;
size_t slen;
@@ -472,7 +472,7 @@
goto ERR;
/* Finally: verify sigs! */
if (GNUNET_OK != GNUNET_RSA_verify (&loc->fi,
- sizeof (FileIdentifier) +
+ sizeof (GNUNET_EC_FileIdentifier) +
sizeof (GNUNET_PeerIdentity) +
sizeof (GNUNET_Int32Time),
&loc->contentSignature, &loc->peer))
@@ -907,7 +907,7 @@
{
case chk:
if (0 == memcmp (&uri1->data.fi,
- &uri2->data.fi, sizeof (FileIdentifier)))
+ &uri2->data.fi, sizeof (GNUNET_EC_FileIdentifier)))
return GNUNET_YES;
return GNUNET_NO;
case sks:
@@ -942,7 +942,7 @@
case loc:
if (memcmp (&uri1->data.loc,
&uri2->data.loc,
- sizeof (FileIdentifier) +
+ sizeof (GNUNET_EC_FileIdentifier) +
sizeof (GNUNET_RSA_PublicKey) +
sizeof (GNUNET_Int32Time) +
sizeof (unsigned short) + sizeof (unsigned short)) != 0)
@@ -991,7 +991,7 @@
*
* @param baseURI content offered by the sender
* @param sender identity of the peer with the content
- * @param expirationTime how long will the content be offered?
+ * @param expiration_time how long will the content be offered?
* @param proto transport protocol to reach the peer
* @param sas sender address size (for HELLO)
* @param address sas bytes of address information
@@ -1017,7 +1017,7 @@
uri->data.loc.peer = *sender;
uri->data.loc.expirationTime = expirationTime;
signer (signer_cls,
- sizeof (FileIdentifier) +
+ sizeof (GNUNET_EC_FileIdentifier) +
sizeof (GNUNET_PeerIdentity) +
sizeof (GNUNET_Int32Time),
&uri->data.loc.fi, &uri->data.loc.contentSignature);
Modified: GNUnet/src/applications/fs/ecrs/uri.h
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs/uri.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -26,6 +26,6 @@
/**
* Generate a file URI.
*/
-char *createFileURI (const FileIdentifier * fi);
+char *createFileURI (const GNUNET_EC_FileIdentifier * fi);
#endif
Modified: GNUnet/src/applications/fs/ecrs_core.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs_core.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -37,14 +37,14 @@
* for the content (verified that it matches
* data)
* @param value the encoded data (set);
- * the anonymityLevel is to be set to 0
+ * the anonymity_level is to be set to 0
* (caller should have checked before calling
* this method).
* @return GNUNET_OK on success, GNUNET_SYSERR if data does not
* match the query
*/
int
-GNUNET_EC_file_block_encode (const DBlock * data,
+GNUNET_EC_file_block_encode (const GNUNET_EC_DBlock * data,
unsigned int len,
const GNUNET_HashCode * query,
GNUNET_DatastoreValue ** value)
@@ -53,27 +53,28 @@
GNUNET_AES_SessionKey skey;
GNUNET_AES_InitializationVector iv; /* initial value */
GNUNET_DatastoreValue *val;
- DBlock *db;
+ GNUNET_EC_DBlock *db;
- GNUNET_GE_ASSERT (NULL, len >= sizeof (DBlock));
+ GNUNET_GE_ASSERT (NULL, len >= sizeof (GNUNET_EC_DBlock));
GNUNET_GE_ASSERT (NULL, (data != NULL) && (query != NULL));
- GNUNET_hash (&data[1], len - sizeof (DBlock), &hc);
+ GNUNET_hash (&data[1], len - sizeof (GNUNET_EC_DBlock), &hc);
GNUNET_hash_to_AES_key (&hc, &skey, &iv);
val = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + len);
val->size = htonl (sizeof (GNUNET_DatastoreValue) + len);
val->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
- val->prio = htonl (0);
- val->anonymityLevel = htonl (0);
- val->expirationTime = GNUNET_htonll (0);
- db = (DBlock *) & val[1];
+ val->priority = htonl (0);
+ val->anonymity_level = htonl (0);
+ val->expiration_time = GNUNET_htonll (0);
+ db = (GNUNET_EC_DBlock *) & val[1];
db->type = htonl (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,
- &db[1]));
- GNUNET_hash (&db[1], len - sizeof (DBlock), &hc);
+ len - sizeof (GNUNET_EC_DBlock) < GNUNET_MAX_BUFFER_SIZE);
+ GNUNET_GE_ASSERT (NULL,
+ len - sizeof (GNUNET_EC_DBlock) ==
+ GNUNET_AES_encrypt (&data[1],
+ len - sizeof (GNUNET_EC_DBlock),
+ &skey, &iv, &db[1]));
+ GNUNET_hash (&db[1], len - sizeof (GNUNET_EC_DBlock), &hc);
if (0 != memcmp (query, &hc, sizeof (GNUNET_HashCode)))
{
GNUNET_free (val);
@@ -89,11 +90,11 @@
* a certain block of data.
*/
void
-GNUNET_EC_file_block_get_key (const DBlock * data, unsigned int len,
+GNUNET_EC_file_block_get_key (const GNUNET_EC_DBlock * data, unsigned int len,
GNUNET_HashCode * key)
{
- GNUNET_GE_ASSERT (NULL, len >= sizeof (DBlock));
- GNUNET_hash (&data[1], len - sizeof (DBlock), key);
+ GNUNET_GE_ASSERT (NULL, len >= sizeof (GNUNET_EC_DBlock));
+ GNUNET_hash (&data[1], len - sizeof (GNUNET_EC_DBlock), key);
}
/**
@@ -103,7 +104,7 @@
* @param db the block in plaintext
*/
void
-GNUNET_EC_file_block_get_query (const DBlock * db, unsigned int len,
+GNUNET_EC_file_block_get_query (const GNUNET_EC_DBlock * db, unsigned int len,
GNUNET_HashCode * query)
{
char *tmp;
@@ -112,9 +113,9 @@
GNUNET_AES_SessionKey skey;
GNUNET_AES_InitializationVector iv;
- GNUNET_GE_ASSERT (NULL, len >= sizeof (DBlock));
+ GNUNET_GE_ASSERT (NULL, len >= sizeof (GNUNET_EC_DBlock));
data = (const char *) &db[1];
- len -= sizeof (DBlock);
+ len -= sizeof (GNUNET_EC_DBlock);
GNUNET_GE_ASSERT (NULL, len < GNUNET_MAX_BUFFER_SIZE);
GNUNET_hash (data, len, &hc);
GNUNET_hash_to_AES_key (&hc, &skey, &iv);
@@ -126,7 +127,8 @@
}
unsigned int
-GNUNET_EC_file_block_get_type (unsigned int size, const DBlock * data)
+GNUNET_EC_file_block_get_type (unsigned int size,
+ const GNUNET_EC_DBlock * data)
{
if (size <= 4)
{
@@ -147,8 +149,8 @@
*/
int
GNUNET_EC_file_block_check_and_get_query (unsigned int size,
- const DBlock * data, int verify,
- GNUNET_HashCode * query)
+ const GNUNET_EC_DBlock * data,
+ int verify, GNUNET_HashCode * query)
{
unsigned int type;
@@ -161,18 +163,18 @@
switch (type)
{
case GNUNET_ECRS_BLOCKTYPE_DATA:
- /* CHK: GNUNET_hash of content == query */
- GNUNET_hash (&data[1], size - sizeof (DBlock), query);
+ /* GNUNET_EC_ContentHashKey: GNUNET_hash of content == query */
+ GNUNET_hash (&data[1], size - sizeof (GNUNET_EC_DBlock), query);
return GNUNET_OK;
case GNUNET_ECRS_BLOCKTYPE_SIGNED:
{
- const SBlock *sb;
- if (size < sizeof (SBlock))
+ const GNUNET_EC_SBlock *sb;
+ if (size < sizeof (GNUNET_EC_SBlock))
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- sb = (const SBlock *) data;
+ sb = (const GNUNET_EC_SBlock *) data;
if ((verify == GNUNET_YES) &&
(GNUNET_OK != GNUNET_RSA_verify (&sb->identifier,
size
@@ -189,16 +191,17 @@
}
case GNUNET_ECRS_BLOCKTYPE_KEYWORD:
{
- const KBlock *kb;
- if (size < sizeof (KBlock))
+ const GNUNET_EC_KBlock *kb;
+ if (size < sizeof (GNUNET_EC_KBlock))
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- kb = (const KBlock *) data;
+ kb = (const GNUNET_EC_KBlock *) data;
if ((verify == GNUNET_YES) &&
((GNUNET_OK != GNUNET_RSA_verify (&kb[1],
- size - sizeof (KBlock),
+ size -
+ sizeof (GNUNET_EC_KBlock),
&kb->signature,
&kb->keyspace))))
{
@@ -210,13 +213,13 @@
}
case GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
{
- const NBlock *nb;
- if (size < sizeof (NBlock))
+ const GNUNET_EC_NBlock *nb;
+ if (size < sizeof (GNUNET_EC_NBlock))
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- nb = (const NBlock *) data;
+ nb = (const GNUNET_EC_NBlock *) data;
if ((verify == GNUNET_YES) &&
(GNUNET_OK != GNUNET_RSA_verify (&nb->identifier,
size
@@ -233,17 +236,17 @@
}
case GNUNET_ECRS_BLOCKTYPE_KEYWORD_FOR_NAMESPACE:
{
- const KNBlock *kb;
- if (size < sizeof (KNBlock))
+ const GNUNET_EC_KNBlock *kb;
+ if (size < sizeof (GNUNET_EC_KNBlock))
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- kb = (const KNBlock *) data;
+ kb = (const GNUNET_EC_KNBlock *) data;
if ((verify == GNUNET_YES) &&
((GNUNET_OK != GNUNET_RSA_verify (&kb->nblock,
size
- - sizeof (KBlock)
+ - sizeof (GNUNET_EC_KBlock)
- sizeof (unsigned int),
&kb->kblock.signature,
&kb->kblock.keyspace))))
@@ -287,7 +290,7 @@
int
GNUNET_EC_is_block_applicable_for_query (unsigned int type,
unsigned int size,
- const DBlock * data,
+ const GNUNET_EC_DBlock * data,
const GNUNET_HashCode * hc,
unsigned int keyCount,
const GNUNET_HashCode * keys)
@@ -312,7 +315,7 @@
case GNUNET_ECRS_BLOCKTYPE_SIGNED:
if (keyCount != 2)
return GNUNET_SYSERR; /* no match */
- GNUNET_hash (&((const SBlock *) data)->subspace,
+ GNUNET_hash (&((const GNUNET_EC_SBlock *) data)->subspace,
sizeof (GNUNET_RSA_PublicKey), &h);
if (0 == memcmp (&keys[1], &h, sizeof (GNUNET_HashCode)))
return GNUNET_OK;
@@ -320,7 +323,7 @@
case GNUNET_ECRS_BLOCKTYPE_NAMESPACE:
if (keyCount != 2)
return GNUNET_SYSERR; /* no match */
- GNUNET_hash (&((const NBlock *) data)->subspace,
+ GNUNET_hash (&((const GNUNET_EC_NBlock *) data)->subspace,
sizeof (GNUNET_RSA_PublicKey), &h);
if (0 != memcmp (&keys[1], &h, sizeof (GNUNET_HashCode)))
return GNUNET_SYSERR;
Modified: GNUnet/src/applications/fs/ecrs_core_test.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core_test.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/ecrs_core_test.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -33,15 +33,15 @@
static int
testEC ()
{
- DBlock *data;
+ GNUNET_EC_DBlock *data;
GNUNET_DatastoreValue *value;
GNUNET_HashCode query;
GNUNET_HashCode key;
unsigned int len;
- len = sizeof (DBlock) + 42;
+ len = sizeof (GNUNET_EC_DBlock) + 42;
data = GNUNET_malloc (len);
- memset (&data[1], rand (), len - sizeof (DBlock));
+ memset (&data[1], rand (), len - sizeof (GNUNET_EC_DBlock));
data->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
CHECK (GNUNET_ECRS_BLOCKTYPE_DATA ==
GNUNET_EC_file_block_get_type (len, data), data);
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/fsui/upload.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -443,7 +443,7 @@
loc = GNUNET_ECRS_location_to_uri (utc->uri,
&hello->publicKey,
ntohl (hello->
- expirationTime),
+ expiration_time),
(GNUNET_ECRS_SignFunction) &
GNUNET_IDENTITY_sign_function,
sock);
Modified: GNUnet/src/applications/fs/gap/anonymity.c
===================================================================
--- GNUnet/src/applications/fs/gap/anonymity.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/anonymity.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -97,7 +97,7 @@
GNUNET_FS_ANONYMITY_init (GNUNET_CoreAPIForPlugins * capi)
{
coreAPI = capi;
- traffic = capi->request_service ("traffic");
+ traffic = capi->service_request ("traffic");
}
void
@@ -105,7 +105,7 @@
{
if (traffic != NULL)
{
- coreAPI->release_service (traffic);
+ coreAPI->service_release (traffic);
traffic = NULL;
}
coreAPI = NULL;
Modified: GNUnet/src/applications/fs/gap/fs.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/fs/gap/fs.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -29,7 +29,7 @@
* TODO:
* - integrate with migration submodule
* - make sure we do an immediate PUSH for DHT stuff
- * given to us with anonymityLevel zero.
+ * given to us with anonymity_level zero.
*/
#include "platform.h"
@@ -119,8 +119,8 @@
GNUNET_EC_file_block_check_and_get_query (ntohs (ri->header.size) -
sizeof
(CS_fs_request_insert_MESSAGE),
- (const DBlock *) &ri[1],
- GNUNET_YES, &query)))
+ (const GNUNET_EC_DBlock *)
+ &ri[1], GNUNET_YES, &query)))
{
GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
@@ -131,25 +131,25 @@
datum->size =
htonl (sizeof (GNUNET_DatastoreValue) + ntohs (req->size) -
sizeof (CS_fs_request_insert_MESSAGE));
- datum->expirationTime = ri->expiration;
- datum->prio = ri->prio;
- datum->anonymityLevel = ri->anonymityLevel;
+ datum->expiration_time = ri->expiration;
+ datum->priority = ri->priority;
+ datum->anonymity_level = ri->anonymity_level;
datum->type =
htonl (GNUNET_EC_file_block_get_type
(ntohs (ri->header.size) - sizeof (CS_fs_request_insert_MESSAGE),
- (const DBlock *) &ri[1]));
+ (const GNUNET_EC_DBlock *) &ri[1]));
#if DEBUG_FS
IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&query, &enc));
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, ntohl (datum->type), ntohl (ri->prio));
+ &enc, ntohl (datum->type), ntohl (ri->priority));
#endif
memcpy (&datum[1],
&ri[1], ntohs (req->size) - sizeof (CS_fs_request_insert_MESSAGE));
ret = datastore->putUpdate (&query, datum);
GNUNET_free (datum);
- return coreAPI->sendValueToClient (sock, ret);
+ return coreAPI->cs_send_value (sock, ret);
}
/**
@@ -179,7 +179,7 @@
fn = GNUNET_malloc (fnLen + 1);
strncpy (fn, (const char *) &ri[1], fnLen + 1);
fn[fnLen] = 0;
- cectx = coreAPI->cs_create_client_log_context (sock);
+ cectx = coreAPI->cs_log_context_create (sock);
ret =
GNUNET_FS_ONDEMAND_index_prepare_with_symlink (cectx, &ri->fileId, fn);
GNUNET_GE_free_context (cectx);
@@ -190,7 +190,7 @@
"Sending confirmation (%s) of index initialization request to
client\n",
ret == GNUNET_OK ? "success" : "failure");
#endif
- return coreAPI->sendValueToClient (sock, ret);
+ return coreAPI->cs_send_value (sock, ret);
}
/**
@@ -215,31 +215,32 @@
GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
- cectx = coreAPI->cs_create_client_log_context (sock);
+ cectx = coreAPI->cs_log_context_create (sock);
ri = (const CS_fs_request_index_MESSAGE *) req;
#if DEBUG_FS
- GNUNET_EC_file_block_get_query ((const DBlock *) &ri[1],
+ GNUNET_EC_file_block_get_query ((const GNUNET_EC_DBlock *) &ri[1],
ntohs (ri->header.size) -
sizeof (CS_fs_request_index_MESSAGE), &hc);
IF_GELOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
GNUNET_hash_to_enc (&hc, &enc));
GNUNET_GE_LOG (ectx, GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"FS received REQUEST INDEX (query: `%s', priority %u)\n",
- &enc, ntohl (ri->prio));
+ &enc, ntohl (ri->priority));
#endif
ret = GNUNET_FS_ONDEMAND_add_indexed_content (cectx,
datastore,
- ntohl (ri->prio),
+ ntohl (ri->priority),
GNUNET_ntohll (ri->
expiration),
GNUNET_ntohll (ri->
fileOffset),
- ntohl (ri->anonymityLevel),
+ ntohl (ri->anonymity_level),
&ri->fileId,
ntohs (ri->header.size) -
sizeof
(CS_fs_request_index_MESSAGE),
- (const DBlock *) &ri[1]);
+ (const GNUNET_EC_DBlock *)
+ &ri[1]);
GNUNET_GE_free_context (cectx);
#if DEBUG_FS
GNUNET_GE_LOG (ectx,
@@ -247,7 +248,7 @@
"Sending confirmation (%s) of index request to client\n",
ret == GNUNET_OK ? "success" : "failure");
#endif
- return coreAPI->sendValueToClient (sock, ret);
+ return coreAPI->cs_send_value (sock, ret);
}
/**
@@ -283,7 +284,7 @@
type =
GNUNET_EC_file_block_get_type (ntohs (rd->header.size) -
sizeof (CS_fs_request_delete_MESSAGE),
- (const DBlock *) &rd[1]);
+ (const GNUNET_EC_DBlock *) &rd[1]);
value->type = htonl (type);
memcpy (&value[1],
&rd[1], ntohs (req->size) - sizeof (CS_fs_request_delete_MESSAGE));
@@ -291,8 +292,8 @@
GNUNET_EC_file_block_check_and_get_query (ntohs (rd->header.size) -
sizeof
(CS_fs_request_delete_MESSAGE),
- (const DBlock *) &rd[1],
- GNUNET_NO, &query))
+ (const GNUNET_EC_DBlock *)
+ &rd[1], GNUNET_NO, &query))
{
GNUNET_free (value);
GNUNET_GE_BREAK (ectx, 0);
@@ -326,7 +327,7 @@
"Sending confirmation (%s) of delete request to client\n",
ret != GNUNET_SYSERR ? "success" : "failure");
#endif
- return coreAPI->sendValueToClient (sock, ret);
+ return coreAPI->cs_send_value (sock, ret);
}
/**
@@ -340,7 +341,7 @@
const CS_fs_request_unindex_MESSAGE *ru;
struct GNUNET_GE_Context *cectx;
- cectx = coreAPI->cs_create_client_log_context (sock);
+ cectx = coreAPI->cs_log_context_create (sock);
if (ntohs (req->size) != sizeof (CS_fs_request_unindex_MESSAGE))
{
GNUNET_GE_BREAK (ectx, 0);
@@ -359,7 +360,7 @@
ntohl (ru->blocksize),
&ru->fileId);
GNUNET_GE_free_context (cectx);
- return coreAPI->sendValueToClient (sock, ret);
+ return coreAPI->cs_send_value (sock, ret);
}
/**
@@ -385,7 +386,7 @@
"FS received REQUEST TESTINDEXED\n");
#endif
ret = GNUNET_FS_ONDEMAND_test_indexed_file (datastore, &ru->fileId);
- return coreAPI->sendValueToClient (sock, ret);
+ return coreAPI->cs_send_value (sock, ret);
}
struct FPPClosure
@@ -417,18 +418,14 @@
cls->have_more = GNUNET_YES;
return GNUNET_SYSERR;
}
- type = ntohl(((const DBlock*) &value[1])->type);
- ret = GNUNET_FS_HELPER_send_to_client(coreAPI,
- key,
- value,
- cls->sock,
- NULL,
- &hc);
+ type = ntohl (((const GNUNET_EC_DBlock *) &value[1])->type);
+ ret = GNUNET_FS_HELPER_send_to_client (coreAPI,
+ key, value, cls->sock, NULL, &hc);
if (ret == GNUNET_NO)
- return GNUNET_NO; /* delete + continue */
+ return GNUNET_NO; /* delete + continue */
cls->processed++;
if (ret != GNUNET_OK)
- cls->have_more = GNUNET_YES; /* switch to async processing */
+ cls->have_more = GNUNET_YES; /* switch to async processing */
if ((type == GNUNET_ECRS_BLOCKTYPE_DATA) || (ret != GNUNET_OK))
return GNUNET_SYSERR; /* unique response or client can take no more
*/
rl = GNUNET_malloc (sizeof (struct ResponseList));
@@ -478,27 +475,27 @@
fpp.seen = NULL;
fpp.have_more = GNUNET_NO;
fpp.processed = 0;
- if (GNUNET_OK ==
- coreAPI->cs_test_send_to_client_now(sock,
- GNUNET_GAP_ESTIMATED_DATA_SIZE,
- GNUNET_NO))
+ if (GNUNET_OK ==
+ coreAPI->cs_send_message_now_test (sock,
+ GNUNET_GAP_ESTIMATED_DATA_SIZE,
+ GNUNET_NO))
{
if (type == GNUNET_ECRS_BLOCKTYPE_DATA)
- {
- if ( ((1 == datastore->get (&rs->query[0],
- type, &fast_path_processor, &fpp)) ||
- (1 == datastore->get (&rs->query[0],
- GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
- &fast_path_processor, &fpp))) &&
- (fpp.have_more == GNUNET_NO) )
- goto CLEANUP;
- }
+ {
+ if (((1 == datastore->get (&rs->query[0],
+ type, &fast_path_processor, &fpp)) ||
+ (1 == datastore->get (&rs->query[0],
+ GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
+ &fast_path_processor, &fpp))) &&
+ (fpp.have_more == GNUNET_NO))
+ goto CLEANUP;
+ }
else
- datastore->get (&rs->query[0], type, &fast_path_processor, &fpp);
- }
+ datastore->get (&rs->query[0], type, &fast_path_processor, &fpp);
+ }
else
fpp.have_more = GNUNET_YES;
- anonymityLevel = ntohl (rs->anonymityLevel);
+ anonymityLevel = ntohl (rs->anonymity_level);
keyCount =
1 + (ntohs (req->size) -
sizeof (CS_fs_request_search_MESSAGE)) / sizeof (GNUNET_HashCode);
@@ -585,7 +582,7 @@
sizeof (P2P_gap_query_MESSAGE) + (query_count -
1) * sizeof (GNUNET_HashCode))
|| (0 ==
- memcmp (&req->returnTo, coreAPI->myIdentity,
+ memcmp (&req->returnTo, coreAPI->my_identity,
sizeof (GNUNET_PeerIdentity))))
{
GNUNET_GE_BREAK_OP (ectx, 0);
@@ -648,7 +645,7 @@
preference = (double) prio;
if (preference < QUERY_BANDWIDTH_VALUE)
preference = QUERY_BANDWIDTH_VALUE;
- coreAPI->preferTrafficFrom (sender, preference);
+ coreAPI->p2p_connection_preference_increase (sender, preference);
GNUNET_FS_GAP_execute_query (sender,
prio,
ntohl (req->priority),
@@ -674,7 +671,7 @@
const GNUNET_MessageHeader * pmsg)
{
const P2P_gap_reply_MESSAGE *msg;
- const DBlock *dblock;
+ const GNUNET_EC_DBlock *dblock;
GNUNET_DatastoreValue *value;
GNUNET_HashCode query;
unsigned short size;
@@ -691,7 +688,7 @@
}
msg = (const P2P_gap_reply_MESSAGE *) pmsg;
data_size = size - sizeof (P2P_gap_reply_MESSAGE);
- dblock = (const DBlock *) &msg[1];
+ dblock = (const GNUNET_EC_DBlock *) &msg[1];
if (GNUNET_OK !=
GNUNET_EC_file_block_check_and_get_query (data_size,
dblock, GNUNET_YES, &query))
@@ -719,9 +716,10 @@
value = GNUNET_malloc (data_size + sizeof (GNUNET_DatastoreValue));
value->size = htonl (data_size + sizeof (GNUNET_DatastoreValue));
value->type = dblock->type;
- value->prio = htonl (prio);
- value->anonymityLevel = htonl (1);
- value->expirationTime = GNUNET_htonll (expiration + GNUNET_get_time ());
+ value->priority = htonl (prio);
+ value->anonymity_level = htonl (1);
+ value->expiration_time =
+ GNUNET_htonll (expiration + GNUNET_get_time ());
memcpy (&value[1], dblock, data_size);
datastore->putUpdate (&query, value);
GNUNET_free (value);
@@ -734,7 +732,7 @@
preference = (double) prio;
if (preference < CONTENT_BANDWIDTH_VALUE)
preference = CONTENT_BANDWIDTH_VALUE;
- coreAPI->preferTrafficFrom (sender, preference);
+ coreAPI->p2p_connection_preference_increase (sender, preference);
}
return GNUNET_OK;
}
@@ -751,13 +749,13 @@
{
ectx = capi->ectx;
coreAPI = capi;
- 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);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_EC_ContentHashKey) == 128);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_EC_DBlock) == 4);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_EC_IBlock) == 132);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_EC_KBlock) == 524);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_EC_SBlock) == 724);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_EC_NBlock) == 716);
+ GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_EC_KNBlock) == 1244);
if ((-1 == GNUNET_GC_get_configuration_value_number (coreAPI->cfg, "LOAD",
"HARDCPULIMIT", 0, 100000, /* 1000 CPUs!? */
0, /* 0 == no
limit */
@@ -768,7 +766,7 @@
= GNUNET_GC_get_configuration_value_yesno (coreAPI->cfg,
"FS",
"ACTIVEMIGRATION", GNUNET_NO);
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_gap_query_received =
@@ -780,22 +778,22 @@
stat_gap_trust_awarded =
stats->create (gettext_noop ("# gap total trust awarded"));
}
- identity = capi->request_service ("identity");
+ identity = capi->service_request ("identity");
if (identity == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
- capi->release_service (stats);
+ capi->service_release (stats);
return GNUNET_SYSERR;
}
- datastore = capi->request_service ("datastore");
+ datastore = capi->service_request ("datastore");
if (datastore == NULL)
{
- capi->release_service (identity);
- capi->release_service (stats);
+ capi->service_release (identity);
+ capi->service_release (stats);
GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
- GNUNET_FS_lock = capi->connection_get_lock (); // GNUNET_mutex_create
(GNUNET_YES);
+ GNUNET_FS_lock = capi->global_lock_get (); // GNUNET_mutex_create
(GNUNET_YES);
GNUNET_FS_ANONYMITY_init (capi);
GNUNET_FS_PLAN_init (capi);
GNUNET_FS_ONDEMAND_init (capi);
@@ -815,43 +813,43 @@
GNUNET_P2P_PROTO_GAP_QUERY, GNUNET_P2P_PROTO_GAP_RESULT);
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerHandler (GNUNET_P2P_PROTO_GAP_QUERY,
- &handle_p2p_query));
+ capi->
+ p2p_ciphertext_handler_register
+ (GNUNET_P2P_PROTO_GAP_QUERY, &handle_p2p_query));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerHandler (GNUNET_P2P_PROTO_GAP_RESULT,
- &handle_p2p_content));
+ capi->
+ p2p_ciphertext_handler_register
+ (GNUNET_P2P_PROTO_GAP_RESULT, &handle_p2p_content));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
capi->
- registerClientHandler (GNUNET_CS_PROTO_GAP_QUERY_START,
- &handle_cs_query_start_request));
+ cs_handler_register (GNUNET_CS_PROTO_GAP_QUERY_START,
+ &handle_cs_query_start_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (GNUNET_CS_PROTO_GAP_INSERT,
- &handle_cs_insert_request));
+ capi->cs_handler_register (GNUNET_CS_PROTO_GAP_INSERT,
+ &handle_cs_insert_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (GNUNET_CS_PROTO_GAP_INDEX,
- &handle_cs_index_request));
+ capi->cs_handler_register (GNUNET_CS_PROTO_GAP_INDEX,
+ &handle_cs_index_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->
- registerClientHandler (GNUNET_CS_PROTO_GAP_INIT_INDEX,
- &handle_cs_init_index_request));
+ capi->cs_handler_register (GNUNET_CS_PROTO_GAP_INIT_INDEX,
+ &handle_cs_init_index_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (GNUNET_CS_PROTO_GAP_DELETE,
- &handle_cs_delete_request));
+ capi->cs_handler_register (GNUNET_CS_PROTO_GAP_DELETE,
+ &handle_cs_delete_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->registerClientHandler (GNUNET_CS_PROTO_GAP_UNINDEX,
- &handle_cs_unindex_request));
+ capi->cs_handler_register (GNUNET_CS_PROTO_GAP_UNINDEX,
+ &handle_cs_unindex_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- capi->
- registerClientHandler (GNUNET_CS_PROTO_GAP_TESTINDEX,
- &handle_cs_test_indexed_request));
+ capi->cs_handler_register (GNUNET_CS_PROTO_GAP_TESTINDEX,
+
&handle_cs_test_indexed_request));
GNUNET_GE_ASSERT (capi->ectx,
0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
@@ -870,49 +868,51 @@
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_GAP_QUERY,
- &handle_p2p_query));
+ coreAPI->
+ p2p_ciphertext_handler_unregister
+ (GNUNET_P2P_PROTO_GAP_QUERY, &handle_p2p_query));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_GAP_RESULT,
- &handle_p2p_content));
+ coreAPI->
+ p2p_ciphertext_handler_unregister
+ (GNUNET_P2P_PROTO_GAP_RESULT, &handle_p2p_content));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
coreAPI->
- unregisterClientHandler (GNUNET_CS_PROTO_GAP_QUERY_START,
- &handle_cs_query_start_request));
+ cs_handler_unregister (GNUNET_CS_PROTO_GAP_QUERY_START,
+ &handle_cs_query_start_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
coreAPI->
- unregisterClientHandler (GNUNET_CS_PROTO_GAP_INSERT,
- &handle_cs_insert_request));
+ cs_handler_unregister (GNUNET_CS_PROTO_GAP_INSERT,
+ &handle_cs_insert_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
coreAPI->
- unregisterClientHandler (GNUNET_CS_PROTO_GAP_INDEX,
- &handle_cs_index_request));
+ cs_handler_unregister (GNUNET_CS_PROTO_GAP_INDEX,
+ &handle_cs_index_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
coreAPI->
- unregisterClientHandler (GNUNET_CS_PROTO_GAP_INIT_INDEX,
- &handle_cs_init_index_request));
+ cs_handler_unregister (GNUNET_CS_PROTO_GAP_INIT_INDEX,
+ &handle_cs_init_index_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
coreAPI->
- unregisterClientHandler (GNUNET_CS_PROTO_GAP_DELETE,
- &handle_cs_delete_request));
+ cs_handler_unregister (GNUNET_CS_PROTO_GAP_DELETE,
+ &handle_cs_delete_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
coreAPI->
- unregisterClientHandler (GNUNET_CS_PROTO_GAP_UNINDEX,
- &handle_cs_unindex_request));
+ cs_handler_unregister (GNUNET_CS_PROTO_GAP_UNINDEX,
+ &handle_cs_unindex_request));
GNUNET_GE_ASSERT (ectx,
GNUNET_SYSERR !=
coreAPI->
- unregisterClientHandler (GNUNET_CS_PROTO_GAP_TESTINDEX,
- &handle_cs_test_indexed_request));
+ cs_handler_unregister (GNUNET_CS_PROTO_GAP_TESTINDEX,
+ &handle_cs_test_indexed_request));
GNUNET_FS_MIGRATION_done ();
GNUNET_FS_GAP_done ();
GNUNET_FS_DHT_done ();
@@ -923,12 +923,12 @@
GNUNET_FS_PT_done ();
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
- coreAPI->release_service (datastore);
+ coreAPI->service_release (datastore);
datastore = NULL;
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
Modified: GNUnet/src/applications/fs/gap/fs_dht.c
===================================================================
--- GNUnet/src/applications/fs/gap/fs_dht.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/fs_dht.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -134,10 +134,10 @@
unsigned int size, const char *value, void *cls)
{
struct ActiveRequestRecords *record = cls;
- const DBlock *dblock;
+ const GNUNET_EC_DBlock *dblock;
GNUNET_HashCode hc;
- dblock = (const DBlock *) value;
+ dblock = (const GNUNET_EC_DBlock *) value;
if ((GNUNET_SYSERR ==
GNUNET_EC_file_block_check_and_get_query (size,
dblock,
@@ -243,9 +243,9 @@
GNUNET_FS_DHT_init (GNUNET_CoreAPIForPlugins * capi)
{
coreAPI = capi;
- dht = capi->request_service ("dht");
- sqstore = capi->request_service ("sqstore");
- stats = capi->request_service ("stats");
+ dht = capi->service_request ("dht");
+ sqstore = capi->service_request ("sqstore");
+ stats = capi->service_request ("stats");
if (stats != NULL)
stat_push_count
= stats->create (gettext_noop ("# blocks pushed into DHT"));
@@ -271,14 +271,14 @@
}
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
if (dht != NULL)
- coreAPI->release_service (dht);
+ coreAPI->service_release (dht);
dht = NULL;
if (sqstore != NULL)
- coreAPI->release_service (sqstore);
+ coreAPI->service_release (sqstore);
sqstore = NULL;
coreAPI = NULL;
return 0;
Modified: GNUnet/src/applications/fs/gap/gap.c
===================================================================
--- GNUnet/src/applications/fs/gap/gap.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/gap.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -106,9 +106,9 @@
if (stats != NULL)
stats->change (stat_gap_content_found_locally, 1);
- coreAPI->p2p_inject_message (NULL,
- (const char *) msg,
- ntohs (msg->size), GNUNET_YES, NULL);
+ coreAPI->loopback_send (NULL,
+ (const char *) msg,
+ ntohs (msg->size), GNUNET_YES, NULL);
GNUNET_free (msg);
}
@@ -178,7 +178,7 @@
if (GNUNET_YES == GNUNET_bloomfilter_test (req->bloomfilter, &mhc))
return want_more; /* not useful */
}
- et = GNUNET_ntohll (value->expirationTime);
+ et = GNUNET_ntohll (value->expiration_time);
now = GNUNET_get_time ();
if (now > et)
et -= now;
@@ -424,7 +424,8 @@
GNUNET_FS_GAP_handle_response (const GNUNET_PeerIdentity * sender,
const GNUNET_HashCode * primary_query,
GNUNET_CronTime expiration,
- unsigned int size, const DBlock * data)
+ unsigned int size,
+ const GNUNET_EC_DBlock * data)
{
GNUNET_HashCode hc;
GNUNET_PeerIdentity target;
@@ -473,10 +474,10 @@
msg->reserved = 0;
msg->expiration = GNUNET_htonll (expiration);
memcpy (&msg[1], data, size);
- coreAPI->unicast (&target,
- &msg->header,
- BASE_REPLY_PRIORITY * (1 + rl->value),
- MAX_GAP_DELAY);
+ coreAPI->ciphertext_send (&target,
+ &msg->header,
+ BASE_REPLY_PRIORITY * (1 + rl->value),
+ MAX_GAP_DELAY);
GNUNET_free (msg);
if (stats != NULL)
{
@@ -635,7 +636,7 @@
unsigned long long ts;
coreAPI = capi;
- datastore = capi->request_service ("datastore");
+ datastore = capi->service_request ("datastore");
random_qsel = GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 0xFFFF);
if (-1 ==
GNUNET_GC_get_configuration_value_number (coreAPI->cfg, "GAP",
@@ -653,13 +654,13 @@
GNUNET_GE_ASSERT (coreAPI->ectx,
GNUNET_SYSERR !=
coreAPI->
- register_notify_peer_disconnect
+ peer_disconnect_notification_register
(&cleanup_on_peer_disconnect, NULL));
GNUNET_cron_add_job (capi->cron,
&have_more_processor,
HAVE_MORE_FREQUENCY, HAVE_MORE_FREQUENCY, NULL);
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_gap_query_dropped =
@@ -702,15 +703,15 @@
GNUNET_GE_ASSERT (coreAPI->ectx,
GNUNET_SYSERR !=
coreAPI->
- unregister_notify_peer_disconnect
+ peer_disconnect_notification_unregister
(&cleanup_on_peer_disconnect, NULL));
- coreAPI->release_service (datastore);
+ coreAPI->service_release (datastore);
datastore = NULL;
GNUNET_cron_stop (cron);
GNUNET_cron_destroy (cron);
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
return 0;
Modified: GNUnet/src/applications/fs/gap/gap.h
===================================================================
--- GNUnet/src/applications/fs/gap/gap.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/gap.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -90,7 +90,8 @@
GNUNET_FS_GAP_handle_response (const GNUNET_PeerIdentity * sender,
const GNUNET_HashCode * primary_query,
GNUNET_CronTime expiration,
- unsigned int size, const DBlock * data);
+ unsigned int size,
+ const GNUNET_EC_DBlock * data);
/**
* Compute the average priority of inbound requests
Modified: GNUnet/src/applications/fs/gap/migration.c
===================================================================
--- GNUnet/src/applications/fs/gap/migration.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/migration.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -294,13 +294,13 @@
return 0;
}
msg = position;
- et = GNUNET_ntohll (value->expirationTime);
+ et = GNUNET_ntohll (value->expiration_time);
if (et > now)
et -= now;
else
et = 0;
et %= MAX_MIGRATION_EXP;
- anonymity = ntohl (value->anonymityLevel);
+ anonymity = ntohl (value->anonymity_level);
ret = 0;
if ((anonymity == 0) ||
(GNUNET_OK == GNUNET_FS_ANONYMITY_check (anonymity,
@@ -357,7 +357,7 @@
void
GNUNET_FS_MIGRATION_inject (const GNUNET_HashCode * key,
unsigned int size,
- const DBlock * value,
+ const GNUNET_EC_DBlock * value,
GNUNET_CronTime expiration,
unsigned int blocked_size,
const PID_INDEX * blocked)
@@ -402,8 +402,8 @@
record->key = *key;
record->value = GNUNET_malloc (size + sizeof (GNUNET_DatastoreValue));
record->value->size = htonl (size + sizeof (GNUNET_DatastoreValue));
- record->value->expirationTime = GNUNET_htonll (expiration);
- record->value->anonymityLevel = 0;
+ record->value->expiration_time = GNUNET_htonll (expiration);
+ record->value->anonymity_level = 0;
record->value->type = value->type;
memcpy (&record->value[1], value, size);
for (i = 0; i < blocked_size; i++)
@@ -424,11 +424,11 @@
coreAPI = capi;
coreAPI->
- connection_register_send_callback
+ send_callback_register
(GNUNET_GAP_ESTIMATED_DATA_SIZE,
GNUNET_FS_GAP_CONTENT_MIGRATION_PRIORITY, &activeMigrationCallback);
- datastore = capi->request_service ("datastore");
- stats = capi->request_service ("stats");
+ datastore = capi->service_request ("datastore");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_migration_count
@@ -457,14 +457,14 @@
struct MigrationRecord *record;
coreAPI->
- connection_unregister_send_callback
+ send_callback_unregister
(GNUNET_GAP_ESTIMATED_DATA_SIZE, &activeMigrationCallback);
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
- coreAPI->release_service (datastore);
+ coreAPI->service_release (datastore);
datastore = NULL;
coreAPI = NULL;
for (i = 0; i < content_size; i++)
Modified: GNUnet/src/applications/fs/gap/migration.h
===================================================================
--- GNUnet/src/applications/fs/gap/migration.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/migration.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -51,7 +51,7 @@
*/
void GNUNET_FS_MIGRATION_inject (const GNUNET_HashCode * key,
unsigned int size,
- const DBlock * value,
+ const GNUNET_EC_DBlock * value,
GNUNET_CronTime expiration,
unsigned int blocked_size,
const PID_INDEX * blocked);
Modified: GNUnet/src/applications/fs/gap/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/gap/ondemand.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/ondemand.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -245,7 +245,7 @@
unsigned int anonymityLevel,
const GNUNET_HashCode * fileId,
unsigned int size,
- const DBlock * content)
+ const GNUNET_EC_DBlock * content)
{
int ret;
OnDemandBlock odb;
@@ -254,7 +254,7 @@
char *fn;
int fd;
- if (size <= sizeof (DBlock))
+ if (size <= sizeof (GNUNET_EC_DBlock))
{
GNUNET_GE_BREAK (coreAPI->ectx, 0);
return GNUNET_SYSERR;
@@ -274,8 +274,8 @@
return GNUNET_SYSERR;
}
LSEEK (fd, fileOffset, SEEK_SET);
- ret = WRITE (fd, &content[1], size - sizeof (DBlock));
- if (ret == size - sizeof (DBlock))
+ ret = WRITE (fd, &content[1], size - sizeof (GNUNET_EC_DBlock));
+ if (ret == size - sizeof (GNUNET_EC_DBlock))
{
ret = GNUNET_OK;
}
@@ -298,12 +298,12 @@
odb.header.size = htonl (sizeof (OnDemandBlock));
odb.header.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
- odb.header.prio = htonl (prio);
- odb.header.anonymityLevel = htonl (anonymityLevel);
- odb.header.expirationTime = GNUNET_htonll (expiration);
+ odb.header.priority = htonl (prio);
+ odb.header.anonymity_level = htonl (anonymityLevel);
+ odb.header.expiration_time = GNUNET_htonll (expiration);
odb.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.fileOffset = GNUNET_htonll (fileOffset);
- odb.blockSize = htonl (size - sizeof (DBlock));
+ odb.blockSize = htonl (size - sizeof (GNUNET_EC_DBlock));
odb.fileId = *fileId;
/* compute the primary key */
GNUNET_EC_file_block_get_query (content, size, &key);
@@ -377,7 +377,7 @@
int fileHandle;
int ret;
const OnDemandBlock *odb;
- DBlock *db;
+ GNUNET_EC_DBlock *db;
struct stat linkStat;
@@ -422,7 +422,7 @@
delete_content_asynchronously (dbv, query);
return GNUNET_SYSERR;
}
- db = GNUNET_malloc (sizeof (DBlock) + ntohl (odb->blockSize));
+ db = GNUNET_malloc (sizeof (GNUNET_EC_DBlock) + ntohl (odb->blockSize));
db->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
iobuf = (char *) &db[1];
blen = READ (fileHandle, iobuf, ntohl (odb->blockSize));
@@ -440,8 +440,8 @@
}
CLOSE (fileHandle);
ret = GNUNET_EC_file_block_encode (db,
- ntohl (odb->blockSize) + sizeof (DBlock),
- query, enc);
+ ntohl (odb->blockSize) +
+ sizeof (GNUNET_EC_DBlock), query, enc);
GNUNET_free (db);
GNUNET_free (fn);
if (ret == GNUNET_SYSERR)
@@ -453,9 +453,9 @@
delete_content_asynchronously (dbv, query);
return GNUNET_SYSERR;
}
- (*enc)->anonymityLevel = dbv->anonymityLevel;
- (*enc)->expirationTime = dbv->expirationTime;
- (*enc)->prio = dbv->prio;
+ (*enc)->anonymity_level = dbv->anonymity_level;
+ (*enc)->expiration_time = dbv->expiration_time;
+ (*enc)->priority = dbv->priority;
return GNUNET_OK;
}
@@ -505,7 +505,7 @@
unsigned long long pos;
unsigned long long size;
unsigned long long delta;
- DBlock *block;
+ GNUNET_EC_DBlock *block;
GNUNET_EncName enc;
fn = get_indexed_filename (fileId);
@@ -521,7 +521,7 @@
GNUNET_free (fn);
return GNUNET_SYSERR;
}
- block = GNUNET_malloc (sizeof (DBlock) + blocksize);
+ block = GNUNET_malloc (sizeof (GNUNET_EC_DBlock) + blocksize);
block->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
while (pos < size)
{
@@ -541,20 +541,21 @@
}
odb.header.size = htonl (sizeof (OnDemandBlock));
odb.header.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
- odb.header.prio = 0;
- odb.header.anonymityLevel = 0;
- odb.header.expirationTime = 0;
+ odb.header.priority = 0;
+ odb.header.anonymity_level = 0;
+ odb.header.expiration_time = 0;
odb.type = htonl (GNUNET_ECRS_BLOCKTYPE_ONDEMAND);
odb.fileOffset = GNUNET_htonll (pos);
odb.blockSize = htonl (delta);
odb.fileId = *fileId;
/* compute the primary key */
- GNUNET_EC_file_block_get_query (block, delta + sizeof (DBlock), &key);
- if ((0 < datastore->get (&key,
- GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
-
&GNUNET_FS_HELPER_complete_value_from_database_callback,
- &odb.header))
- && (odb.header.expirationTime != 0))
+ GNUNET_EC_file_block_get_query (block,
+ delta + sizeof (GNUNET_EC_DBlock),
+ &key);
+ if ((0 <
+ datastore->get (&key, GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
+
&GNUNET_FS_HELPER_complete_value_from_database_callback,
+ &odb.header)) && (odb.header.expiration_time != 0))
ret = datastore->del (&key, &odb.header);
else /* not found */
ret = GNUNET_SYSERR;
@@ -601,18 +602,18 @@
GNUNET_free (tmp);
GNUNET_disk_directory_create (coreAPI->ectx, index_directory); /*
just in case */
- state = capi->request_service ("state");
+ state = capi->service_request ("state");
if (state == NULL)
{
GNUNET_GE_BREAK (coreAPI->ectx, 0);
GNUNET_free (index_directory);
return GNUNET_SYSERR;
}
- datastore = capi->request_service ("datastore");
+ datastore = capi->service_request ("datastore");
if (datastore == NULL)
{
GNUNET_GE_BREAK (coreAPI->ectx, 0);
- coreAPI->release_service (state);
+ coreAPI->service_release (state);
state = NULL;
GNUNET_free (index_directory);
return GNUNET_SYSERR;
@@ -624,9 +625,9 @@
int
GNUNET_FS_ONDEMAND_done ()
{
- coreAPI->release_service (state);
+ coreAPI->service_release (state);
state = NULL;
- coreAPI->release_service (datastore);
+ coreAPI->service_release (datastore);
datastore = NULL;
GNUNET_free (index_directory);
index_directory = NULL;
Modified: GNUnet/src/applications/fs/gap/ondemand.h
===================================================================
--- GNUnet/src/applications/fs/gap/ondemand.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/ondemand.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -75,7 +75,7 @@
unsigned int anonymityLevel,
const GNUNET_HashCode * fileId,
unsigned int size,
- const DBlock * content);
+ const GNUNET_EC_DBlock * content);
/**
* Test if the file with the given ID is
Modified: GNUnet/src/applications/fs/gap/plan.c
===================================================================
--- GNUnet/src/applications/fs/gap/plan.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/plan.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -308,7 +308,7 @@
* @param target what peer to send the request to
* @param request the request to send
* @param ttl time-to-live for the request
- * @param prio priority to use for the request
+ * @param priority priority to use for the request
*/
static void
queue_request (PID_INDEX target,
@@ -406,8 +406,9 @@
rank = GNUNET_malloc (sizeof (struct PeerRankings));
memset (rank, 0, sizeof (struct PeerRankings));
rank->peer = peer;
- rank->reserved_bandwidth = coreAPI->reserve_downstream_bandwidth (identity,
-
GNUNET_GAP_ESTIMATED_DATA_SIZE);
+ rank->reserved_bandwidth =
+ coreAPI->p2p_bandwidth_downstream_reserve (identity,
+ GNUNET_GAP_ESTIMATED_DATA_SIZE);
history = NULL;
if (rpc->info != NULL)
{
@@ -433,8 +434,8 @@
(now - last));
if (history->response_count == 0)
history_score =
- -history->request_count * coreAPI->forAllConnectedNodes (NULL,
- NULL);
+ -history->request_count * coreAPI->p2p_connections_iterate (NULL,
+ NULL);
if (history_score > (1 << 30))
history_score = (1 << 30);
}
@@ -458,7 +459,7 @@
prio = rpc->request->remaining_value;
if (prio > 0)
{
- ttl = (1 << 30); /* bound only by prio */
+ ttl = (1 << 30); /* bound only by priority */
}
else
{
@@ -549,7 +550,7 @@
rpc.info = info;
rpc.request = request;
rpc.rankings = NULL;
- total_peers = coreAPI->forAllConnectedNodes (rank_peers, &rpc);
+ total_peers = coreAPI->p2p_connections_iterate (rank_peers, &rpc);
/* use request type, priority, system load and
entropy of ranking to determine number of peers
to queue */
@@ -630,8 +631,8 @@
rpc.rankings = rank->next;
GNUNET_FS_PT_resolve (rank->peer, &peerId);
if (rank->score != 0)
- coreAPI->reserve_downstream_bandwidth (&peerId,
- -rank->reserved_bandwidth);
+ coreAPI->p2p_bandwidth_downstream_reserve (&peerId,
+ -rank->reserved_bandwidth);
GNUNET_FS_PT_change_rc (rank->peer, -1);
GNUNET_free (rank);
}
@@ -670,7 +671,7 @@
msg->filter_mutator = htonl (req->bloomfilter_mutator);
msg->number_of_queries = htonl (req->key_count);
if (0 != (req->policy & GNUNET_FS_RoutingPolicy_INDIRECT))
- msg->returnTo = *coreAPI->myIdentity;
+ msg->returnTo = *coreAPI->my_identity;
else
GNUNET_FS_PT_resolve (req->response_target, &msg->returnTo);
memcpy (&msg->queries[0],
@@ -948,20 +949,20 @@
coreAPI = capi;
GNUNET_GE_ASSERT (capi->ectx,
GNUNET_SYSERR !=
- capi->cs_exit_handler_register (&handle_client_exit));
+ capi->
+ cs_disconnect_handler_register (&handle_client_exit));
GNUNET_GE_ASSERT (capi->ectx,
GNUNET_SYSERR !=
capi->
- register_notify_peer_disconnect (&peer_disconnect_handler,
- NULL));
+ peer_disconnect_notification_register
+ (&peer_disconnect_handler, NULL));
GNUNET_GE_ASSERT (coreAPI->ectx,
GNUNET_SYSERR !=
coreAPI->
- connection_register_send_callback (sizeof
- (P2P_gap_query_MESSAGE),
-
GNUNET_FS_GAP_QUERY_POLL_PRIORITY,
- &query_fill_callback));
- stats = capi->request_service ("stats");
+ send_callback_register (sizeof (P2P_gap_query_MESSAGE),
+ GNUNET_FS_GAP_QUERY_POLL_PRIORITY,
+ &query_fill_callback));
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_gap_query_sent =
@@ -992,21 +993,21 @@
GNUNET_GE_ASSERT (coreAPI->ectx,
GNUNET_SYSERR !=
coreAPI->
- cs_exit_handler_unregister (&handle_client_exit));
+ cs_disconnect_handler_unregister (&handle_client_exit));
GNUNET_GE_ASSERT (coreAPI->ectx,
GNUNET_SYSERR !=
coreAPI->
- unregister_notify_peer_disconnect
+ peer_disconnect_notification_unregister
(&peer_disconnect_handler, NULL));
GNUNET_GE_ASSERT (coreAPI->ectx,
GNUNET_SYSERR !=
coreAPI->
- connection_unregister_send_callback (sizeof
-
(P2P_gap_query_MESSAGE),
-
&query_fill_callback));
+ send_callback_unregister (sizeof
+ (P2P_gap_query_MESSAGE),
+ &query_fill_callback));
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
return 0;
Modified: GNUnet/src/applications/fs/gap/querymanager.c
===================================================================
--- GNUnet/src/applications/fs/gap/querymanager.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/fs/gap/querymanager.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -34,7 +34,6 @@
#include "fs.h"
#include "fs_dht.h"
#include "gap.h"
-#include "dht.h"
#include "plan.h"
#include "pid_table.h"
#include "shared.h"
@@ -201,7 +200,7 @@
cl->next = clients;
clients = cl;
if (clients_tail == NULL)
- clients_tail = cl;
+ clients_tail = cl;
}
request->next = cl->requests;
cl->requests = request;
@@ -266,7 +265,8 @@
struct RequestList *rl,
const GNUNET_HashCode * primary_key,
GNUNET_CronTime expirationTime,
- unsigned int size, const DBlock * data, unsigned int *value)
+ unsigned int size, const GNUNET_EC_DBlock * data,
+ unsigned int *value)
{
struct IteratorClosure ic;
CS_fs_reply_content_MESSAGE *msg;
@@ -286,16 +286,16 @@
msg = GNUNET_malloc (sizeof (CS_fs_reply_content_MESSAGE) + size);
msg->header.size = htons (sizeof (CS_fs_reply_content_MESSAGE) + size);
msg->header.type = htons (GNUNET_CS_PROTO_GAP_RESULT);
- msg->anonymityLevel = htonl (0); /* unknown */
- msg->expirationTime = GNUNET_htonll (expirationTime);
+ msg->anonymity_level = htonl (0); /* unknown */
+ msg->expiration_time = GNUNET_htonll (expirationTime);
memcpy (&msg[1], data, size);
- ret = coreAPI->cs_send_to_client (client,
- &msg->header,
- (rl->type != GNUNET_ECRS_BLOCKTYPE_DATA)
- ? GNUNET_NO : GNUNET_YES);
+ ret = coreAPI->cs_send_message (client,
+ &msg->header,
+ (rl->type != GNUNET_ECRS_BLOCKTYPE_DATA)
+ ? GNUNET_NO : GNUNET_YES);
GNUNET_free (msg);
if (ret != GNUNET_OK)
- return GNUNET_NO;
+ return GNUNET_NO;
if (stats != NULL)
stats->change (stat_gap_client_response_sent, 1);
@@ -351,7 +351,7 @@
* not yet been performed; checking the
* signature has already been done)
* @param size size of the data
- * @param data the data itself (a DBlock)
+ * @param data the data itself (a GNUNET_EC_DBlock)
* @return how much was this content worth to us?
*/
unsigned int
@@ -359,7 +359,7 @@
const GNUNET_HashCode * primary_query,
GNUNET_CronTime expirationTime,
unsigned int size,
- const DBlock * data)
+ const GNUNET_EC_DBlock * data)
{
struct ClientDataList *cl;
struct RequestList *rl;
@@ -388,8 +388,8 @@
prev->next = rl->next;
else
cl->requests = rl->next;
- if (rl == cl->request_tail)
- cl->request_tail = prev;
+ if (rl == cl->request_tail)
+ cl->request_tail = prev;
GNUNET_FS_SHARED_free_request_list (rl);
if (stats != NULL)
stats->change (stat_gap_client_query_tracked, -1);
@@ -474,16 +474,15 @@
GNUNET_HashCode hc;
int ret;
- ret = GNUNET_FS_HELPER_send_to_client(coreAPI,
- key, value,
- cls->request->response_client,
- cls->request,
- &hc);
+ ret = GNUNET_FS_HELPER_send_to_client (coreAPI,
+ key, value,
+ cls->request->response_client,
+ cls->request, &hc);
if (ret != GNUNET_OK)
{
/* client can take no more right now */
- cls->have_more = GNUNET_YES;
- return ret; /* NO: delete, SYSERR: abort */
+ cls->have_more = GNUNET_YES;
+ return ret; /* NO: delete, SYSERR: abort */
}
GNUNET_FS_SHARED_mark_response_seen (cls->request, &hc);
cls->processed++;
@@ -510,17 +509,17 @@
GNUNET_CronTime now;
GNUNET_mutex_lock (GNUNET_FS_lock);
- if (clients == NULL)
- {
+ if (clients == NULL)
+ {
GNUNET_mutex_unlock (GNUNET_FS_lock);
return;
}
now = GNUNET_get_time ();
- client = clients;
+ client = clients;
if (clients_tail != client)
{
/* move client to tail of list */
- GNUNET_GE_ASSERT(NULL, clients_tail->next == NULL);
+ GNUNET_GE_ASSERT (NULL, clients_tail->next == NULL);
clients = clients->next;
clients_tail->next = client;
clients_tail = client;
@@ -535,7 +534,7 @@
if (client->request_tail != request)
{
/* move request to tail of list */
- GNUNET_GE_ASSERT(NULL, client->request_tail->next == NULL);
+ GNUNET_GE_ASSERT (NULL, client->request_tail->next == NULL);
client->requests = request->next;
client->request_tail->next = request;
prev = client->request_tail;
@@ -546,13 +545,13 @@
{
prev = NULL;
}
- GNUNET_GE_ASSERT(NULL, request->next == NULL);
- GNUNET_GE_ASSERT(NULL, client->request_tail->next == NULL);
- if ( (client->client != NULL) &&
- (GNUNET_OK !=
- coreAPI->cs_test_send_to_client_now(client->client,
- GNUNET_GAP_ESTIMATED_DATA_SIZE,
- GNUNET_NO)))
+ GNUNET_GE_ASSERT (NULL, request->next == NULL);
+ GNUNET_GE_ASSERT (NULL, client->request_tail->next == NULL);
+ if ((client->client != NULL) &&
+ (GNUNET_OK !=
+ coreAPI->cs_send_message_now_test (client->client,
+ GNUNET_GAP_ESTIMATED_DATA_SIZE,
+ GNUNET_NO)))
{
GNUNET_mutex_unlock (GNUNET_FS_lock);
return;
@@ -563,63 +562,62 @@
hmc.request = request;
hmc.processed = 0;
hmc.have_more = GNUNET_NO;
-
+
if (request->type == GNUNET_ECRS_BLOCKTYPE_DATA)
- {
- if ( ((1 == datastore->get (&request->queries[0], request->type,
- &have_more_processor, &hmc)) ||
- (1 == datastore->get (&request->queries[0],
- GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
- &have_more_processor, &hmc))) &&
- (hmc.have_more == GNUNET_NO) )
- {
- if (prev == NULL)
- {
- client->request_tail = NULL;
- client->requests = NULL;
- }
- else
- {
- prev->next = NULL;
- if (client->request_tail == request)
- client->request_tail = prev;
- }
- GNUNET_FS_SHARED_free_request_list(request);
- if (stats != NULL)
+ {
+ if (((1 == datastore->get (&request->queries[0], request->type,
+ &have_more_processor, &hmc)) ||
+ (1 == datastore->get (&request->queries[0],
+ GNUNET_ECRS_BLOCKTYPE_ONDEMAND,
+ &have_more_processor, &hmc))) &&
+ (hmc.have_more == GNUNET_NO))
+ {
+ if (prev == NULL)
+ {
+ client->request_tail = NULL;
+ client->requests = NULL;
+ }
+ else
+ {
+ prev->next = NULL;
+ if (client->request_tail == request)
+ client->request_tail = prev;
+ }
+ GNUNET_FS_SHARED_free_request_list (request);
+ if (stats != NULL)
stats->change (stat_gap_client_query_tracked, -1);
- }
- }
+ }
+ }
else
- {
- datastore->get (&request->queries[0], request->type,
- &have_more_processor, &hmc);
- }
+ {
+ datastore->get (&request->queries[0], request->type,
+ &have_more_processor, &hmc);
+ }
if (hmc.have_more)
- request->have_more += HAVE_MORE_INCREMENT;
+ request->have_more += HAVE_MORE_INCREMENT;
}
else
{
if ((NULL == request->plan_entries) &&
- ((client->client != NULL) ||
- (request->expiration > now)) &&
- (request->last_ttl_used * GNUNET_CRON_SECONDS +
- request->last_request_time < now))
- {
- if ((GNUNET_OK ==
- GNUNET_FS_PLAN_request (client->client, 0, request))
- && (stats != NULL))
- stats->change (stat_gap_client_query_injected, 1);
- }
-
+ ((client->client != NULL) ||
+ (request->expiration > now)) &&
+ (request->last_ttl_used * GNUNET_CRON_SECONDS +
+ request->last_request_time < now))
+ {
+ if ((GNUNET_OK ==
+ GNUNET_FS_PLAN_request (client->client, 0, request))
+ && (stats != NULL))
+ stats->change (stat_gap_client_query_injected, 1);
+ }
+
if ((request->anonymityLevel == 0) &&
- (request->last_dht_get + request->dht_back_off < now))
- {
- if (request->dht_back_off * 2 > request->dht_back_off)
- request->dht_back_off *= 2;
- request->last_dht_get = now;
- GNUNET_FS_DHT_execute_query (request->type,
- &request->queries[0]);
- }
+ (request->last_dht_get + request->dht_back_off < now))
+ {
+ if (request->dht_back_off * 2 > request->dht_back_off)
+ request->dht_back_off *= 2;
+ request->last_dht_get = now;
+ GNUNET_FS_DHT_execute_query (request->type, &request->queries[0]);
+ }
}
GNUNET_mutex_unlock (GNUNET_FS_lock);
}
@@ -630,9 +628,10 @@
coreAPI = capi;
GNUNET_GE_ASSERT (capi->ectx,
GNUNET_SYSERR !=
- capi->cs_exit_handler_register (&handle_client_exit));
- datastore = capi->request_service ("datastore");
- stats = capi->request_service ("stats");
+ capi->
+ cs_disconnect_handler_register (&handle_client_exit));
+ datastore = capi->service_request ("datastore");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_gap_client_query_received =
@@ -661,14 +660,14 @@
GNUNET_GE_ASSERT (coreAPI->ectx,
GNUNET_SYSERR !=
coreAPI->
- cs_exit_handler_unregister (&handle_client_exit));
+ cs_disconnect_handler_unregister (&handle_client_exit));
while (clients != NULL)
handle_client_exit (clients->client);
- coreAPI->release_service (datastore);
+ coreAPI->service_release (datastore);
datastore = NULL;
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
return 0;
Modified: GNUnet/src/applications/fs/gap/querymanager.h
===================================================================
--- GNUnet/src/applications/fs/gap/querymanager.h 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/fs/gap/querymanager.h 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -66,7 +66,7 @@
* not yet been performed; checking the
* signature has already been done)
* @param size size of the data
- * @param data the data itself (a DBlock)
+ * @param data the data itself (a GNUNET_EC_DBlock)
* @return how much was this content worth to us?
*/
unsigned int
@@ -74,7 +74,7 @@
const GNUNET_HashCode * primary_query,
GNUNET_CronTime expirationTime,
unsigned int size,
- const DBlock * data);
+ const GNUNET_EC_DBlock * data);
#endif
Modified: GNUnet/src/applications/fs/gap/shared.c
===================================================================
--- GNUnet/src/applications/fs/gap/shared.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/shared.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -84,7 +84,7 @@
GNUNET_FS_SHARED_test_valid_new_response (struct RequestList *rl,
const GNUNET_HashCode * primary_key,
unsigned int size,
- const DBlock * data,
+ const GNUNET_EC_DBlock * data,
GNUNET_HashCode * hc)
{
struct ResponseList *seen;
@@ -152,7 +152,7 @@
/**
* If the data portion and type of the value match our value in the
- * closure, copy the header (prio, anonymityLevel, expirationTime) and
+ * closure, copy the header (priority, anonymity_level, expiration_time) and
* abort the iteration: we found what we're looing for. Otherwise
* continue.
*/
@@ -198,7 +198,7 @@
* value for the ttl that can be requested.
*
* @param ttl_in requested ttl
- * @param prio given priority
+ * @param priority given priority
* @return ttl_in if ttl_in is below the limit,
* otherwise the ttl-limit for the given priority
*/
@@ -225,20 +225,20 @@
* @param request used to check if the response is new and
* unique, maybe NULL (skip test in that case)
* @param hc set to hash of the message by this function
- *
+ *
* @return GNUNET_OK on success,
* GNUNET_NO if the block should be deleted
* GNUNET_SYSERR to retry later
*/
-int
-GNUNET_FS_HELPER_send_to_client(GNUNET_CoreAPIForPlugins * coreAPI,
- const GNUNET_HashCode * key,
- const GNUNET_DatastoreValue * value,
- struct GNUNET_ClientHandle * client,
- struct RequestList * request,
- GNUNET_HashCode * hc)
+int
+GNUNET_FS_HELPER_send_to_client (GNUNET_CoreAPIForPlugins * coreAPI,
+ const GNUNET_HashCode * key,
+ const GNUNET_DatastoreValue * value,
+ struct GNUNET_ClientHandle *client,
+ struct RequestList *request,
+ GNUNET_HashCode * hc)
{
- const DBlock *dblock;
+ const GNUNET_EC_DBlock *dblock;
CS_fs_reply_content_MESSAGE *msg;
unsigned int size;
GNUNET_DatastoreValue *enc;
@@ -246,44 +246,43 @@
int ret;
size = ntohl (value->size) - sizeof (GNUNET_DatastoreValue);
- dblock = (const DBlock *) &value[1];
+ dblock = (const GNUNET_EC_DBlock *) &value[1];
enc = NULL;
if ((ntohl (dblock->type) == GNUNET_ECRS_BLOCKTYPE_ONDEMAND) &&
(GNUNET_OK != GNUNET_FS_ONDEMAND_get_indexed_content (value,
key, &enc)))
{
- return GNUNET_NO; /* data corrupt: delete block! */
+ return GNUNET_NO; /* data corrupt: delete block! */
}
if (enc == NULL)
use = value;
else
use = enc;
size = ntohl (use->size) - sizeof (GNUNET_DatastoreValue);
- dblock = (const DBlock *) &use[1];
- if (request != NULL)
+ dblock = (const GNUNET_EC_DBlock *) &use[1];
+ if (request != NULL)
{
if (GNUNET_OK != GNUNET_FS_SHARED_test_valid_new_response (request,
- key,
- size,
- dblock, hc))
- {
- GNUNET_free_non_null (enc);
- return GNUNET_SYSERR; /* duplicate or invalid */
- }
- }
+ key,
+ size,
+ dblock, hc))
+ {
+ GNUNET_free_non_null (enc);
+ return GNUNET_SYSERR; /* duplicate or invalid */
+ }
+ }
else
{
GNUNET_hash (dblock, size, hc);
- }
+ }
msg = GNUNET_malloc (sizeof (CS_fs_reply_content_MESSAGE) + size);
msg->header.type = htons (GNUNET_CS_PROTO_GAP_RESULT);
msg->header.size = htons (sizeof (CS_fs_reply_content_MESSAGE) + size);
- msg->anonymityLevel = use->anonymityLevel;
- msg->expirationTime = use->expirationTime;
+ msg->anonymity_level = use->anonymity_level;
+ msg->expiration_time = use->expiration_time;
memcpy (&msg[1], dblock, size);
GNUNET_free_non_null (enc);
- ret = coreAPI->cs_send_to_client (client, &msg->header,
- GNUNET_NO);
+ ret = coreAPI->cs_send_message (client, &msg->header, GNUNET_NO);
GNUNET_free (msg);
if (ret == GNUNET_OK)
return GNUNET_OK;
Modified: GNUnet/src/applications/fs/gap/shared.h
===================================================================
--- GNUnet/src/applications/fs/gap/shared.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/gap/shared.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -314,7 +314,7 @@
GNUNET_FS_SHARED_test_valid_new_response (struct RequestList *rl,
const GNUNET_HashCode * primary_key,
unsigned int size,
- const DBlock * data,
+ const GNUNET_EC_DBlock * data,
GNUNET_HashCode * hc);
/**
@@ -327,7 +327,7 @@
/**
* If the data portion and type of the value match our value in the
- * closure, copy the header (prio, anonymityLevel, expirationTime) and
+ * closure, copy the header (priority, anonymity_level, expiration_time) and
* abort the iteration: we found what we're looing for. Otherwise
* continue.
*/
@@ -357,7 +357,7 @@
* value for the ttl that can be requested.
*
* @param ttl_in requested ttl
- * @param prio given priority
+ * @param priority given priority
* @return ttl_in if ttl_in is below the limit,
* otherwise the ttl-limit for the given priority
*/
@@ -370,18 +370,18 @@
* @param request used to check if the response is new and
* unique, maybe NULL (skip test in that case)
* @param hc set to hash of the message by this function
- *
+ *
* @return GNUNET_OK on success,
* GNUNET_NO on temporary failure,
* GNUNET_SYSERR on serious error
*/
-int
-GNUNET_FS_HELPER_send_to_client(GNUNET_CoreAPIForPlugins * coreAPI,
- const GNUNET_HashCode * key,
- const GNUNET_DatastoreValue * value,
- struct GNUNET_ClientHandle * client,
- struct RequestList * request,
- GNUNET_HashCode * hc);
+int
+GNUNET_FS_HELPER_send_to_client (GNUNET_CoreAPIForPlugins * coreAPI,
+ const GNUNET_HashCode * key,
+ const GNUNET_DatastoreValue * value,
+ struct GNUNET_ClientHandle *client,
+ struct RequestList *request,
+ GNUNET_HashCode * hc);
#endif
Modified: GNUnet/src/applications/fs/gap/test_linear_topology.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_linear_topology.c 2008-03-25
03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/fs/gap/test_linear_topology.c 2008-03-25
06:23:12 UTC (rev 6615)
@@ -104,7 +104,7 @@
GNUNET_disk_file_close (ectx, name, fd);
ret = GNUNET_ECRS_file_upload (ectx, cfg, name, GNUNET_YES, /* index */
1, /* anon */
- 0, /* prio */
+ 0, /* priority */
GNUNET_get_time () + 100 *
GNUNET_CRON_MINUTES, /* expire */
&uprogress, /* progress */
NULL, &testTerminate, NULL, &uri);
Modified: GNUnet/src/applications/fs/gap/test_loopback.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_loopback.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/fs/gap/test_loopback.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -99,7 +99,7 @@
GNUNET_disk_file_close (ectx, name, fd);
ret = GNUNET_ECRS_file_upload (ectx, cfg, name, GNUNET_YES, /* index */
0, /* anon */
- 0, /* prio */
+ 0, /* priority */
GNUNET_get_time () + 10 *
GNUNET_CRON_MINUTES, /* expire */
&uprogress, NULL, &testTerminate, NULL,
&uri);
Modified: GNUnet/src/applications/fs/gap/test_multi_results.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_multi_results.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/fs/gap/test_multi_results.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -90,7 +90,7 @@
GNUNET_disk_file_close (ectx, name, fd);
ret = GNUNET_ECRS_file_upload (ectx, cfg, name, GNUNET_YES, /* index */
1, /* anon */
- 0, /* prio */
+ 0, /* priority */
GNUNET_get_time () + 100 *
GNUNET_CRON_MINUTES, /* expire */
NULL, NULL, &testTerminate, NULL, &uri);
if (ret != GNUNET_SYSERR)
Modified: GNUnet/src/applications/fs/gap/test_star_topology.c
===================================================================
--- GNUnet/src/applications/fs/gap/test_star_topology.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/fs/gap/test_star_topology.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -104,7 +104,7 @@
GNUNET_disk_file_close (ectx, name, fd);
ret = GNUNET_ECRS_file_upload (ectx, cfg, name, GNUNET_YES, /* index */
1, /* anon */
- 0, /* prio */
+ 0, /* priority */
GNUNET_get_time () + 100 *
GNUNET_CRON_MINUTES, /* expire */
&uprogress, NULL, &testTerminate, NULL,
&uri);
Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/lib/fslib.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -175,7 +175,7 @@
}
rep = (const CS_fs_reply_content_MESSAGE *) hdr;
size = ntohs (hdr->size) - sizeof (CS_fs_reply_content_MESSAGE);
- if (GNUNET_OK != GNUNET_EC_file_block_check_and_get_query (size,
(DBlock *) & rep[1], GNUNET_NO, /* gnunetd will have checked already */
+ if (GNUNET_OK != GNUNET_EC_file_block_check_and_get_query (size,
(GNUNET_EC_DBlock *) & rep[1], GNUNET_NO, /* gnunetd will have checked
already */
&query))
{
GNUNET_GE_BREAK (ctx->ectx, 0);
@@ -184,15 +184,16 @@
}
unique =
GNUNET_EC_file_block_get_type (size,
- (DBlock *) & rep[1]) ==
+ (GNUNET_EC_DBlock *) & rep[1]) ==
GNUNET_ECRS_BLOCKTYPE_DATA;
value = GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + size);
value->size = htonl (size + sizeof (GNUNET_DatastoreValue));
value->type =
- htonl (GNUNET_EC_file_block_get_type (size, (DBlock *) & rep[1]));
- value->prio = htonl (0);
- value->anonymityLevel = rep->anonymityLevel;
- value->expirationTime = rep->expirationTime;
+ htonl (GNUNET_EC_file_block_get_type
+ (size, (GNUNET_EC_DBlock *) & rep[1]));
+ value->priority = htonl (0);
+ value->anonymity_level = rep->anonymity_level;
+ value->expiration_time = rep->expiration_time;
memcpy (&value[1], &rep[1], size);
matched = 0;
GNUNET_mutex_lock (ctx->lock);
@@ -324,11 +325,11 @@
* Search for blocks matching the given key and type.
*
* @param timeout how long to search
- * @param anonymityLevel what are the anonymity
+ * @param anonymity_level what are the anonymity
* requirements for this request? 0 for no
* anonymity (DHT/direct transfer ok)
* @param callback method to call for each result
- * @param prio priority to use for the search
+ * @param priority priority to use for the search
*/
int
GNUNET_FS_start_search (struct GNUNET_FS_SearchContext *ctx,
@@ -358,7 +359,7 @@
htons (sizeof (CS_fs_request_search_MESSAGE) +
(keyCount - 1) * sizeof (GNUNET_HashCode));
req->header.type = htons (GNUNET_CS_PROTO_GAP_QUERY_START);
- req->anonymityLevel = htonl (anonymityLevel);
+ req->anonymity_level = htonl (anonymityLevel);
req->type = htonl (type);
if (target != NULL)
req->target = *target;
@@ -404,9 +405,9 @@
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 (GNUNET_CS_PROTO_GAP_INSERT);
- ri->prio = block->prio;
- ri->expiration = block->expirationTime;
- ri->anonymityLevel = block->anonymityLevel;
+ ri->priority = block->priority;
+ ri->expiration = block->expiration_time;
+ ri->anonymity_level = block->anonymity_level;
memcpy (&ri[1], &block[1], size);
retry = AUTO_RETRY;
do
@@ -497,14 +498,15 @@
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 (GNUNET_CS_PROTO_GAP_INDEX);
- ri->prio = block->prio;
- ri->expiration = block->expirationTime;
- ri->anonymityLevel = block->anonymityLevel;
+ ri->priority = block->priority;
+ ri->expiration = block->expiration_time;
+ ri->anonymity_level = block->anonymity_level;
ri->fileId = *fileHc;
ri->fileOffset = GNUNET_htonll (offset);
memcpy (&ri[1], &block[1], size);
#if DEBUG_FSLIB
- GNUNET_EC_file_block_get_query ((const DBlock *) &block[1], size, &hc);
+ GNUNET_EC_file_block_get_query ((const GNUNET_EC_DBlock *) &block[1], size,
+ &hc);
GNUNET_hash_to_enc (&hc, &enc);
fprintf (stderr,
"Sending index request for `%s' to gnunetd)\n",
Modified: GNUnet/src/applications/fs/lib/fslibtest.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslibtest.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/fs/lib/fslibtest.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -47,16 +47,18 @@
makeBlock (int i)
{
GNUNET_DatastoreValue *block;
- DBlock *db;
+ GNUNET_EC_DBlock *db;
block =
- GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock) + i);
- block->size = htonl (sizeof (GNUNET_DatastoreValue) + sizeof (DBlock) + i);
+ GNUNET_malloc (sizeof (GNUNET_DatastoreValue) +
+ sizeof (GNUNET_EC_DBlock) + i);
+ block->size =
+ htonl (sizeof (GNUNET_DatastoreValue) + sizeof (GNUNET_EC_DBlock) + i);
block->type = htonl (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];
+ block->priority = htonl (0);
+ block->anonymity_level = htonl (0);
+ block->expiration_time = GNUNET_htonll (now + 1 * GNUNET_CRON_HOURS);
+ db = (GNUNET_EC_DBlock *) & block[1];
db->type = htonl (GNUNET_ECRS_BLOCKTYPE_DATA);
memset (&db[1], i + (i / 253), i);
return block;
@@ -67,17 +69,19 @@
GNUNET_HashCode * query)
{
GNUNET_DatastoreValue *block;
- KBlock *db;
+ GNUNET_EC_KBlock *db;
struct GNUNET_RSA_PrivateKey *kkey;
block =
- GNUNET_malloc (sizeof (GNUNET_DatastoreValue) + sizeof (KBlock) + i);
- block->size = htonl (sizeof (GNUNET_DatastoreValue) + sizeof (KBlock) + i);
+ GNUNET_malloc (sizeof (GNUNET_DatastoreValue) +
+ sizeof (GNUNET_EC_KBlock) + i);
+ block->size =
+ htonl (sizeof (GNUNET_DatastoreValue) + sizeof (GNUNET_EC_KBlock) + i);
block->type = htonl (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];
+ block->priority = htonl (0);
+ block->anonymity_level = htonl (0);
+ block->expiration_time = GNUNET_htonll (now + 1 * GNUNET_CRON_HOURS);
+ db = (GNUNET_EC_KBlock *) & block[1];
db->type = htonl (GNUNET_ECRS_BLOCKTYPE_KEYWORD);
memset (&db[1], i + (i / 253), i);
kkey = GNUNET_RSA_create_key_from_hash (key);
@@ -133,12 +137,13 @@
int ret;
blk = makeBlock (cls->i);
- GNUNET_EC_file_block_get_query ((DBlock *) & blk[1],
+ GNUNET_EC_file_block_get_query ((GNUNET_EC_DBlock *) & blk[1],
ntohl (blk->size) -
sizeof (GNUNET_DatastoreValue), &ekey);
GNUNET_GE_ASSERT (NULL,
GNUNET_OK ==
- GNUNET_EC_file_block_encode ((DBlock *) & blk[1],
+ GNUNET_EC_file_block_encode ((GNUNET_EC_DBlock *) &
+ blk[1],
ntohl (blk->size) -
sizeof
(GNUNET_DatastoreValue),
@@ -171,12 +176,12 @@
GNUNET_HashCode query;
TSC closure;
GNUNET_DatastoreValue *dv;
- DBlock *db;
+ GNUNET_EC_DBlock *db;
struct GNUNET_FS_SearchContext *ctx;
ctx = GNUNET_FS_create_search_context (NULL, cfg, lock);
dv = makeBlock (i);
- db = (DBlock *) & dv[1];
+ db = (GNUNET_EC_DBlock *) & dv[1];
GNUNET_EC_file_block_get_query (db,
ntohl (dv->size) -
sizeof (GNUNET_DatastoreValue), &query);
@@ -249,23 +254,23 @@
{
fprintf (stderr, ".");
block = makeBlock (i);
- GNUNET_EC_file_block_get_query ((DBlock *) & block[1],
+ GNUNET_EC_file_block_get_query ((GNUNET_EC_DBlock *) & block[1],
ntohl (block->size) -
sizeof (GNUNET_DatastoreValue), &query);
CHECK (GNUNET_OK ==
- GNUNET_EC_file_block_encode ((DBlock *) & block[1],
+ GNUNET_EC_file_block_encode ((GNUNET_EC_DBlock *) & block[1],
ntohl (block->size) -
sizeof (GNUNET_DatastoreValue),
&query, &eblock));
- eblock->expirationTime = block->expirationTime;
- eblock->prio = block->prio;
+ eblock->expiration_time = block->expiration_time;
+ eblock->priority = block->priority;
CHECK (GNUNET_OK == GNUNET_FS_insert (sock, eblock));
CHECK (GNUNET_OK == trySearch (i));
CHECK (GNUNET_SYSERR != GNUNET_FS_delete (sock, eblock));
GNUNET_free (eblock);
- GNUNET_hash (&((DBlock *) & block[1])[1],
+ GNUNET_hash (&((GNUNET_EC_DBlock *) & block[1])[1],
ntohl (block->size) - sizeof (GNUNET_DatastoreValue) -
- sizeof (DBlock), &hc);
+ sizeof (GNUNET_EC_DBlock), &hc);
/* indexing without symlink */
CHECK (GNUNET_OK == GNUNET_FS_index (sock, &hc, block, 0));
CHECK (GNUNET_OK == trySearch (i));
@@ -275,9 +280,10 @@
tmpName = GNUNET_strdup ("/tmp/symlinkTestXXXXXX");
CHECK (-1 != (fd = mkstemp (tmpName)));
CHECK (-1 != WRITE (fd,
- &((DBlock *) & block[1])[1],
+ &((GNUNET_EC_DBlock *) & block[1])[1],
ntohl (block->size) -
- sizeof (GNUNET_DatastoreValue) - sizeof (DBlock)));
+ sizeof (GNUNET_DatastoreValue) -
+ sizeof (GNUNET_EC_DBlock)));
CLOSE (fd);
CHECK (GNUNET_FS_prepare_to_index (sock, &hc, tmpName) == GNUNET_YES);
CHECK (GNUNET_OK == GNUNET_FS_index (sock, &hc, block, 0));
@@ -294,23 +300,23 @@
{
fprintf (stderr, ".");
block = makeBlock (i);
- GNUNET_EC_file_block_get_query ((DBlock *) & block[1],
+ GNUNET_EC_file_block_get_query ((GNUNET_EC_DBlock *) & block[1],
ntohl (block->size) -
sizeof (GNUNET_DatastoreValue), &query);
CHECK (GNUNET_OK ==
- GNUNET_EC_file_block_encode ((DBlock *) & block[1],
+ GNUNET_EC_file_block_encode ((GNUNET_EC_DBlock *) & block[1],
ntohl (block->size) -
sizeof (GNUNET_DatastoreValue),
&query, &eblock));
- eblock->expirationTime = block->expirationTime;
- eblock->prio = block->prio;
+ eblock->expiration_time = block->expiration_time;
+ eblock->priority = block->priority;
CHECK (GNUNET_OK == GNUNET_FS_insert (sock, eblock));
CHECK (GNUNET_OK == trySearch (i));
CHECK (1 == GNUNET_FS_delete (sock, eblock));
GNUNET_free (eblock);
- GNUNET_hash (&((DBlock *) & block[1])[1],
+ GNUNET_hash (&((GNUNET_EC_DBlock *) & block[1])[1],
ntohl (block->size) - sizeof (GNUNET_DatastoreValue) -
- sizeof (DBlock), &hc);
+ sizeof (GNUNET_EC_DBlock), &hc);
CHECK (GNUNET_OK == GNUNET_FS_index (sock, &hc, block, 0));
CHECK (GNUNET_OK == trySearch (i));
CHECK (GNUNET_OK ==
Modified: GNUnet/src/applications/getoption/getoption.c
===================================================================
--- GNUnet/src/applications/getoption/getoption.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/getoption/getoption.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -63,7 +63,7 @@
rep->header.size = htons (sizeof (GNUNET_MessageHeader) + strlen (val) + 1);
memcpy (rep->value, val, strlen (val) + 1);
rep->header.type = htons (GNUNET_CS_PROTO_GET_OPTION_REPLY);
- ret = coreAPI->cs_send_to_client (sock, &rep->header, GNUNET_YES);
+ ret = coreAPI->cs_send_message (sock, &rep->header, GNUNET_YES);
GNUNET_free (rep);
GNUNET_free (val);
return ret;
@@ -77,8 +77,8 @@
GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_("`%s' registering client handler %d\n"),
"getoption", GNUNET_CS_PROTO_GET_OPTION_REQUEST);
- capi->registerClientHandler (GNUNET_CS_PROTO_GET_OPTION_REQUEST,
- &handleGetOption);
+ capi->cs_handler_register (GNUNET_CS_PROTO_GET_OPTION_REQUEST,
+ &handleGetOption);
GNUNET_GE_ASSERT (capi->ectx,
0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
@@ -93,7 +93,7 @@
void
done_module_getoption ()
{
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_GET_OPTION_REQUEST,
- &handleGetOption);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_GET_OPTION_REQUEST,
+ &handleGetOption);
coreAPI = NULL;
}
Modified: GNUnet/src/applications/hostlist/hostlist.c
===================================================================
--- GNUnet/src/applications/hostlist/hostlist.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/hostlist/hostlist.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -125,7 +125,7 @@
results.protocols = -1;
for (i = GNUNET_TRANSPORT_PROTOCOL_NUMBER_MAX;
i > GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT; i--)
- host_processor (coreAPI->myIdentity, i, GNUNET_YES, &results);
+ host_processor (coreAPI->my_identity, i, GNUNET_YES, &results);
identity->forEachHost (GNUNET_get_time (), &host_processor, &results);
if (results.size == 0)
return MHD_NO; /* no known hosts!? */
@@ -151,14 +151,14 @@
"PORT", 0, 65535, 8080,
&port))
return GNUNET_SYSERR;
- identity = capi->request_service ("identity");
+ identity = capi->service_request ("identity");
if (identity == NULL)
{
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
coreAPI = capi;
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_request_count
@@ -183,10 +183,10 @@
{
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
return GNUNET_SYSERR;
}
@@ -207,10 +207,10 @@
daemon_handle = NULL;
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
coreAPI = NULL;
}
Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/identity/identity.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -584,8 +584,8 @@
oldMsg = (GNUNET_MessageHello *) buffer;
if ((unsigned int) size == GNUNET_sizeof_hello (oldMsg))
{
- if (ntohl (oldMsg->expirationTime) >
- ntohl (msg->expirationTime))
+ if (ntohl (oldMsg->expiration_time) >
+ ntohl (msg->expiration_time))
{
GNUNET_free (fn);
GNUNET_free (buffer);
@@ -1193,11 +1193,10 @@
return GNUNET_SYSERR;
msg = (const CS_identity_connect_MESSAGE *) message;
whitelistHost (&msg->other);
- coreAPI->unicast (&msg->other, NULL, 0, 0);
- ret = coreAPI->queryPeerStatus (&msg->other, NULL, NULL);
- return coreAPI->sendValueToClient (sock,
- ret !=
- GNUNET_OK ? GNUNET_NO : GNUNET_YES);
+ coreAPI->ciphertext_send (&msg->other, NULL, 0, 0);
+ ret = coreAPI->p2p_connection_status_check (&msg->other, NULL, NULL);
+ return coreAPI->cs_send_value (sock,
+ ret != GNUNET_OK ? GNUNET_NO : GNUNET_YES);
}
static int
@@ -1221,9 +1220,9 @@
hello = GNUNET_malloc (ntohs (msg->header.size));
memcpy (hello, msg, ntohs (msg->header.size));
hello->header.type = htons (GNUNET_P2P_PROTO_HELLO);
- coreAPI->p2p_inject_message (NULL,
- (const char *) hello,
- ntohs (msg->header.size), GNUNET_NO, NULL);
+ coreAPI->loopback_send (NULL,
+ (const char *) hello,
+ ntohs (msg->header.size), GNUNET_NO, NULL);
GNUNET_free (hello);
return GNUNET_OK;
}
@@ -1251,18 +1250,18 @@
/* we cannot permanently load transport
since that would cause a cyclic dependency;
however, we can request it briefly here */
- tapi = coreAPI->request_service ("transport");
+ tapi = coreAPI->service_request ("transport");
if (tapi == NULL)
return GNUNET_SYSERR;
hello = NULL;
pos = 0;
while ((hello == NULL) && (types[pos] != 0))
- hello = tapi->createhello (types[pos++]);
- coreAPI->release_service (tapi);
+ hello = tapi->hello_create (types[pos++]);
+ coreAPI->service_release (tapi);
if (hello == NULL)
return GNUNET_SYSERR;
hello->header.type = htons (GNUNET_CS_PROTO_IDENTITY_HELLO);
- ret = coreAPI->cs_send_to_client (sock, &hello->header, GNUNET_YES);
+ ret = coreAPI->cs_send_message (sock, &hello->header, GNUNET_YES);
GNUNET_free (hello);
return ret;
}
@@ -1281,7 +1280,7 @@
ntohs (message->size) -
sizeof (GNUNET_MessageHeader), &reply.sig))
return GNUNET_SYSERR;
- return coreAPI->cs_send_to_client (sock, &reply.header, GNUNET_YES);
+ return coreAPI->cs_send_message (sock, &reply.header, GNUNET_YES);
}
static int
@@ -1303,7 +1302,7 @@
hello = identity2Hello (identity, protocol, GNUNET_YES);
if (hello == NULL)
return GNUNET_OK; /* ignore -- happens if HELLO just expired */
- transport = coreAPI->request_service ("transport");
+ transport = coreAPI->service_request ("transport");
if (transport == NULL)
{
GNUNET_free (hello);
@@ -1312,16 +1311,17 @@
len = 0;
address = NULL;
- transport->helloToAddress (hello, &address, &len);
+ transport->hello_to_address (hello, &address, &len);
GNUNET_free (hello);
- coreAPI->release_service (transport);
+ coreAPI->service_release (transport);
if (len >= GNUNET_MAX_BUFFER_SIZE - sizeof (CS_identity_peer_info_MESSAGE))
{
GNUNET_free (address);
address = NULL;
len = 0;
}
- if (GNUNET_OK != coreAPI->queryPeerStatus (identity, &bpm, &last))
+ if (GNUNET_OK !=
+ coreAPI->p2p_connection_status_check (identity, &bpm, &last))
{
last = 0;
bpm = 0;
@@ -1335,7 +1335,7 @@
reply->bpm = htonl (bpm);
memcpy (&reply[1], address, len);
GNUNET_free_non_null (address);
- ret = coreAPI->cs_send_to_client (sock, &reply->header, GNUNET_YES);
+ ret = coreAPI->cs_send_message (sock, &reply->header, GNUNET_YES);
GNUNET_free (reply);
return ret;
}
@@ -1345,7 +1345,7 @@
const GNUNET_MessageHeader * message)
{
forEachHost (0, &hostInfoIterator, sock);
- return coreAPI->sendValueToClient (sock, GNUNET_OK);
+ return coreAPI->cs_send_value (sock, GNUNET_OK);
}
@@ -1429,16 +1429,16 @@
GNUNET_cron_add_job (coreAPI->cron,
&cronDiscardHosts, 0, CRON_DISCARD_HOSTS_INTERVAL,
NULL);
- coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_CONNECT,
- &identityRequestConnectHandler);
- coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_HELLO,
- &identityHelloHandler);
- coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_HELLO,
- &identityRequestHelloHandler);
- coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_SIGNATURE,
- &identityRequestSignatureHandler);
- coreAPI->registerClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_INFO,
- &identityRequestInfoHandler);
+ coreAPI->cs_handler_register (GNUNET_CS_PROTO_IDENTITY_CONNECT,
+ &identityRequestConnectHandler);
+ coreAPI->cs_handler_register (GNUNET_CS_PROTO_IDENTITY_HELLO,
+ &identityHelloHandler);
+ coreAPI->cs_handler_register (GNUNET_CS_PROTO_IDENTITY_REQUEST_HELLO,
+ &identityRequestHelloHandler);
+ coreAPI->cs_handler_register (GNUNET_CS_PROTO_IDENTITY_REQUEST_SIGNATURE,
+ &identityRequestSignatureHandler);
+ coreAPI->cs_handler_register (GNUNET_CS_PROTO_IDENTITY_REQUEST_INFO,
+ &identityRequestInfoHandler);
return &id;
}
@@ -1452,17 +1452,17 @@
int j;
HostEntry *entry;
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_CONNECT,
- &identityRequestConnectHandler);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_HELLO,
- &identityHelloHandler);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_HELLO,
- &identityRequestHelloHandler);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_IDENTITY_CONNECT,
+ &identityRequestConnectHandler);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_IDENTITY_HELLO,
+ &identityHelloHandler);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_IDENTITY_REQUEST_HELLO,
+ &identityRequestHelloHandler);
coreAPI->
- unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_SIGNATURE,
- &identityRequestSignatureHandler);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_IDENTITY_REQUEST_INFO,
- &identityRequestInfoHandler);
+ cs_handler_unregister (GNUNET_CS_PROTO_IDENTITY_REQUEST_SIGNATURE,
+ &identityRequestSignatureHandler);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_IDENTITY_REQUEST_INFO,
+ &identityRequestInfoHandler);
for (i = 0; i < MAX_TEMP_HOSTS; i++)
{
entry = &tempHosts[i];
Modified: GNUnet/src/applications/identity/identitytest.c
===================================================================
--- GNUnet/src/applications/identity/identitytest.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/identity/identitytest.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -64,7 +64,7 @@
GNUNET_cron_start (cron);
/* give cron job chance to run */
GNUNET_thread_sleep (5 * GNUNET_CRON_SECONDS);
- hello = transport->createhello (GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY);
+ hello = transport->hello_create (GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY);
if (NULL == hello)
{
printf ("Cannot run test, failed to create any hello.\n");
Modified: GNUnet/src/applications/pingpong/pingpong.c
===================================================================
--- GNUnet/src/applications/pingpong/pingpong.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/pingpong/pingpong.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -138,7 +138,7 @@
if (stats != NULL)
stats->change (stat_pingReceived, 1);
pmsg = (const P2P_pingpong_MESSAGE *) msg;
- if (0 != memcmp (coreAPI->myIdentity,
+ if (0 != memcmp (coreAPI->my_identity,
&pmsg->receiver, sizeof (GNUNET_PeerIdentity)))
{
GNUNET_GE_LOG (ectx,
@@ -159,7 +159,7 @@
pong.header.type = htons (GNUNET_P2P_PROTO_PONG);
if (stats != NULL)
stats->change (stat_pingReceived, 1);
- coreAPI->unicast (sender, &pong.header, GNUNET_EXTREME_PRIORITY, 0); /*
send now! */
+ coreAPI->ciphertext_send (sender, &pong.header, GNUNET_EXTREME_PRIORITY, 0);
/* send now! */
if (stats != NULL)
stats->change (stat_pongSent, 1);
return GNUNET_OK;
@@ -172,12 +172,11 @@
GNUNET_TSession *mytsession;
int ret;
- mytsession = transport->connectFreely (peer, GNUNET_YES, __FILE__);
+ mytsession = transport->connect_freely (peer, GNUNET_YES, __FILE__);
if (mytsession == NULL)
return GNUNET_SYSERR;
- ret = coreAPI->connection_send_plaintext (mytsession,
- (char *) msg,
- sizeof (P2P_pingpong_MESSAGE));
+ ret = coreAPI->plaintext_send (mytsession,
+ (char *) msg, sizeof (P2P_pingpong_MESSAGE));
transport->disconnect (mytsession, __FILE__);
return ret;
}
@@ -207,7 +206,7 @@
return GNUNET_SYSERR;
}
pmsg = (const P2P_pingpong_MESSAGE *) hmsg;
- if (0 != memcmp (coreAPI->myIdentity,
+ if (0 != memcmp (coreAPI->my_identity,
&pmsg->receiver, sizeof (GNUNET_PeerIdentity)))
{
GNUNET_hash_to_enc (&sender->hashPubKey, &enc);
@@ -231,9 +230,9 @@
transport may have been uni-directional! */
ret = GNUNET_SYSERR;
if (tsession != NULL)
- ret = coreAPI->connection_send_plaintext (tsession,
- (char *) &pong,
- sizeof (P2P_pingpong_MESSAGE));
+ ret = coreAPI->plaintext_send (tsession,
+ (char *) &pong,
+ sizeof (P2P_pingpong_MESSAGE));
if (ret != GNUNET_OK)
ret = connection_send_plaintext (sender, &pong);
if (ret == GNUNET_OK)
@@ -480,7 +479,7 @@
}
else
{
- coreAPI->unicast (receiver, pmsg, GNUNET_EXTREME_PRIORITY, 0);
+ coreAPI->ciphertext_send (receiver, pmsg, GNUNET_EXTREME_PRIORITY, 0);
if (stats != NULL)
stats->change (stat_ciphertextPingSent, 1);
}
@@ -499,20 +498,20 @@
ectx = capi->ectx;
GNUNET_GE_ASSERT (ectx, sizeof (P2P_pingpong_MESSAGE) == 72);
coreAPI = capi;
- identity = capi->request_service ("identity");
+ identity = capi->service_request ("identity");
if (identity == NULL)
{
GNUNET_GE_BREAK (capi->ectx, 0);
return NULL;
}
- transport = capi->request_service ("transport");
+ transport = capi->service_request ("transport");
if (transport == NULL)
{
GNUNET_GE_BREAK (capi->ectx, 0);
- capi->release_service (identity);
+ capi->service_release (identity);
return NULL;
}
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_encryptedPongReceived
@@ -537,7 +536,7 @@
create (gettext_noop ("# plaintext PONG transmissions failed"));
}
- pingPongLock = capi->connection_get_lock ();
+ pingPongLock = capi->global_lock_get ();
pingPongs =
(PingPongEntry *) GNUNET_malloc (sizeof (PingPongEntry) * MAX_PING_PONG);
memset (pingPongs, 0, sizeof (PingPongEntry) * MAX_PING_PONG);
@@ -546,12 +545,14 @@
_
("`%s' registering handlers %d %d (plaintext and
ciphertext)\n"),
"pingpong", GNUNET_P2P_PROTO_PING, GNUNET_P2P_PROTO_PONG);
- capi->registerHandler (GNUNET_P2P_PROTO_PING, &pingReceived);
- capi->registerHandler (GNUNET_P2P_PROTO_PONG, &pongReceived);
- capi->plaintext_register_handler (GNUNET_P2P_PROTO_PING,
- &plaintextPingReceived);
- capi->plaintext_register_handler (GNUNET_P2P_PROTO_PONG,
- &plaintextPongReceived);
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_PING,
+ &pingReceived);
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_PONG,
+ &pongReceived);
+ capi->p2p_plaintext_handler_register (GNUNET_P2P_PROTO_PING,
+ &plaintextPingReceived);
+ capi->p2p_plaintext_handler_register (GNUNET_P2P_PROTO_PONG,
+ &plaintextPongReceived);
ret.ping = &initiatePing;
ret.pingUser = &createPing;
ret.ping_size = sizeof (P2P_pingpong_MESSAGE);
@@ -566,21 +567,23 @@
{
int i;
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
- coreAPI->release_service (transport);
+ coreAPI->service_release (transport);
transport = NULL;
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
for (i = 0; i < MAX_PING_PONG; i++)
GNUNET_free_non_null (pingPongs[i].data);
GNUNET_free (pingPongs);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_PING, &pingReceived);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_PONG, &pongReceived);
- coreAPI->plaintext_unregister_handler (GNUNET_P2P_PROTO_PING,
- &plaintextPingReceived);
- coreAPI->plaintext_unregister_handler (GNUNET_P2P_PROTO_PONG,
- &plaintextPongReceived);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_PING,
+ &pingReceived);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_PONG,
+ &pongReceived);
+ coreAPI->p2p_plaintext_handler_unregister (GNUNET_P2P_PROTO_PING,
+ &plaintextPingReceived);
+ coreAPI->p2p_plaintext_handler_unregister (GNUNET_P2P_PROTO_PONG,
+ &plaintextPongReceived);
coreAPI = NULL;
return GNUNET_OK;
}
Modified: GNUnet/src/applications/rpc/rpc.c
===================================================================
--- GNUnet/src/applications/rpc/rpc.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/rpc/rpc.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -461,7 +461,7 @@
msg.header.size = htons (sizeof (RPC_ACK_Message));
msg.header.type = htons (GNUNET_P2P_PROTO_RPC_ACK);
msg.sequenceNumber = htonl (sequenceNumber);
- coreAPI->unicast (receiver, &msg.header, importance, maxDelay);
+ coreAPI->ciphertext_send (receiver, &msg.header, importance, maxDelay);
}
/**
@@ -542,9 +542,10 @@
call->repetitionFrequency = RPC_INITIAL_ROUND_TRIP_TIME;
call->attempts = 1;
call->errorCode = errorCode;
- coreAPI->unicast (&call->initiator,
- &call->msg->header,
- call->importance, RPC_INITIAL_ROUND_TRIP_TIME / 2);
+ coreAPI->ciphertext_send (&call->initiator,
+ &call->msg->header,
+ call->importance,
+ RPC_INITIAL_ROUND_TRIP_TIME / 2);
GNUNET_mutex_unlock (lock);
}
@@ -795,9 +796,9 @@
if (ret->next != NULL)
ret->next->prev = ret;
GNUNET_mutex_unlock (lock);
- coreAPI->unicast (receiver,
- &ret->msg->header,
- importance, RPC_INITIAL_ROUND_TRIP_TIME / 2);
+ coreAPI->ciphertext_send (receiver,
+ &ret->msg->header,
+ importance, RPC_INITIAL_ROUND_TRIP_TIME / 2);
return ret;
}
@@ -867,9 +868,10 @@
ipos->lastAttempt = now;
ipos->attempts++;
ipos->repetitionFrequency *= 2;
- coreAPI->unicast (&ipos->initiator,
- &ipos->msg->header,
- ipos->repetitionFrequency / 2, ipos->importance);
+ coreAPI->ciphertext_send (&ipos->initiator,
+ &ipos->msg->header,
+ ipos->repetitionFrequency / 2,
+ ipos->importance);
}
ipos = ipos->next;
}
@@ -900,9 +902,10 @@
opos->lastAttempt = now;
opos->attempts++;
opos->repetitionFrequency *= 2;
- coreAPI->unicast (&opos->receiver,
- &opos->msg->header,
- opos->repetitionFrequency / 2, opos->importance);
+ coreAPI->ciphertext_send (&opos->receiver,
+ &opos->msg->header,
+ opos->repetitionFrequency / 2,
+ opos->importance);
}
opos = opos->next;
}
@@ -917,9 +920,12 @@
void
release_module_rpc ()
{
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_RPC_REQ, &handleRPCMessageReq);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_RPC_RES, &handleRPCMessageRes);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_RPC_ACK, &handleRPCMessageAck);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_RPC_REQ,
+ &handleRPCMessageReq);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_RPC_RES,
+ &handleRPCMessageRes);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_RPC_ACK,
+ &handleRPCMessageAck);
GNUNET_GE_ASSERT (NULL, NULL == incomingCalls);
GNUNET_GE_ASSERT (NULL, NULL == outgoingCalls);
GNUNET_GE_ASSERT (NULL, NULL == list_of_callbacks);
@@ -938,7 +944,7 @@
static GNUNET_RPC_ServiceAPI rpcAPI;
int rvalue;
- lock = capi->connection_get_lock ();
+ lock = capi->global_lock_get ();
coreAPI = capi;
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
@@ -946,14 +952,17 @@
GNUNET_P2P_PROTO_RPC_REQ, GNUNET_P2P_PROTO_RPC_RES,
GNUNET_P2P_PROTO_RPC_ACK);
rvalue = GNUNET_OK;
- if (capi->registerHandler (GNUNET_P2P_PROTO_RPC_REQ,
- &handleRPCMessageReq) == GNUNET_SYSERR)
+ if (capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_RPC_REQ,
+ &handleRPCMessageReq) ==
+ GNUNET_SYSERR)
rvalue = GNUNET_SYSERR;
- if (capi->registerHandler (GNUNET_P2P_PROTO_RPC_RES,
- &handleRPCMessageRes) == GNUNET_SYSERR)
+ if (capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_RPC_RES,
+ &handleRPCMessageRes) ==
+ GNUNET_SYSERR)
rvalue = GNUNET_SYSERR;
- if (capi->registerHandler (GNUNET_P2P_PROTO_RPC_ACK,
- &handleRPCMessageAck) == GNUNET_SYSERR)
+ if (capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_RPC_ACK,
+ &handleRPCMessageAck) ==
+ GNUNET_SYSERR)
rvalue = GNUNET_SYSERR;
if (rvalue == GNUNET_SYSERR)
{
Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/session/connect.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -150,7 +150,7 @@
GNUNET_GE_ASSERT (ectx, hostId != NULL);
if (stats != NULL)
stats->change (stat_sessionEstablished, 1);
- coreAPI->connection_mark_session_as_confirmed (hostId);
+ coreAPI->p2p_connection_confirm (hostId);
GNUNET_free (hostId);
}
@@ -345,7 +345,7 @@
#if EXTRA_CHECKS
/* verify signature/SKS */
GNUNET_GE_ASSERT (ectx,
- GNUNET_SYSERR != verifySKS (coreAPI->myIdentity, msg));
+ GNUNET_SYSERR != verifySKS (coreAPI->my_identity, msg));
#endif
size = 0;
@@ -424,7 +424,7 @@
/* then try to connect on the transport level */
if ((tsession == NULL)
|| (transport->associate (tsession, __FILE__) == GNUNET_SYSERR))
- tsession = transport->connectFreely (receiver, GNUNET_YES, __FILE__);
+ tsession = transport->connect_freely (receiver, GNUNET_YES, __FILE__);
if (tsession == NULL)
{
#if DEBUG_SESSION
@@ -449,13 +449,11 @@
/* get or create our session key */
if (GNUNET_OK !=
- coreAPI->connection_get_session_key_of_peer (receiver, &sk,
- &age, GNUNET_YES))
+ coreAPI->p2p_session_key_get (receiver, &sk, &age, GNUNET_YES))
{
age = GNUNET_get_time_int32 (NULL);
GNUNET_AES_create_session_key (&sk);
- coreAPI->connection_assign_session_key_to_peer (&sk, receiver,
- age, GNUNET_YES);
+ coreAPI->p2p_session_key_set (&sk, receiver, age, GNUNET_YES);
#if DEBUG_SESSION
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_USER | GNUNET_GE_REQUEST,
@@ -474,9 +472,9 @@
}
/* create hello */
- hello = transport->createhello (tsession->ttype);
+ hello = transport->hello_create (tsession->ttype);
if (NULL == hello)
- hello = transport->createhello (GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY);
+ hello = transport->hello_create (GNUNET_TRANSPORT_PROTOCOL_NUMBER_ANY);
if (NULL == hello)
{
char *tports;
@@ -506,14 +504,14 @@
}
if (hello != NULL)
{
- coreAPI->connection_send_plaintext (tsession,
- (const char *) hello,
- GNUNET_sizeof_hello (hello));
+ coreAPI->plaintext_send (tsession,
+ (const char *) hello,
+ GNUNET_sizeof_hello (hello));
GNUNET_free (hello);
hello = NULL;
- coreAPI->connection_send_plaintext (tsession,
- (const char *) skey,
- ntohs (skey->header.size));
+ coreAPI->plaintext_send (tsession,
+ (const char *) skey,
+ ntohs (skey->header.size));
}
GNUNET_free (skey);
if (0 != memcmp (receiver, &tsession->peer, sizeof (GNUNET_PeerIdentity)))
@@ -522,7 +520,7 @@
}
else
{
- coreAPI->offerTSessionFor (receiver, tsession);
+ coreAPI->p2p_transport_session_offer (receiver, tsession);
}
transport->disconnect (tsession, __FILE__);
return GNUNET_OK;
@@ -575,7 +573,7 @@
return GNUNET_SYSERR;
}
if (0 == memcmp (&sender->hashPubKey,
- &coreAPI->myIdentity->hashPubKey,
+ &coreAPI->my_identity->hashPubKey,
sizeof (GNUNET_HashCode)))
{
GNUNET_GE_BREAK (ectx, 0);
@@ -604,11 +602,11 @@
}
load = GNUNET_cpu_get_load (ectx, coreAPI->cfg);
if ((GNUNET_OK !=
- coreAPI->connection_get_session_key_of_peer (sender, NULL,
- NULL,
- GNUNET_YES))
+ coreAPI->p2p_session_key_get (sender, NULL,
+ NULL,
+ GNUNET_YES))
&& ((GNUNET_YES == identity->isBlacklisted (sender, GNUNET_NO))
- || ((coreAPI->forAllConnectedNodes (NULL, NULL) >= 3)
+ || ((coreAPI->p2p_connections_iterate (NULL, NULL) >= 3)
&& (load > GNUNET_IDLE_LOAD_THRESHOLD))))
{
#if DEBUG_SESSION
@@ -622,7 +620,7 @@
}
newMsg = (const P2P_setkey_MESSAGE *) msg;
- if (0 != memcmp (&coreAPI->myIdentity->hashPubKey,
+ if (0 != memcmp (&coreAPI->my_identity->hashPubKey,
&newMsg->target.hashPubKey, sizeof (GNUNET_HashCode)))
{
GNUNET_EncName ta;
@@ -687,11 +685,9 @@
if (stats != NULL)
stats->change (stat_skeyAccepted, 1);
/* notify core about session key */
- coreAPI->connection_assign_session_key_to_peer (&key,
- sender,
- ntohl
- (newMsg->
- creationTime), GNUNET_NO);
+ coreAPI->p2p_session_key_set (&key,
+ sender,
+ ntohl (newMsg->creationTime), GNUNET_NO);
pos = sizeof (P2P_setkey_MESSAGE);
ping = NULL;
pong = NULL;
@@ -757,9 +753,9 @@
"Received PONG in session key from `%s', injecting!\n",
&enc);
#endif
- coreAPI->p2p_inject_message (sender,
- (char *) pong,
- ntohs (pong->size), GNUNET_YES, tsession);
+ coreAPI->loopback_send (sender,
+ (char *) pong,
+ ntohs (pong->size), GNUNET_YES, tsession);
if (ping != NULL)
{ /* should always be true for well-behaved
peers */
/* pong can go out over ordinary channels */
@@ -773,7 +769,7 @@
ping->type = htons (GNUNET_P2P_PROTO_PONG);
if (stats != NULL)
stats->change (stat_pongSent, 1);
- coreAPI->unicast (sender, ping, GNUNET_EXTREME_PRIORITY, 0);
+ coreAPI->ciphertext_send (sender, ping, GNUNET_EXTREME_PRIORITY, 0);
}
}
else
@@ -831,7 +827,7 @@
#endif
return GNUNET_SYSERR;
}
- if (coreAPI->queryPeerStatus (peer, NULL, NULL) == GNUNET_OK)
+ if (coreAPI->p2p_connection_status_check (peer, NULL, NULL) == GNUNET_OK)
{
#if DEBUG_SESSION
GNUNET_GE_LOG (ectx,
@@ -889,32 +885,32 @@
ectx = capi->ectx;
coreAPI = capi;
- identity = capi->request_service ("identity");
+ identity = capi->service_request ("identity");
if (identity == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
- transport = capi->request_service ("transport");
+ transport = capi->service_request ("transport");
if (transport == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
return NULL;
}
- pingpong = capi->request_service ("pingpong");
+ pingpong = capi->service_request ("pingpong");
if (pingpong == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
- coreAPI->release_service (transport);
+ coreAPI->service_release (transport);
transport = NULL;
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
return NULL;
}
- topology = capi->request_service ("topology");
- stats = capi->request_service ("stats");
+ topology = capi->service_request ("topology");
+ stats = capi->service_request ("stats");
if (stats != NULL)
{
stat_skeySent = stats->create (gettext_noop ("# session keys sent"));
@@ -929,16 +925,16 @@
stat_pongSent
= stats->create (gettext_noop ("# encrypted PONG messages sent"));
}
- lock = capi->connection_get_lock ();
+ lock = capi->global_lock_get ();
GNUNET_GE_LOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_USER | GNUNET_GE_REQUEST,
_
("`%s' registering handler %d (plaintext and ciphertext)\n"),
"session", GNUNET_P2P_PROTO_SET_KEY);
- coreAPI->plaintext_register_handler (GNUNET_P2P_PROTO_SET_KEY,
- &acceptSessionKey);
- coreAPI->registerHandler (GNUNET_P2P_PROTO_SET_KEY,
- &acceptSessionKeyUpdate);
+ coreAPI->p2p_plaintext_handler_register (GNUNET_P2P_PROTO_SET_KEY,
+ &acceptSessionKey);
+ coreAPI->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_SET_KEY,
+ &acceptSessionKeyUpdate);
ret.tryConnect = &tryConnect;
return &ret;
}
@@ -949,22 +945,22 @@
int
release_module_session ()
{
- coreAPI->plaintext_unregister_handler (GNUNET_P2P_PROTO_SET_KEY,
- &acceptSessionKey);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_SET_KEY,
- &acceptSessionKeyUpdate);
+ coreAPI->p2p_plaintext_handler_unregister (GNUNET_P2P_PROTO_SET_KEY,
+ &acceptSessionKey);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_SET_KEY,
+ &acceptSessionKeyUpdate);
if (topology != NULL)
{
- coreAPI->release_service (topology);
+ coreAPI->service_release (topology);
topology = NULL;
}
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
- coreAPI->release_service (transport);
+ coreAPI->service_release (transport);
transport = NULL;
- coreAPI->release_service (pingpong);
+ coreAPI->service_release (pingpong);
pingpong = NULL;
coreAPI = NULL;
lock = NULL;
Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -678,9 +678,9 @@
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);
- datum->expirationTime = GNUNET_htonll (exp);
+ datum->priority = htonl (prio);
+ datum->anonymity_level = htonl (level);
+ datum->expiration_time = GNUNET_htonll (exp);
/* now do query on gn072 */
length = contentSize;
@@ -796,9 +796,9 @@
hashSize2 = sizeof (GNUNET_HashCode);
size = ntohl (value->size);
type = ntohl (value->type);
- prio = ntohl (value->prio);
- level = ntohl (value->anonymityLevel);
- expiration = GNUNET_ntohll (value->expirationTime);
+ prio = ntohl (value->priority);
+ level = ntohl (value->anonymity_level);
+ expiration = GNUNET_ntohll (value->expiration_time);
contentSize = ntohl (value->size) - sizeof (GNUNET_DatastoreValue);
GNUNET_hash (&value[1], contentSize, &vhash);
GNUNET_mutex_lock (lock);
@@ -830,7 +830,7 @@
qbind[1].buffer_type = MYSQL_TYPE_LONG; /* type */
qbind[1].is_unsigned = 1;
qbind[1].buffer = &type;
- qbind[2].buffer_type = MYSQL_TYPE_LONG; /* prio */
+ qbind[2].buffer_type = MYSQL_TYPE_LONG; /* priority */
qbind[2].is_unsigned = 1;
qbind[2].buffer = &prio;
qbind[3].buffer_type = MYSQL_TYPE_LONG; /* anon level */
@@ -1541,7 +1541,7 @@
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
- /* NOTE: as the table entry for 'prio' is defined as unsigned,
+ /* NOTE: as the table entry for 'priority' is defined as unsigned,
* mysql will zero the value if its about to go negative. (This
* will generate a warning though, but its probably not seen
* at all in this context.)
@@ -1644,7 +1644,7 @@
ectx = capi->ectx;
coreAPI = capi;
- stats = coreAPI->request_service ("stats");
+ stats = coreAPI->service_request ("stats");
if (stats)
stat_size = stats->create (gettext_noop ("# bytes in datastore"));
@@ -1680,7 +1680,7 @@
GNUNET_GE_ERROR | GNUNET_GE_ADMIN |
GNUNET_GE_BULK, "fopen", cnffile);
if (stats != NULL)
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
GNUNET_free (cnffile);
return NULL;
}
@@ -1701,12 +1701,12 @@
("Failed to load MySQL database module. Check that MySQL
is running and configured properly!\n"));
dbh = NULL;
if (stats != NULL)
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
return NULL;
}
lock = GNUNET_mutex_create (GNUNET_NO);
- state = coreAPI->request_service ("state");
+ state = coreAPI->service_request ("state");
sb = NULL;
if (sizeof (unsigned long long)
!= state->read (ectx, "mysql-size", (void *) &sb))
@@ -1750,7 +1750,7 @@
the outdated state file! */
state->unlink (ectx, "mysql-size");
}
- coreAPI->release_service (state);
+ coreAPI->service_release (state);
api.getSize = &getSize;
api.put = &put;
api.get = &get;
@@ -1777,12 +1777,12 @@
GNUNET_free (dbh);
dbh = NULL;
if (stats != NULL)
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
GNUNET_mutex_destroy (lock);
- state = coreAPI->request_service ("state");
+ state = coreAPI->service_request ("state");
state->write (ectx,
"mysql-size", sizeof (unsigned long long), &content_size);
- coreAPI->release_service (state);
+ coreAPI->service_release (state);
mysql_library_end ();
ectx = NULL;
coreAPI = NULL;
Modified: GNUnet/src/applications/sqstore_mysql/mysqltest.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -41,9 +41,9 @@
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);
- value->expirationTime = GNUNET_htonll (now - i * GNUNET_CRON_SECONDS);
+ value->priority = htonl (i + 1);
+ value->anonymity_level = htonl (i);
+ value->expiration_time = GNUNET_htonll (now - i * GNUNET_CRON_SECONDS);
memset (&value[1], i, 8 * i);
return value;
}
@@ -66,8 +66,8 @@
{
/*
printf("Wanted: %u, %llu; got %u, %llu - %d\n",
- ntohl(value->size), GNUNET_ntohll(value->expirationTime),
- ntohl(val->size), GNUNET_ntohll(val->expirationTime),
+ ntohl(value->size), GNUNET_ntohll(value->expiration_time),
+ ntohl(val->size), GNUNET_ntohll(val->expiration_time),
memcmp(val, value, ntohl(val->size))); */
ret = GNUNET_SYSERR;
}
@@ -123,7 +123,7 @@
int id;
id = (*closure);
- if (id + 1 == ntohl (val->prio))
+ if (id + 1 == ntohl (val->priority))
return GNUNET_OK;
else
return GNUNET_SYSERR;
Modified: GNUnet/src/applications/sqstore_mysql/mysqltest2.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest2.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest2.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -141,9 +141,10 @@
value = GNUNET_malloc (size);
value->size = htonl (size);
value->type = htonl (i);
- value->prio = htonl (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 100));
- value->anonymityLevel = htonl (i);
- value->expirationTime =
+ value->priority =
+ htonl (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 100));
+ value->anonymity_level = htonl (i);
+ value->expiration_time =
GNUNET_htonll (GNUNET_get_time () +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 1000));
memset (&value[1], i, size - sizeof (GNUNET_DatastoreValue));
Modified: GNUnet/src/applications/sqstore_mysql/mysqltest3.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest3.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest3.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -75,9 +75,10 @@
value = GNUNET_malloc (size);
value->size = htonl (size);
value->type = htonl (i);
- value->prio = htonl (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 100));
- value->anonymityLevel = htonl (i);
- value->expirationTime =
+ value->priority =
+ htonl (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 100));
+ value->anonymity_level = htonl (i);
+ value->expiration_time =
GNUNET_htonll (GNUNET_get_time () + 60 * GNUNET_CRON_HOURS +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 1000));
memset (&value[1], i, size - sizeof (GNUNET_DatastoreValue));
Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -346,9 +346,9 @@
{
return sizeof (GNUNET_HashCode) * 2 + 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;
+ getIntSize (ntohl (value->type)) + getIntSize (ntohl (value->priority)) +
+ getIntSize (ntohl (value->anonymity_level)) +
+ getIntSize (GNUNET_ntohll (value->expiration_time)) + 7 + 245 + 1;
}
@@ -400,7 +400,7 @@
}
/**
- * Given a full row from gn080 table
(size,type,prio,anonLevel,expire,GNUNET_hash,value),
+ * Given a full row from gn080 table
(size,type,priority,anonLevel,expire,GNUNET_hash,value),
* assemble it into a GNUNET_DatastoreValue representation.
*/
static GNUNET_DatastoreValue *
@@ -497,9 +497,9 @@
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));
- value->expirationTime = GNUNET_htonll (sqlite3_column_int64 (stmt, 4));
+ value->priority = htonl (sqlite3_column_int (stmt, 2));
+ value->anonymity_level = htonl (sqlite3_column_int (stmt, 3));
+ value->expiration_time = GNUNET_htonll (sqlite3_column_int64 (stmt, 4));
memcpy (key, sqlite3_column_blob (stmt, 5), sizeof (GNUNET_HashCode));
memcpy (&value[1], sqlite3_column_blob (stmt, 6), contentSize);
return value;
@@ -778,7 +778,8 @@
/* have to pick between 1 and 2 */
if (is_prio)
{
- if ((ntohl (datum_1->prio) < ntohl (datum_2->prio)) == is_asc)
+ if ((ntohl (datum_1->priority) < ntohl (datum_2->priority)) ==
+ is_asc)
{
datum = datum_1;
rowid = rowid_1;
@@ -795,8 +796,8 @@
}
else
{
- if ((GNUNET_ntohll (datum_1->expirationTime) <
- GNUNET_ntohll (datum_2->expirationTime)) == is_asc)
+ if ((GNUNET_ntohll (datum_1->expiration_time) <
+ GNUNET_ntohll (datum_2->expiration_time)) == is_asc)
{
datum = datum_1;
rowid = rowid_1;
@@ -817,11 +818,11 @@
#if 0
printf ("FOUND %4u prio %4u exp %20llu old: %4u, %20llu\n",
(ntohl (datum->size) - sizeof (GNUNET_DatastoreValue)),
- ntohl (datum->prio),
- GNUNET_ntohll (datum->expirationTime), lastPrio, lastExp);
+ ntohl (datum->priority),
+ GNUNET_ntohll (datum->expiration_time), lastPrio, lastExp);
#endif
if (((GNUNET_NO == limit_nonanonymous) ||
- (ntohl (datum->anonymityLevel) == 0)) &&
+ (ntohl (datum->anonymity_level) == 0)) &&
((type == GNUNET_ECRS_BLOCKTYPE_ANY) ||
(type == ntohl (datum->type))))
{
@@ -843,8 +844,8 @@
}
}
}
- lastPrio = ntohl (datum->prio);
- lastExp = GNUNET_ntohll (datum->expirationTime);
+ lastPrio = ntohl (datum->priority);
+ lastExp = GNUNET_ntohll (datum->expiration_time);
GNUNET_free (datum);
}
sqlite3_finalize (stmt_1);
@@ -977,8 +978,8 @@
#if 0
printf ("IA-FOUND %4u prio %4u exp %20llu RID %llu old-RID: %llu\n",
(ntohl (datum->size) - sizeof (GNUNET_DatastoreValue)),
- ntohl (datum->prio),
- GNUNET_ntohll (datum->expirationTime), rowid, last_rowid);
+ ntohl (datum->priority),
+ GNUNET_ntohll (datum->expiration_time), rowid, last_rowid);
#endif
last_rowid = rowid;
sqlite3_reset (stmt);
@@ -1280,8 +1281,8 @@
GNUNET_hash_to_enc (key, &enc));
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));
+ ntohl (*(int *) &value[1]), &enc, ntohl (value->priority),
+ GNUNET_ntohll (value->expiration_time));
#endif
if ((ntohl (value->size) < sizeof (GNUNET_DatastoreValue)))
@@ -1291,9 +1292,9 @@
}
size = ntohl (value->size);
type = ntohl (value->type);
- prio = ntohl (value->prio);
- anon = ntohl (value->anonymityLevel);
- expir = GNUNET_ntohll (value->expirationTime);
+ prio = ntohl (value->priority);
+ anon = ntohl (value->anonymity_level);
+ expir = GNUNET_ntohll (value->expiration_time);
contentSize = size - sizeof (GNUNET_DatastoreValue);
GNUNET_hash (&value[1], contentSize, &vhash);
GNUNET_mutex_lock (lock);
@@ -1450,7 +1451,7 @@
}
lock = GNUNET_mutex_create (GNUNET_NO);
coreAPI = capi;
- stats = coreAPI->request_service ("stats");
+ stats = coreAPI->service_request ("stats");
if (stats)
stat_size = stats->create (gettext_noop ("# bytes in datastore"));
@@ -1474,7 +1475,7 @@
release_module_sqstore_sqlite ()
{
if (stats != NULL)
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
sqlite_shutdown ();
#if DEBUG_SQLITE
GNUNET_GE_LOG (ectx,
Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -41,9 +41,9 @@
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);
- value->expirationTime = GNUNET_htonll (now - i * GNUNET_CRON_SECONDS);
+ value->priority = htonl (i + 1);
+ value->anonymity_level = htonl (i);
+ value->expiration_time = GNUNET_htonll (now - i * GNUNET_CRON_SECONDS);
memset (&value[1], i, 8 * i);
return value;
}
@@ -66,8 +66,8 @@
{
/*
printf("Wanted: %u, %llu; got %u, %llu - %d\n",
- ntohl(value->size), GNUNET_ntohll(value->expirationTime),
- ntohl(val->size), GNUNET_ntohll(val->expirationTime),
+ ntohl(value->size), GNUNET_ntohll(value->expiration_time),
+ ntohl(val->size), GNUNET_ntohll(val->expiration_time),
memcmp(val, value, ntohl(val->size))); */
ret = GNUNET_SYSERR;
}
@@ -123,10 +123,11 @@
int id;
id = (*closure);
- if (id + 1 == ntohl (val->prio))
+ if (id + 1 == ntohl (val->priority))
return GNUNET_OK;
fprintf (stderr,
- "Wrong priority, wanted %u got %u\n", id + 1, ntohl (val->prio));
+ "Wrong priority, wanted %u got %u\n", id + 1,
+ ntohl (val->priority));
return GNUNET_SYSERR;
}
Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c 2008-03-25
03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c 2008-03-25
06:23:12 UTC (rev 6615)
@@ -141,9 +141,10 @@
value = GNUNET_malloc (size);
value->size = htonl (size);
value->type = htonl (i);
- value->prio = htonl (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 100));
- value->anonymityLevel = htonl (i);
- value->expirationTime =
+ value->priority =
+ htonl (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 100));
+ value->anonymity_level = htonl (i);
+ value->expiration_time =
GNUNET_htonll (GNUNET_get_time () +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 1000));
memset (&value[1], i, size - sizeof (GNUNET_DatastoreValue));
Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c 2008-03-25
03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c 2008-03-25
06:23:12 UTC (rev 6615)
@@ -75,9 +75,10 @@
value = GNUNET_malloc (size);
value->size = htonl (size);
value->type = htonl (i);
- value->prio = htonl (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 100));
- value->anonymityLevel = htonl (i);
- value->expirationTime =
+ value->priority =
+ htonl (GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 100));
+ value->anonymity_level = htonl (i);
+ value->expiration_time =
GNUNET_htonll (GNUNET_get_time () + 60 * GNUNET_CRON_HOURS +
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 1000));
memset (&value[1], i, size - sizeof (GNUNET_DatastoreValue));
Modified: GNUnet/src/applications/stats/sqstats.c
===================================================================
--- GNUnet/src/applications/stats/sqstats.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/stats/sqstats.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -85,7 +85,7 @@
data->stat_block[7]++;
break;
}
- switch (ntohl (value->anonymityLevel))
+ switch (ntohl (value->anonymity_level))
{
case 0:
data->stat_anon[0]++;
@@ -97,7 +97,7 @@
data->stat_anon[2]++;
break;
}
- switch (ntohl (value->prio))
+ switch (ntohl (value->priority))
{
case 0:
data->stat_prio[0]++;
@@ -109,7 +109,7 @@
data->stat_prio[2]++;
break;
}
- expire = GNUNET_ntohll (value->expirationTime);
+ expire = GNUNET_ntohll (value->expiration_time);
now = GNUNET_get_time ();
if (expire <= now)
data->stat_expire[0]++;
@@ -145,7 +145,7 @@
static int
init_sqstore_stats ()
{
- sq = myCoreAPI->request_service ("sqstore");
+ sq = myCoreAPI->service_request ("sqstore");
if (sq == NULL)
return GNUNET_SYSERR;
stat_block[0] = stats->create (gettext_noop ("# Any-Blocks"));
@@ -175,6 +175,6 @@
{
if (sq == NULL)
return;
- myCoreAPI->release_service (sq);
+ myCoreAPI->service_release (sq);
sq = NULL;
}
Modified: GNUnet/src/applications/stats/statistics.c
===================================================================
--- GNUnet/src/applications/stats/statistics.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/stats/statistics.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -265,7 +265,7 @@
if (load == -1)
load = 0;
statSet (stat_handle_network_load_down, load);
- statSet (stat_connected, coreAPI->forAllConnectedNodes (NULL, NULL));
+ statSet (stat_connected, coreAPI->p2p_connections_iterate (NULL, NULL));
#ifdef MINGW
statSet (stat_handles, plibc_get_handle_count ());
#endif
@@ -337,7 +337,7 @@
ntohs(statMsg->header.size),
start, end, statCounters); */
if (GNUNET_SYSERR ==
- coreAPI->cs_send_to_client (sock, &statMsg->header, GNUNET_YES))
+ coreAPI->cs_send_message (sock, &statMsg->header, GNUNET_YES))
break; /* abort, socket error! */
start = end;
}
@@ -365,8 +365,8 @@
cmsg = (CS_stats_get_supported_MESSAGE *) message;
type = ntohs (cmsg->type);
htype = ntohs (cmsg->handlerType);
- supported = coreAPI->p2p_test_handler_registered (type, htype);
- return coreAPI->sendValueToClient (sock, supported);
+ supported = coreAPI->p2p_message_handler_registered_test (type, htype);
+ return coreAPI->cs_send_value (sock, supported);
}
/**
@@ -386,8 +386,8 @@
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
}
- return coreAPI->sendValueToClient
- (client, coreAPI->forAllConnectedNodes (NULL, NULL));
+ return coreAPI->cs_send_value
+ (client, coreAPI->p2p_connections_iterate (NULL, NULL));
}
/**
@@ -407,7 +407,7 @@
{
GNUNET_GE_ASSERT (capi->ectx, myCoreAPI == NULL);
myCoreAPI = capi;
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
if (stats == NULL)
{
GNUNET_GE_BREAK (capi->ectx, 0);
@@ -423,18 +423,19 @@
GNUNET_CS_PROTO_STATS_GET_STATISTICS,
GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGE_SUPPORTED,
GNUNET_P2P_PROTO_NOISE);
- capi->registerClientHandler (GNUNET_CS_PROTO_STATS_GET_STATISTICS,
- &sendStatistics);
+ capi->cs_handler_register (GNUNET_CS_PROTO_STATS_GET_STATISTICS,
+ &sendStatistics);
capi->
- registerClientHandler
+ cs_handler_register
(GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGE_SUPPORTED,
&handleMessageSupported);
capi->
- registerClientHandler
+ cs_handler_register
(GNUNET_CS_PROTO_STATS_GET_CS_MESSAGE_SUPPORTED, &handleMessageSupported);
- capi->registerClientHandler (GNUNET_CS_PROTO_TRAFFIC_COUNT,
- &processGetConnectionCountRequest);
- capi->registerHandler (GNUNET_P2P_PROTO_NOISE, &processNoise);
+ capi->cs_handler_register (GNUNET_CS_PROTO_TRAFFIC_COUNT,
+ &processGetConnectionCountRequest);
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_NOISE,
+ &processNoise);
GNUNET_GE_ASSERT (capi->ectx,
0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
@@ -456,19 +457,20 @@
done_sqstore_stats ();
#endif
GNUNET_GE_ASSERT (NULL, myCoreAPI != NULL);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_STATS_GET_STATISTICS,
- &sendStatistics);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_STATS_GET_STATISTICS,
+ &sendStatistics);
coreAPI->
- unregisterClientHandler
+ cs_handler_unregister
(GNUNET_CS_PROTO_STATS_GET_P2P_MESSAGE_SUPPORTED,
&handleMessageSupported);
coreAPI->
- unregisterClientHandler
+ cs_handler_unregister
(GNUNET_CS_PROTO_STATS_GET_CS_MESSAGE_SUPPORTED, &handleMessageSupported);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_TRAFFIC_COUNT,
- &processGetConnectionCountRequest);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_NOISE, &processNoise);
- myCoreAPI->release_service (stats);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_TRAFFIC_COUNT,
+ &processGetConnectionCountRequest);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_NOISE,
+ &processNoise);
+ myCoreAPI->service_release (stats);
stats = NULL;
myCoreAPI = NULL;
return GNUNET_OK;
Modified: GNUnet/src/applications/tbench/tbench.c
===================================================================
--- GNUnet/src/applications/tbench/tbench.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/tbench/tbench.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -125,7 +125,7 @@
reply = GNUNET_malloc (ntohs (message->size));
memcpy (reply, message, ntohs (message->size));
reply->type = htons (GNUNET_P2P_PROTO_TBENCH_REPLY);
- coreAPI->unicast (sender, reply, ntohl (msg->priority), 0); /* no delay */
+ coreAPI->ciphertext_send (sender, reply, ntohl (msg->priority), 0); /* no
delay */
GNUNET_free (reply);
return GNUNET_OK;
}
@@ -314,7 +314,7 @@
"Sending message %u of size %u in iteration %u\n",
packetNum, size, iteration);
#endif
- coreAPI->unicast (&msg->receiverId, &p2p->header, ntohl
(msg->priority), 0); /* no delay */
+ coreAPI->ciphertext_send (&msg->receiverId, &p2p->header, ntohl
(msg->priority), 0); /* no delay */
if ((delay != 0) &&
(htonl (msg->trainSize) != 0) &&
(packetNum % htonl (msg->trainSize)) == 0)
@@ -384,7 +384,7 @@
reply.variance_loss = sum_variance_loss / (iterations - 1);
GNUNET_free (results);
results = NULL;
- return coreAPI->cs_send_to_client (client, &reply.header, GNUNET_YES);
+ return coreAPI->cs_send_message (client, &reply.header, GNUNET_YES);
}
/**
@@ -400,15 +400,17 @@
ectx = capi->ectx;
lock = GNUNET_mutex_create (GNUNET_NO);
coreAPI = capi;
- if (GNUNET_SYSERR == capi->registerHandler (GNUNET_P2P_PROTO_TBENCH_REPLY,
- &handleTBenchReply))
+ if (GNUNET_SYSERR ==
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_TBENCH_REPLY,
+ &handleTBenchReply))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerHandler (GNUNET_P2P_PROTO_TBENCH_REQUEST,
- &handleTBenchReq))
+ if (GNUNET_SYSERR ==
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_TBENCH_REQUEST,
+ &handleTBenchReq))
ok = GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_TBENCH_REQUEST,
- &csHandleTBenchRequest))
+ capi->cs_handler_register (GNUNET_CS_PROTO_TBENCH_REQUEST,
+ &csHandleTBenchRequest))
ok = GNUNET_SYSERR;
GNUNET_GE_ASSERT (capi->ectx,
@@ -425,12 +427,12 @@
void
done_module_tbench ()
{
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_TBENCH_REQUEST,
- &handleTBenchReq);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_TBENCH_REPLY,
- &handleTBenchReply);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_TBENCH_REQUEST,
- &csHandleTBenchRequest);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_TBENCH_REQUEST,
+ &handleTBenchReq);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_TBENCH_REPLY,
+ &handleTBenchReply);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_TBENCH_REQUEST,
+ &csHandleTBenchRequest);
GNUNET_mutex_destroy (lock);
lock = NULL;
coreAPI = NULL;
Modified: GNUnet/src/applications/template/template.c
===================================================================
--- GNUnet/src/applications/template/template.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/template/template.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -71,12 +71,14 @@
"template", GNUNET_CS_PROTO_MAX_USED,
GNUNET_P2P_PROTO_MAX_USED);
if (GNUNET_SYSERR ==
- capi->registerHandler (GNUNET_P2P_PROTO_MAX_USED, &handlep2pMSG))
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_MAX_USED,
+ &handlep2pMSG))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->cs_exit_handler_register (&clientExitHandler))
+ if (GNUNET_SYSERR ==
+ capi->cs_disconnect_handler_register (&clientExitHandler))
ok = GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_MAX_USED, &csHandle))
+ capi->cs_handler_register (GNUNET_CS_PROTO_MAX_USED, &csHandle))
ok = GNUNET_SYSERR;
return ok;
}
@@ -84,9 +86,10 @@
void
done_module_template ()
{
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_MAX_USED, &handlep2pMSG);
- coreAPI->cs_exit_handler_unregister (&clientExitHandler);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_MAX_USED, &csHandle);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_MAX_USED,
+ &handlep2pMSG);
+ coreAPI->cs_disconnect_handler_unregister (&clientExitHandler);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_MAX_USED, &csHandle);
GNUNET_mutex_destroy (lock);
coreAPI = NULL;
}
Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/topology_default/topology.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -134,16 +134,16 @@
{
IndexMatch *im = data;
- if (0 == memcmp (coreAPI->myIdentity, id, sizeof (GNUNET_PeerIdentity)))
+ if (0 == memcmp (coreAPI->my_identity, id, sizeof (GNUNET_PeerIdentity)))
return GNUNET_OK;
- if (coreAPI->connection_compute_index_of_peer (id) != im->index)
+ if (coreAPI->core_slot_index_get (id) != im->index)
return GNUNET_OK;
- if (GNUNET_OK == coreAPI->queryPeerStatus (id, NULL, NULL))
+ if (GNUNET_OK == coreAPI->p2p_connection_status_check (id, NULL, NULL))
return GNUNET_OK;
- if (GNUNET_YES == transport->isAvailable (proto))
+ if (GNUNET_YES == transport->test_available (proto))
{
im->matchCount++;
- im->costSelector += transport->getCost (proto);
+ im->costSelector += transport->cost_get (proto);
}
return GNUNET_OK;
}
@@ -162,15 +162,15 @@
{
IndexMatch *im = data;
- if (0 == memcmp (coreAPI->myIdentity, id, sizeof (GNUNET_PeerIdentity)))
+ if (0 == memcmp (coreAPI->my_identity, id, sizeof (GNUNET_PeerIdentity)))
return GNUNET_OK;
- if (coreAPI->connection_compute_index_of_peer (id) != im->index)
+ if (coreAPI->core_slot_index_get (id) != im->index)
return GNUNET_OK;
- if (GNUNET_OK == coreAPI->queryPeerStatus (id, NULL, NULL))
+ if (GNUNET_OK == coreAPI->p2p_connection_status_check (id, NULL, NULL))
return GNUNET_OK;
- if (GNUNET_YES == transport->isAvailable (proto))
+ if (GNUNET_YES == transport->test_available (proto))
{
- im->costSelector -= transport->getCost (proto);
+ im->costSelector -= transport->cost_get (proto);
if ((im->matchCount == 0) || (im->costSelector < 0))
{
im->match = *id;
@@ -220,17 +220,18 @@
if (indexMatch.costSelector > 0)
indexMatch.costSelector =
GNUNET_random_u64 (GNUNET_RANDOM_QUALITY_WEAK, indexMatch.costSelector);
- indexMatch.match = *(coreAPI->myIdentity);
+ indexMatch.match = *(coreAPI->my_identity);
identity->forEachHost (now, &scanHelperSelect, &indexMatch);
- if (0 == memcmp (coreAPI->myIdentity,
+ if (0 == memcmp (coreAPI->my_identity,
&indexMatch.match, sizeof (GNUNET_PeerIdentity)))
return; /* should happen really rarely */
- if (coreAPI->connection_compute_index_of_peer (&indexMatch.match) != index)
+ if (coreAPI->core_slot_index_get (&indexMatch.match) != index)
{
GNUNET_GE_BREAK (NULL, 0); /* should REALLY not happen */
return;
}
- if (GNUNET_OK == coreAPI->queryPeerStatus (&indexMatch.match, NULL, NULL))
+ if (GNUNET_OK ==
+ coreAPI->p2p_connection_status_check (&indexMatch.match, NULL, NULL))
{
GNUNET_GE_BREAK (NULL, 0); /* should REALLY not happen */
return;
@@ -248,7 +249,7 @@
#endif
if (GNUNET_NO == identity->isBlacklisted (&indexMatch.match, GNUNET_YES))
{
- coreAPI->unicast (&indexMatch.match, NULL, 0, 0);
+ coreAPI->ciphertext_send (&indexMatch.match, NULL, 0, 0);
identity->blacklistHost (&indexMatch.match, (unsigned int) (saturation *
5 * 60 * 60), /* 5 hours at full saturation */
GNUNET_NO);
}
@@ -274,7 +275,7 @@
"Received liveness confirmation from `%s'.\n", &enc);
#endif
- coreAPI->connection_mark_session_as_confirmed (hostId);
+ coreAPI->p2p_connection_confirm (hostId);
GNUNET_free (hostId);
}
@@ -294,8 +295,7 @@
if (ran != 0)
return;
now = GNUNET_get_time ();
- if (GNUNET_SYSERR ==
- coreAPI->connection_get_last_activity_of_peer (peer, &act))
+ if (GNUNET_SYSERR == coreAPI->p2p_connection_last_activity_get (peer, &act))
{
GNUNET_GE_BREAK (coreAPI->ectx, 0);
return; /* this should not happen... */
@@ -348,7 +348,7 @@
"GNUNETD",
"DISABLE-AUTOCONNECT",
GNUNET_NO);
- slotCount = coreAPI->connection_get_slot_count ();
+ slotCount = coreAPI->core_slots_count ();
if ((GNUNET_NO == autoconnect) && (saturation < 1))
{
if (saturation * MAX_PEERS_PER_SLOT >= 1)
@@ -360,11 +360,11 @@
if (GNUNET_random_u32
(GNUNET_RANDOM_QUALITY_WEAK, LIVE_SCAN_EFFECTIVENESS) != 0)
continue;
- if (minint > coreAPI->connection_is_slot_used (i))
+ if (minint > coreAPI->core_slot_test_used (i))
scanForHosts (i);
}
}
- active = coreAPI->forAllConnectedNodes (&checkNeedForPing, NULL);
+ active = coreAPI->p2p_connections_iterate (&checkNeedForPing, NULL);
saturation = 1.0 * active / slotCount;
}
@@ -374,7 +374,7 @@
unsigned int active;
unsigned int known;
- active = coreAPI->forAllConnectedNodes (NULL, NULL);
+ active = coreAPI->p2p_connections_iterate (NULL, NULL);
if (active == 0)
return 0;
known = identity->forEachHost (0, NULL, NULL);
@@ -444,14 +444,15 @@
core_wrapper (GNUNET_NodeIteratorCallback callback,
void *cb_arg, void *unused)
{
- return coreAPI->forAllConnectedNodes (callback, cb_arg);
+ return coreAPI->p2p_connections_iterate (callback, cb_arg);
}
static int
allowConnection (const GNUNET_PeerIdentity * peer)
{
- if ((coreAPI->myIdentity != NULL) &&
- (0 == memcmp (coreAPI->myIdentity, peer, sizeof (GNUNET_PeerIdentity))))
+ if ((coreAPI->my_identity != NULL) &&
+ (0 ==
+ memcmp (coreAPI->my_identity, peer, sizeof (GNUNET_PeerIdentity))))
return GNUNET_SYSERR; /* disallow connections to self */
if (is_friend (peer))
return GNUNET_OK;
@@ -596,8 +597,7 @@
("Fewer friends specified than required by minimum
friend count. Will only connect to friends.\n"));
}
if ((minimum_friend_count >
- coreAPI->connection_get_slot_count ())
- && (friends_only == GNUNET_NO))
+ coreAPI->core_slots_count ()) && (friends_only == GNUNET_NO))
{
GNUNET_GE_LOG (ectx,
GNUNET_GE_WARNING | GNUNET_GE_BULK | GNUNET_GE_USER,
@@ -617,27 +617,27 @@
static GNUNET_Topology_ServiceAPI api;
coreAPI = capi;
- identity = capi->request_service ("identity");
+ identity = capi->service_request ("identity");
if (identity == NULL)
{
GNUNET_GE_BREAK (capi->ectx, 0);
return NULL;
}
- transport = capi->request_service ("transport");
+ transport = capi->service_request ("transport");
if (transport == NULL)
{
GNUNET_GE_BREAK (capi->ectx, 0);
- capi->release_service (identity);
+ capi->service_release (identity);
identity = NULL;
return NULL;
}
- pingpong = capi->request_service ("pingpong");
+ pingpong = capi->service_request ("pingpong");
if (pingpong == NULL)
{
GNUNET_GE_BREAK (capi->ectx, 0);
- capi->release_service (identity);
+ capi->service_release (identity);
identity = NULL;
- capi->release_service (transport);
+ capi->service_release (transport);
transport = NULL;
return NULL;
}
@@ -645,11 +645,11 @@
&rereadConfiguration, NULL))
{
GNUNET_GE_BREAK (coreAPI->ectx, 0);
- capi->release_service (identity);
+ capi->service_release (identity);
identity = NULL;
- capi->release_service (transport);
+ capi->service_release (transport);
transport = NULL;
- capi->release_service (pingpong);
+ capi->service_release (pingpong);
pingpong = NULL;
return NULL;
}
@@ -670,11 +670,11 @@
GNUNET_cron_del_job (coreAPI->cron, &cronCheckLiveness, LIVE_SCAN_FREQUENCY,
NULL);
GNUNET_GC_detach_change_listener (coreAPI->cfg, &rereadConfiguration, NULL);
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
- coreAPI->release_service (transport);
+ coreAPI->service_release (transport);
transport = NULL;
- coreAPI->release_service (pingpong);
+ coreAPI->service_release (pingpong);
pingpong = NULL;
coreAPI = NULL;
GNUNET_array_grow (friends, friendCount, 0);
@@ -687,10 +687,10 @@
void
update_module_topology_default (GNUNET_UpdateAPI * uapi)
{
- uapi->updateModule ("state");
- uapi->updateModule ("identity");
- uapi->updateModule ("transport");
- uapi->updateModule ("pingpong");
+ uapi->service_update ("state");
+ uapi->service_update ("identity");
+ uapi->service_update ("transport");
+ uapi->service_update ("pingpong");
}
static GNUNET_CoreAPIForPlugins *myCapi;
@@ -701,7 +701,7 @@
initialize_module_topology_default (GNUNET_CoreAPIForPlugins * capi)
{
myCapi = capi;
- myTopology = capi->request_service ("topology");
+ myTopology = capi->service_request ("topology");
GNUNET_GE_ASSERT (capi->ectx, myTopology != NULL);
GNUNET_GE_ASSERT (capi->ectx,
0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
@@ -716,7 +716,7 @@
void
done_module_topology_default ()
{
- myCapi->release_service (myTopology);
+ myCapi->service_release (myTopology);
myCapi = NULL;
myTopology = NULL;
}
Modified: GNUnet/src/applications/tracekit/tracekit.c
===================================================================
--- GNUnet/src/applications/tracekit/tracekit.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/tracekit/tracekit.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -105,7 +105,7 @@
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
"TRACEKIT: found matching entry in routing table\n");
#endif
- if (0 == memcmp (coreAPI->myIdentity,
+ if (0 == memcmp (coreAPI->my_identity,
&rte->replyTo, sizeof (GNUNET_HashCode)))
{
idx = ntohl (reply->clientId);
@@ -128,8 +128,8 @@
csReply->responderId = reply->responderId;
memcpy (&csReply[1],
&reply[1], hostCount * sizeof (GNUNET_PeerIdentity));
- coreAPI->cs_send_to_client (clients[idx],
- &csReply->header, GNUNET_YES);
+ coreAPI->cs_send_message (clients[idx],
+ &csReply->header, GNUNET_YES);
GNUNET_free (csReply);
}
else
@@ -141,7 +141,8 @@
GNUNET_GE_USER,
"TRACEKIT: forwarding to next hop `%s'\n", &enc);
#endif
- coreAPI->unicast (&rte->replyTo, message, rte->priority, 0);
+ coreAPI->ciphertext_send (&rte->replyTo, message, rte->priority,
+ 0);
}
}
}
@@ -169,7 +170,8 @@
if ((0 != memcmp (id, &ttc->pro->initiatorId, sizeof (GNUNET_PeerIdentity)))
&& (0 != memcmp (id, &ttc->sender, sizeof (GNUNET_PeerIdentity))))
- coreAPI->unicast (id, &ttc->pro->header, ntohl (ttc->pro->priority), 0);
+ coreAPI->ciphertext_send (id, &ttc->pro->header,
+ ntohl (ttc->pro->priority), 0);
}
typedef struct
@@ -286,13 +288,13 @@
amsg.hopsToGo = htonl (hops - 1);
ttc.pro = &amsg;
ttc.sender = sender;
- coreAPI->forAllConnectedNodes (&transmit, &ttc);
+ coreAPI->p2p_connections_iterate (&transmit, &ttc);
}
/* build local reply */
closure.peers = NULL;
closure.max = 0;
closure.pos = 0;
- coreAPI->forAllConnectedNodes (&getPeerCallback, &closure);
+ coreAPI->p2p_connections_iterate (&getPeerCallback, &closure);
while (closure.pos > 0)
{
count = closure.pos;
@@ -305,17 +307,18 @@
reply->header.size = htons (size);
reply->header.type = htons (GNUNET_P2P_PROTO_TRACEKIT_REPLY);
reply->initiatorId = msg->initiatorId;
- reply->responderId = *(coreAPI->myIdentity);
+ reply->responderId = *(coreAPI->my_identity);
reply->initiatorTimestamp = msg->timestamp;
reply->clientId = msg->clientId;
memcpy (&reply[1],
&closure.peers[closure.pos - count],
count * sizeof (GNUNET_PeerIdentity));
- if (0 == memcmp (&coreAPI->myIdentity->hashPubKey,
+ if (0 == memcmp (&coreAPI->my_identity->hashPubKey,
&sender->hashPubKey, sizeof (GNUNET_HashCode)))
- handlep2pReply (coreAPI->myIdentity, &reply->header);
+ handlep2pReply (coreAPI->my_identity, &reply->header);
else
- coreAPI->unicast (sender, &reply->header, ntohl (msg->priority), 0);
+ coreAPI->ciphertext_send (sender, &reply->header,
+ ntohl (msg->priority), 0);
closure.pos -= count;
GNUNET_free (reply);
}
@@ -371,9 +374,9 @@
p2pProbe.hopsToGo = csProbe->hops;
p2pProbe.timestamp = htonl (GNUNET_get_time_int32 (NULL));
p2pProbe.priority = csProbe->priority;
- memcpy (&p2pProbe.initiatorId, coreAPI->myIdentity,
+ memcpy (&p2pProbe.initiatorId, coreAPI->my_identity,
sizeof (GNUNET_PeerIdentity));
- handlep2pProbe (coreAPI->myIdentity, &p2pProbe.header); /* FIRST send
to myself! */
+ handlep2pProbe (coreAPI->my_identity, &p2pProbe.header); /* FIRST send
to myself! */
return GNUNET_OK;
}
@@ -413,17 +416,20 @@
GNUNET_P2P_PROTO_TRACEKIT_PROBE,
GNUNET_P2P_PROTO_TRACEKIT_REPLY,
GNUNET_CS_PROTO_TRACEKIT_PROBE);
- if (GNUNET_SYSERR == capi->registerHandler (GNUNET_P2P_PROTO_TRACEKIT_PROBE,
- &handlep2pProbe))
+ if (GNUNET_SYSERR ==
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_TRACEKIT_PROBE,
+ &handlep2pProbe))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->registerHandler (GNUNET_P2P_PROTO_TRACEKIT_REPLY,
- &handlep2pReply))
+ if (GNUNET_SYSERR ==
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_TRACEKIT_REPLY,
+ &handlep2pReply))
ok = GNUNET_SYSERR;
- if (GNUNET_SYSERR == capi->cs_exit_handler_register (&clientExitHandler))
+ if (GNUNET_SYSERR ==
+ capi->cs_disconnect_handler_register (&clientExitHandler))
ok = GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_TRACEKIT_PROBE,
- (GNUNET_ClientRequestHandler) & csHandle))
+ capi->cs_handler_register (GNUNET_CS_PROTO_TRACEKIT_PROBE,
+ (GNUNET_ClientRequestHandler) & csHandle))
ok = GNUNET_SYSERR;
GNUNET_GE_ASSERT (capi->ectx,
0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
@@ -438,13 +444,12 @@
void
done_module_tracekit ()
{
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_TRACEKIT_PROBE,
- &handlep2pProbe);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_TRACEKIT_REPLY,
- &handlep2pReply);
- coreAPI->cs_exit_handler_unregister (&clientExitHandler);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_TRACEKIT_PROBE,
- &csHandle);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_TRACEKIT_PROBE,
+ &handlep2pProbe);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_TRACEKIT_REPLY,
+ &handlep2pReply);
+ coreAPI->cs_disconnect_handler_unregister (&clientExitHandler);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_TRACEKIT_PROBE, &csHandle);
GNUNET_array_grow (clients, clientCount, 0);
GNUNET_mutex_destroy (lock);
lock = NULL;
Modified: GNUnet/src/applications/traffic/traffic.c
===================================================================
--- GNUnet/src/applications/traffic/traffic.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/applications/traffic/traffic.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -347,7 +347,7 @@
return GNUNET_SYSERR;
msg = (const CS_traffic_request_MESSAGE *) message;
reply = buildReply (ntohl (msg->timePeriod));
- ret = coreAPI->cs_send_to_client (sock, &reply->header, GNUNET_YES);
+ ret = coreAPI->cs_send_message (sock, &reply->header, GNUNET_YES);
GNUNET_free (reply);
return ret;
}
@@ -583,17 +583,17 @@
api.get = &getTrafficStats;
for (i = 0; i < GNUNET_P2P_PROTO_MAX_USED; i++)
stat_traffic_transmitted_by_type[i] = 0;
- coreAPI->connection_register_send_notification_callback (&trafficSend);
+ coreAPI->peer_send_notification_register (&trafficSend);
for (i = 0; i < GNUNET_P2P_PROTO_MAX_USED; i++)
{
stat_traffic_received_by_type[i] = 0;
- coreAPI->registerHandler (i, &trafficReceive);
- coreAPI->plaintext_register_handler (i, &plaintextReceive);
+ coreAPI->p2p_ciphertext_handler_register (i, &trafficReceive);
+ coreAPI->p2p_plaintext_handler_register (i, &plaintextReceive);
}
GNUNET_GE_ASSERT (coreAPI->ectx, counters == NULL);
lock = GNUNET_mutex_create (GNUNET_NO);
- stats = capi->request_service ("stats");
+ stats = capi->service_request ("stats");
return &api;
}
@@ -607,11 +607,11 @@
for (i = 0; i < GNUNET_P2P_PROTO_MAX_USED; i++)
{
- coreAPI->unregisterHandler (i, &trafficReceive);
- coreAPI->plaintext_unregister_handler (i, &plaintextReceive);
+ coreAPI->p2p_ciphertext_handler_unregister (i, &trafficReceive);
+ coreAPI->p2p_plaintext_handler_unregister (i, &plaintextReceive);
}
- coreAPI->connection_unregister_send_notification_callback (&trafficSend);
- coreAPI->release_service (stats);
+ coreAPI->peer_send_notification_unregister (&trafficSend);
+ coreAPI->service_release (stats);
stats = NULL;
for (i = 0; i < max_message_type; i++)
GNUNET_free_non_null (counters[i]);
@@ -634,15 +634,15 @@
{
GNUNET_GE_ASSERT (capi->ectx, myCoreAPI == NULL);
myCoreAPI = capi;
- myApi = capi->request_service ("traffic");
+ myApi = capi->service_request ("traffic");
if (myApi == NULL)
{
GNUNET_GE_BREAK (capi->ectx, 0);
myCoreAPI = NULL;
return GNUNET_SYSERR;
}
- capi->registerClientHandler (GNUNET_CS_PROTO_TRAFFIC_QUERY,
- &trafficQueryHandler);
+ capi->cs_handler_register (GNUNET_CS_PROTO_TRAFFIC_QUERY,
+ &trafficQueryHandler);
GNUNET_GE_ASSERT (capi->ectx,
0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
@@ -663,9 +663,9 @@
GNUNET_GE_ASSERT (myCoreAPI->ectx,
GNUNET_SYSERR !=
myCoreAPI->
- unregisterClientHandler (GNUNET_CS_PROTO_TRAFFIC_QUERY,
- &trafficQueryHandler));
- myCoreAPI->release_service (myApi);
+ cs_handler_unregister (GNUNET_CS_PROTO_TRAFFIC_QUERY,
+ &trafficQueryHandler));
+ myCoreAPI->service_release (myApi);
myApi = NULL;
myCoreAPI = NULL;
}
Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/applications/transport/transport.c 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -110,7 +110,7 @@
GNUNET_TransportAPI *tapi = cls;
GNUNET_mutex_lock (tapis_lock);
GNUNET_free_non_null (tapi->hello);
- tapi->hello = tapi->createhello ();
+ tapi->hello = tapi->hello_create ();
if (NULL == tapi->hello)
{
GNUNET_mutex_unlock (tapis_lock);
@@ -119,8 +119,8 @@
memcpy (&tapi->hello->publicKey,
identity->getPublicPrivateKey (), sizeof (GNUNET_RSA_PublicKey));
memcpy (&tapi->hello->senderIdentity,
- coreAPI->myIdentity, sizeof (GNUNET_PeerIdentity));
- tapi->hello->expirationTime =
+ coreAPI->my_identity, sizeof (GNUNET_PeerIdentity));
+ tapi->hello->expiration_time =
htonl (GNUNET_get_time_int32 (NULL) + hello_live);
tapi->hello->header.type = htons (GNUNET_P2P_PROTO_HELLO);
tapi->hello->header.size = htons (GNUNET_sizeof_hello (tapi->hello));
@@ -159,14 +159,14 @@
static int
addTransport (GNUNET_TransportAPI * tapi)
{
- if (tapi->protocolNumber >= tapis_count)
- GNUNET_array_grow (tapis, tapis_count, tapi->protocolNumber + 1);
- if (tapis[tapi->protocolNumber] != NULL)
+ if (tapi->protocol_number >= tapis_count)
+ GNUNET_array_grow (tapis, tapis_count, tapi->protocol_number + 1);
+ if (tapis[tapi->protocol_number] != NULL)
{
GNUNET_GE_BREAK (ectx, 0);
return GNUNET_SYSERR;
}
- tapis[tapi->protocolNumber] = tapi;
+ tapis[tapi->protocol_number] = tapi;
tapi->hello = NULL;
GNUNET_cron_add_job (coreAPI->cron,
&createSignedhello,
@@ -193,7 +193,7 @@
ntohs (hello->protocol));
return GNUNET_SYSERR;
}
- return tapis[prot]->helloToAddress (hello, sa, sa_len);
+ return tapis[prot]->hello_to_address (hello, sa, sa_len);
}
/**
@@ -448,7 +448,7 @@
prot = ntohs (hello->protocol);
if ((prot >= tapis_count) || (tapis[prot] == NULL))
return GNUNET_SYSERR; /* not supported */
- return tapis[prot]->verifyHello (hello);
+ return tapis[prot]->hello_verify (hello);
}
/**
@@ -591,7 +591,7 @@
GNUNET_MessageHello *hello;
createSignedhello (tapi);
- hello = transportCreatehello (tapi->protocolNumber);
+ hello = transportCreatehello (tapi->protocol_number);
if (NULL != hello)
{
identity->addHost (hello);
@@ -617,14 +617,14 @@
doneHelper (tapis[i], NULL);
GNUNET_cron_del_job (coreAPI->cron,
&createSignedhello, HELLO_RECREATE_FREQ, tapis[i]);
- ptr = GNUNET_plugin_resolve_function (tapis[i]->libHandle,
+ ptr = GNUNET_plugin_resolve_function (tapis[i]->library_handle,
"donetransport_", GNUNET_NO);
if (ptr != NULL)
ptr ();
- GNUNET_free (tapis[i]->transName);
+ GNUNET_free (tapis[i]->transport_name);
GNUNET_free_non_null (tapis[i]->hello);
tapis[i]->hello = NULL;
- GNUNET_plugin_unload (tapis[i]->libHandle);
+ GNUNET_plugin_unload (tapis[i]->library_handle);
tapis[i] = NULL;
}
@@ -642,7 +642,7 @@
for (i = 0; i < tapis_count; i++)
if (tapis[i] != NULL)
{
- if (GNUNET_OK != tapis[i]->startTransportServer ())
+ if (GNUNET_OK != tapis[i]->server_start ())
unloadTransport (i);
}
}
@@ -657,7 +657,7 @@
for (i = 0; i < tapis_count; i++)
if (tapis[i] != NULL)
- tapis[i]->stopTransportServer ();
+ tapis[i]->server_stop ();
ctapi.receive = NULL;
}
@@ -694,7 +694,7 @@
return GNUNET_SYSERR;
if ((tsession->ttype >= tapis_count) || (tapis[tsession->ttype] == NULL))
return GNUNET_SYSERR;
- return tapis[tsession->ttype]->testWouldTry (tsession, size, important);
+ return tapis[tsession->ttype]->send_now_test (tsession, size, important);
}
/**
@@ -723,7 +723,7 @@
hello_live *= 60;
GNUNET_GE_ASSERT (ectx, sizeof (GNUNET_MessageHello) == 600);
- identity = capi->request_service ("identity");
+ identity = capi->service_request ("identity");
if (identity == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
@@ -731,16 +731,15 @@
}
coreAPI = capi;
ctapi.version = 1;
- ctapi.myIdentity = coreAPI->myIdentity;
+ ctapi.my_identity = coreAPI->my_identity;
ctapi.ectx = coreAPI->ectx;
ctapi.cfg = coreAPI->cfg;
ctapi.load_monitor = coreAPI->load_monitor;
ctapi.cron = coreAPI->cron;
ctapi.receive = NULL; /* initialized LATER! */
- ctapi.request_service = coreAPI->request_service;
- ctapi.release_service = coreAPI->release_service;
- ctapi.connection_assert_tsession_unused =
- coreAPI->connection_assert_tsession_unused;
+ ctapi.service_request = coreAPI->service_request;
+ ctapi.service_release = coreAPI->service_release;
+ ctapi.tsession_assert_unused = coreAPI->tsession_assert_unused;
GNUNET_array_grow (tapis, tapis_count,
GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP + 1);
@@ -805,13 +804,13 @@
GNUNET_plugin_unload (lib);
continue;
}
- tapi->libHandle = lib;
- tapi->transName = GNUNET_strdup (pos);
+ tapi->library_handle = lib;
+ tapi->transport_name = GNUNET_strdup (pos);
if (GNUNET_OK != addTransport (tapi))
{
void (*ptr) ();
- GNUNET_free (tapi->transName);
+ GNUNET_free (tapi->transport_name);
ptr =
GNUNET_plugin_resolve_function (lib, "donetransport_",
GNUNET_NO);
@@ -832,7 +831,7 @@
IF_GELOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
- GNUNET_hash_to_enc (&coreAPI->myIdentity->hashPubKey, &myself));
+ GNUNET_hash_to_enc (&coreAPI->my_identity->hashPubKey, &myself));
GNUNET_GE_LOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("I am peer `%s'.\n"), &myself);
@@ -840,22 +839,22 @@
ret.start = &startTransports;
ret.stop = &stopTransports;
- ret.isAvailable = &isTransportAvailable;
+ ret.test_available = &isTransportAvailable;
ret.add = &addTransport;
- ret.forEach = &forEachTransport;
+ ret.iterate_available = &forEachTransport;
ret.connect = &transportConnect;
- ret.connectFreely = &transportConnectFreely;
+ ret.connect_freely = &transportConnectFreely;
ret.associate = &transportAssociate;
- ret.getCost = &transportGetCost;
+ ret.cost_get = &transportGetCost;
ret.send = &transportSend;
ret.disconnect = &transportDisconnect;
- ret.verifyhello = &transportVerifyHello;
- ret.helloToAddress = &helloToAddress;
- ret.getMTU = &transportGetMTU;
- ret.createhello = &transportCreatehello;
- ret.getAdvertisedhellos = &getAdvertisedhellos;
- ret.testWouldTry = &testWouldTry;
- ret.assertAssociated = &assertAssociated;
+ ret.hello_verify = &transportVerifyHello;
+ ret.hello_to_address = &helloToAddress;
+ ret.mtu_get = &transportGetMTU;
+ ret.hello_create = &transportCreatehello;
+ ret.hello_advertisements_get = &getAdvertisedhellos;
+ ret.send_now_test = &testWouldTry;
+ ret.assert_associated = &assertAssociated;
return &ret;
}
@@ -878,7 +877,7 @@
tapis_lock = NULL;
GNUNET_array_grow (tapis, tapis_count, 0);
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
coreAPI = NULL;
return GNUNET_OK;
Modified: GNUnet/src/applications/vpn/cs.c
===================================================================
--- GNUnet/src/applications/vpn/cs.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/vpn/cs.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -53,7 +53,7 @@
{
b->type = htons (t);
b->size = htons (sizeof (GNUNET_MessageHeader) + size);
- coreAPI->cs_send_to_client (c, b, GNUNET_YES);
+ coreAPI->cs_send_message (c, b, GNUNET_YES);
}
GNUNET_free (b);
}
@@ -84,7 +84,7 @@
int i;
GNUNET_mutex_lock (lock);
- id2ip (c, coreAPI->myIdentity);
+ id2ip (c, coreAPI->my_identity);
cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "::/48 This Node\n");
for (i = 0; i < entries1; i++)
{
@@ -183,8 +183,8 @@
(store1 + i)->route_entry, i);
id2ip (c, &((store1 + i)->peer));
cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, "\n");
- coreAPI->unicast (&((store1 + i)->peer), rgp,
- GNUNET_EXTREME_PRIORITY, 60);
+ coreAPI->ciphertext_send (&((store1 + i)->peer), rgp,
+ GNUNET_EXTREME_PRIORITY, 60);
GNUNET_free (rgp);
}
GNUNET_mutex_unlock (lock);
@@ -270,8 +270,8 @@
rgp->type = htons (GNUNET_P2P_PROTO_AIP_GETROUTE);
rgp->size = htons (sizeof (GNUNET_MessageHeader) + sizeof (int));
*((int *) &rgp[1]) = 0;
- coreAPI->unicast (&id, rgp, GNUNET_EXTREME_PRIORITY,
- 4 * GNUNET_CRON_MILLISECONDS);
+ coreAPI->ciphertext_send (&id, rgp, GNUNET_EXTREME_PRIORITY,
+ 4 * GNUNET_CRON_MILLISECONDS);
cprintf (c, GNUNET_CS_PROTO_VPN_REPLY, " Sent");
GNUNET_free (rgp);
}
@@ -284,28 +284,27 @@
GNUNET_VPN_cs_handler_init (GNUNET_CoreAPIForPlugins * capi)
{
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_VPN_TUNNELS,
- &cs_handle_vpn_tunnels))
+ capi->cs_handler_register (GNUNET_CS_PROTO_VPN_TUNNELS,
+ &cs_handle_vpn_tunnels))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_VPN_ROUTES,
- &cs_handle_vpn_routes))
+ capi->cs_handler_register (GNUNET_CS_PROTO_VPN_ROUTES,
+ &cs_handle_vpn_routes))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_VPN_REALISED,
- &cs_handle_vpn_realised))
+ capi->cs_handler_register (GNUNET_CS_PROTO_VPN_REALISED,
+ &cs_handle_vpn_realised))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_VPN_RESET,
- &cs_handle_vpn_reset))
+ capi->cs_handler_register (GNUNET_CS_PROTO_VPN_RESET,
+ &cs_handle_vpn_reset))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_VPN_TRUST,
- &cs_handle_vpn_trust))
+ capi->cs_handler_register (GNUNET_CS_PROTO_VPN_TRUST,
+ &cs_handle_vpn_trust))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerClientHandler (GNUNET_CS_PROTO_VPN_ADD,
- &cs_handle_vpn_add))
+ capi->cs_handler_register (GNUNET_CS_PROTO_VPN_ADD, &cs_handle_vpn_add))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -313,18 +312,18 @@
int
GNUNET_VPN_cs_handler_done ()
{
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_TUNNELS,
- &cs_handle_vpn_tunnels);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_ROUTES,
- &cs_handle_vpn_routes);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_REALISED,
- &cs_handle_vpn_realised);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_RESET,
- &cs_handle_vpn_reset);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_TRUST,
- &cs_handle_vpn_trust);
- coreAPI->unregisterClientHandler (GNUNET_CS_PROTO_VPN_ADD,
- &cs_handle_vpn_add);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_VPN_TUNNELS,
+ &cs_handle_vpn_tunnels);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_VPN_ROUTES,
+ &cs_handle_vpn_routes);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_VPN_REALISED,
+ &cs_handle_vpn_realised);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_VPN_RESET,
+ &cs_handle_vpn_reset);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_VPN_TRUST,
+ &cs_handle_vpn_trust);
+ coreAPI->cs_handler_unregister (GNUNET_CS_PROTO_VPN_ADD,
+ &cs_handle_vpn_add);
return GNUNET_OK;
}
Modified: GNUnet/src/applications/vpn/p2p.c
===================================================================
--- GNUnet/src/applications/vpn/p2p.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/vpn/p2p.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -123,7 +123,8 @@
write (fd, tp,
ntohs (gp->size) + sizeof (struct tun_pi) -
sizeof (GNUNET_MessageHeader));
- coreAPI->preferTrafficFrom (&((store1 + i)->peer), 1000);
+ coreAPI->p2p_connection_preference_increase (&((store1 + i)->peer),
+ 1000);
GNUNET_mutex_unlock (lock);
return GNUNET_OK;
}
@@ -207,7 +208,7 @@
("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, GNUNET_EXTREME_PRIORITY, 15);
+ coreAPI->ciphertext_send (sender, rgp, GNUNET_EXTREME_PRIORITY, 15);
GNUNET_free (rgp);
return GNUNET_OK;
}
@@ -219,7 +220,7 @@
rgp->type = htons (GNUNET_P2P_PROTO_AIP_ROUTES);
*((int *) (rgp + 1)) = htonl (realised_entries);
GNUNET_mutex_unlock (lock);
- coreAPI->unicast (sender, rgp, GNUNET_EXTREME_PRIORITY, 15);
+ coreAPI->ciphertext_send (sender, rgp, GNUNET_EXTREME_PRIORITY, 15);
GNUNET_free (rgp);
return GNUNET_OK;
}
@@ -271,8 +272,8 @@
GNUNET_GE_ADMIN,
_("Request level %d from peer %d\n"),
(store1 + i)->route_entry, i);
- coreAPI->unicast (&((store1 + i)->peer), rgp,
- GNUNET_EXTREME_PRIORITY, 60);
+ coreAPI->ciphertext_send (&((store1 + i)->peer), rgp,
+ GNUNET_EXTREME_PRIORITY, 60);
GNUNET_free (rgp);
}
break;
@@ -318,25 +319,28 @@
GNUNET_VPN_p2p_handler_init (GNUNET_CoreAPIForPlugins * capi)
{
if (GNUNET_SYSERR ==
- capi->registerHandler (GNUNET_P2P_PROTO_AIP_IP, &p2p_handle_vpn_aip_ip))
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_AIP_IP,
+ &p2p_handle_vpn_aip_ip))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerHandler (GNUNET_P2P_PROTO_AIP_GETROUTE,
- &p2p_handle_vpn_aip_getroute))
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_AIP_GETROUTE,
+ &p2p_handle_vpn_aip_getroute))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerHandler (GNUNET_P2P_PROTO_AIP_ROUTE,
- &p2p_handle_vpn_aip_route))
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_AIP_ROUTE,
+ &p2p_handle_vpn_aip_route))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerHandler (GNUNET_P2P_PROTO_AIP_ROUTES,
- &p2p_handle_vpn_aip_routes))
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_AIP_ROUTES,
+ &p2p_handle_vpn_aip_routes))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerHandler (GNUNET_P2P_PROTO_PONG, &p2p_handle_pong))
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_PONG,
+ &p2p_handle_pong))
return GNUNET_SYSERR;
if (GNUNET_SYSERR ==
- capi->registerHandler (GNUNET_P2P_PROTO_HANG_UP, &p2p_handle_hang_up))
+ capi->p2p_ciphertext_handler_register (GNUNET_P2P_PROTO_HANG_UP,
+ &p2p_handle_hang_up))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -344,16 +348,18 @@
int
GNUNET_VPN_p2p_handler_done ()
{
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_AIP_IP,
- &p2p_handle_vpn_aip_ip);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_AIP_GETROUTE,
- &p2p_handle_vpn_aip_getroute);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_AIP_ROUTE,
- &p2p_handle_vpn_aip_route);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_AIP_ROUTES,
- &p2p_handle_vpn_aip_routes);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_PONG, &p2p_handle_pong);
- coreAPI->unregisterHandler (GNUNET_P2P_PROTO_HANG_UP, &p2p_handle_hang_up);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_AIP_IP,
+ &p2p_handle_vpn_aip_ip);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_AIP_GETROUTE,
+ &p2p_handle_vpn_aip_getroute);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_AIP_ROUTE,
+ &p2p_handle_vpn_aip_route);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_AIP_ROUTES,
+ &p2p_handle_vpn_aip_routes);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_PONG,
+ &p2p_handle_pong);
+ coreAPI->p2p_ciphertext_handler_unregister (GNUNET_P2P_PROTO_HANG_UP,
+ &p2p_handle_hang_up);
return GNUNET_OK;
}
Modified: GNUnet/src/applications/vpn/vpn.c
===================================================================
--- GNUnet/src/applications/vpn/vpn.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/applications/vpn/vpn.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -433,7 +433,7 @@
(store1 + n)->ifindex = ifr.ifr_ifindex;
ifr6.ifr6_prefixlen = 64;
ifr6.ifr6_ifindex = ifr.ifr_ifindex;
- id2net (&ifr6.ifr6_addr, coreAPI->myIdentity);
+ id2net (&ifr6.ifr6_addr, coreAPI->my_identity);
ifr6.ifr6_addr.s6_addr16[3] = htons (n + VC_START);
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_DEVELOPER |
@@ -540,9 +540,9 @@
/* make new thread...
* repeat {
- * call forAllConnectedNodes, create/destroy tunnels to match connected
peers, 1 per peer.
+ * call p2p_connections_iterate, create/destroy tunnels to match connected
peers, 1 per peer.
* Give new tunnels their IPv6 addresses like "ifconfig gnu0 add
fdXX:XXXX:XXXX::/48"
- * SELECT for incoming packets, unicast those thru gnunet, or (pipe activity
= exit this thread) or timeout.
+ * SELECT for incoming packets, ciphertext_send those thru gnunet, or (pipe
activity = exit this thread) or timeout.
* }
* own IPv6 addr is fdXX:XXXX:XXXX::P/48 where X= 40 bits own key, P = gnu0 + 2
* route add -net fdXX(remote key) dev gnu0 is then used.
@@ -643,9 +643,11 @@
gp->size =
htons (sizeof (GNUNET_MessageHeader) + ret -
sizeof (struct tun_pi));
- coreAPI->unicast (&((store1 + i)->peer), gp,
- GNUNET_EXTREME_PRIORITY, 1);
- coreAPI->preferTrafficFrom (&((store1 + i)->peer), 1000);
+ coreAPI->ciphertext_send (&((store1 + i)->peer), gp,
+ GNUNET_EXTREME_PRIORITY, 1);
+ coreAPI->
+ p2p_connection_preference_increase (&((store1 + i)->peer),
+ 1000);
}
}
/* we do this here as we get a race if the p2p handler tries it */
@@ -899,7 +901,7 @@
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]);
+ capi->my_identity->hashPubKey.bits[0]);
/* core calls us to receive messages */
/* get a PONG = peer is online */
@@ -907,9 +909,9 @@
GNUNET_VPN_p2p_handler_init (capi);
GNUNET_VPN_cs_handler_init (capi);
- identity = coreAPI->request_service ("identity");
+ identity = coreAPI->service_request ("identity");
GNUNET_GE_ASSERT (ectx, identity != NULL);
- session = coreAPI->request_service ("session");
+ session = coreAPI->service_request ("session");
GNUNET_GE_ASSERT (ectx, session != NULL);
@@ -930,7 +932,7 @@
&realise,
5 * GNUNET_CRON_MINUTES,
5 * GNUNET_CRON_MINUTES, NULL);
- /* use capi->unicast to send messages to connected peers */
+ /* use capi->ciphertext_send to send messages to connected peers */
GNUNET_GE_ASSERT (capi->ectx,
0 == GNUNET_GC_set_configuration_value_string (capi->cfg,
capi->ectx,
@@ -975,9 +977,9 @@
GNUNET_GE_LOG (ectx, GNUNET_GE_INFO | GNUNET_GE_REQUEST | GNUNET_GE_USER,
_("RFC4193 The tun thread has ended\n"));
- coreAPI->release_service (identity);
+ coreAPI->service_release (identity);
identity = NULL;
- coreAPI->release_service (session);
+ coreAPI->service_release (session);
session = NULL;
CLOSE (signalingPipe[0]);
Modified: GNUnet/src/include/core.h
===================================================================
--- GNUnet/src/include/core.h 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/include/core.h 2008-03-25 06:23:12 UTC (rev 6615)
@@ -22,6 +22,9 @@
* @file include/core.h
* @brief Implementation of the APIs to the GNUnet core
* @author Christian Grothoff
+ *
+ * This code should only be used in src/server/ and by
+ * testcases that need to setup parts of a gnunetd daemon.
*/
#ifndef CORE_H
Modified: GNUnet/src/include/dht.h
===================================================================
--- GNUnet/src/include/dht.h 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/include/dht.h 2008-03-25 06:23:12 UTC (rev 6615)
@@ -25,6 +25,7 @@
*
* Typical clients are likely to prefer using the synchronous
* gnunet_dht_lib instead of sending these messages manually.
+ * Only code in src/applications/dht/ should refer to this file!
*/
#ifndef GNUNET_DHT_H
Modified: GNUnet/src/include/ecrs_core.h
===================================================================
--- GNUnet/src/include/ecrs_core.h 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/include/ecrs_core.h 2008-03-25 06:23:12 UTC (rev 6615)
@@ -40,55 +40,55 @@
{
GNUNET_HashCode key;
GNUNET_HashCode query;
-} CHK;
+} GNUNET_EC_ContentHashKey;
/**
- * @brief data block
+ * @brief information required to download a file from GNUnet
+ *
+ * A GNUNET_EC_FileIdentifier groups the information
+ * required to download (and check) a file.
*/
typedef struct
{
/**
- * Type of the block, in network byte order.
+ * Total size of the file in bytes. (network byte order (!))
*/
- unsigned int type;
+ unsigned long long file_length;
- /* data follows here */
+ /**
+ * Query and key of the top GNUNET_EC_IBlock.
+ */
+ GNUNET_EC_ContentHashKey chk;
-} DBlock;
+} GNUNET_EC_FileIdentifier;
+/**
+ * @brief data block
+ */
typedef struct
{
/**
- * Type of the block (IBLOCK), in network byte order.
+ * Type of the block, in network byte order.
*/
- DBlock iblock;
+ unsigned int type;
- CHK data[1];
+ /* data follows here */
-} IBlock;
+} GNUNET_EC_DBlock;
-/**
- * @brief information required to download a file from GNUnet
- *
- * A FileIdentifier groups the information
- * required to download (and check) a file.
- */
typedef struct
{
/**
- * Total size of the file in bytes. (network byte order (!))
+ * Type of the block (IBLOCK), in network byte order.
*/
- unsigned long long file_length;
+ GNUNET_EC_DBlock iblock;
- /**
- * Query and key of the top IBlock.
- */
- CHK chk;
+ GNUNET_EC_ContentHashKey data[1];
-} FileIdentifier;
+} GNUNET_EC_IBlock;
/**
* @brief keyword block (advertising data under a keyword)
@@ -115,7 +115,7 @@
/* variable-size Meta-Data follows here! */
-} KBlock;
+} GNUNET_EC_KBlock;
typedef struct
{
@@ -144,14 +144,14 @@
/* from here on encrypted */
/**
- * Time at which this SBlock was created;
+ * Time at which this GNUNET_EC_SBlock was created;
* in network byte order
*/
GNUNET_Int32Time creationTime;
/**
* Interval (in seconds) how often the publisher intends to produce
- * an updated SBlock; GNUNET_ECRS_SBLOCK_UPDATE_NONE(0) is used for
+ * an updated GNUNET_EC_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
@@ -160,7 +160,7 @@
/**
* N, the identifier that will be used for the
- * next revision of this SBlock.
+ * next revision of this GNUNET_EC_SBlock.
*/
GNUNET_HashCode nextIdentifier;
@@ -173,7 +173,7 @@
/* 0-terminated URI follows here! */
/* variable-size Meta-Data follows here! */
-} SBlock;
+} GNUNET_EC_SBlock;
typedef struct
{
@@ -206,10 +206,10 @@
GNUNET_HashCode rootEntry;
/* variable-size Meta-Data follows here! */
-} NBlock;
+} GNUNET_EC_NBlock;
/**
- * @brief keyword-NBlock (advertising namespace under a keyword)
+ * @brief keyword-GNUNET_EC_NBlock (advertising namespace under a keyword)
*/
typedef struct
{
@@ -219,10 +219,10 @@
*/
unsigned int type;
- KBlock kblock;
+ GNUNET_EC_KBlock kblock;
- NBlock nblock;
-} KNBlock;
+ GNUNET_EC_NBlock nblock;
+} GNUNET_EC_KNBlock;
/**
* Perform on-demand content encoding.
@@ -233,13 +233,13 @@
* for the content (verified that it matches
* data)
* @param value the encoded data (set);
- * the anonymityLevel is to be set to 0
+ * the anonymity_level is to be set to 0
* (caller should have checked before calling
* this method).
* @return GNUNET_OK on success, GNUNET_SYSERR if data does not
* match the query
*/
-int GNUNET_EC_file_block_encode (const DBlock * data,
+int GNUNET_EC_file_block_encode (const GNUNET_EC_DBlock * data,
unsigned int len,
const GNUNET_HashCode * query,
GNUNET_DatastoreValue ** value);
@@ -250,7 +250,7 @@
*
* @param db the block in plaintext
*/
-void GNUNET_EC_file_block_get_query (const DBlock * data,
+void GNUNET_EC_file_block_get_query (const GNUNET_EC_DBlock * data,
unsigned int len,
GNUNET_HashCode * query);
@@ -259,14 +259,14 @@
* Get the key that will be used to decrypt
* a certain block of data.
*/
-void GNUNET_EC_file_block_get_key (const DBlock * data,
+void GNUNET_EC_file_block_get_key (const GNUNET_EC_DBlock * data,
unsigned int len, GNUNET_HashCode * key);
/**
* What is the type of the given block of data?
*/
unsigned int GNUNET_EC_file_block_get_type (unsigned int size,
- const DBlock * data);
+ const GNUNET_EC_DBlock * data);
/**
* What is the main query (the one that is used in
@@ -282,7 +282,8 @@
* the content type is not known
*/
int GNUNET_EC_file_block_check_and_get_query (unsigned int size,
- const DBlock * data, int verify,
+ const GNUNET_EC_DBlock * data,
+ int verify,
GNUNET_HashCode * query);
/**
@@ -301,7 +302,7 @@
*/
int GNUNET_EC_is_block_applicable_for_query (unsigned int type,
unsigned int size,
- const DBlock * data,
+ const GNUNET_EC_DBlock * data,
const GNUNET_HashCode *
knownDatumQuery,
unsigned int keyCount,
Modified: GNUnet/src/include/fs.h
===================================================================
--- GNUnet/src/include/fs.h 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/include/fs.h 2008-03-25 06:23:12 UTC (rev 6615)
@@ -22,6 +22,9 @@
* @file applications/fs/module/fs.h
* @brief FS Client-Server and P2P message formats
* @author Christian Grothoff
+ *
+ * Applications should use the FSLIB, ECRS or FSUI libraries.
+ * Only code in src/applications/fs/ should refer to this file!
*/
#ifndef FS_H
#define FS_H
@@ -54,7 +57,7 @@
* Use 0 if anonymity is not required (enables direct
* sharing / DHT routing).
*/
- unsigned int anonymityLevel;
+ unsigned int anonymity_level;
/**
* Identity of the peer that is known to have the
@@ -72,7 +75,7 @@
/**
* Server to client: content (in response to a CS_fs_request_search_MESSAGE).
The
- * header is followed by the variable size data of a DBlock (as
+ * header is followed by the variable size data of a GNUNET_EC_DBlock (as
* defined in ecrs_core.h).
*/
typedef struct
@@ -83,12 +86,12 @@
* Anonymity level for the content, maybe
* 0 if not known.
*/
- unsigned int anonymityLevel;
+ unsigned int anonymity_level;
/**
* Expiration time of the response (relative to now).
*/
- GNUNET_CronTime expirationTime;
+ GNUNET_CronTime expiration_time;
} CS_fs_reply_content_MESSAGE;
@@ -96,7 +99,7 @@
/**
* Client to server: insert content.
* This struct is followed by a variable
- * number of bytes of content (a DBlock).
+ * number of bytes of content (a GNUNET_EC_DBlock).
*/
typedef struct
{
@@ -110,14 +113,14 @@
/**
* Priority for the on-demand encoded entry.
*/
- unsigned int prio;
+ unsigned int priority;
/**
* What are the anonymity requirements for this content?
* Use 0 if anonymity is not required (enables direct
* sharing / DHT routing).
*/
- unsigned int anonymityLevel;
+ unsigned int anonymity_level;
/**
* At what time does the entry expire?
@@ -162,14 +165,14 @@
/**
* Priority for the on-demand encoded entry.
*/
- unsigned int prio;
+ unsigned int priority;
/**
* What are the anonymity requirements for this content?
* Use 0 if anonymity is not required (enables direct
* sharing / DHT routing).
*/
- unsigned int anonymityLevel;
+ unsigned int anonymity_level;
/**
* At what time does the entry expire?
@@ -193,7 +196,7 @@
/**
* Client to server: delete content. This struct is followed by
- * the DBlock (of variable size) of the content that is to be deleted.
+ * the GNUNET_EC_DBlock (of variable size) of the content that is to be
deleted.
*/
typedef struct
{
@@ -300,7 +303,7 @@
/**
* Return message for search result. This struct
- * is always followed by a DBlock (see ecrs_core.h)
+ * is always followed by a GNUNET_EC_DBlock (see ecrs_core.h)
* which contains the GNUNET_ECRS_BLOCKTYPE followed
* by the actual (encrypted) data.
*/
Modified: GNUnet/src/include/gnunet_chat_lib.h
===================================================================
--- GNUnet/src/include/gnunet_chat_lib.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/include/gnunet_chat_lib.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -128,13 +128,14 @@
GNUNET_CronTime timestamp,
GNUNET_CHAT_MSG_OPTIONS options);
+/**
+ * @param is_joining will be GNUNET_YES if the member is joining, GNUNET_NO if
he is leaving
+ */
typedef int (*GNUNET_CHAT_MemberListCallback) (void *cls,
const char *nick,
+ int is_joining,
GNUNET_CronTime timestamp);
-typedef int (*GNUNET_CHAT_MemberRemoveCallback) (void *cls,
- const char *nick,
- GNUNET_CronTime timestamp);
/**
* Join a chat room.
*
@@ -159,10 +160,7 @@
callback, void *cls,
GNUNET_CHAT_MemberListCallback
memberCallback,
- void *membercls,
-
GNUNET_CHAT_MemberRemoveCallback
- removeCallback,
- void *removecls);
+ void *member_cls);
/**
* Leave a chat room.
@@ -197,7 +195,6 @@
const GNUNET_RSA_Signature *
receipt);
-
/**
* Send a message.
*
@@ -212,25 +209,6 @@
GNUNET_CHAT_MSG_OPTIONS options,
const GNUNET_RSA_PublicKey * receiver);
-
-/**
- * Callback function to iterate over room members.
- */
-typedef int (*GNUNET_CHAT_MemberIterator) (const char *nickname,
- const GNUNET_RSA_PublicKey *
- owner, const char *memberInfo,
- GNUNET_CronTime lastConfirmed,
- void *cls);
-
-/**
- * List all of the (known) chat members.
- * @return number of rooms on success, GNUNET_SYSERR if iterator aborted
- */
-int GNUNET_CHAT_list_members (struct GNUNET_CHAT_Room *room,
- GNUNET_CHAT_MemberIterator it, void *cls);
-
-
-
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
Modified: GNUnet/src/include/gnunet_core.h
===================================================================
--- GNUnet/src/include/gnunet_core.h 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/include/gnunet_core.h 2008-03-25 06:23:12 UTC (rev 6615)
@@ -49,7 +49,7 @@
* roughly the main GNUnet version scheme, but is
* more a compatibility ID.
*/
-#define GNUNET_CORE_VERSION 0x00070399
+#define GNUNET_CORE_VERSION 0x00080000
/**
@@ -178,7 +178,7 @@
/**
* The identity of the local node.
*/
- GNUNET_PeerIdentity *myIdentity;
+ GNUNET_PeerIdentity *my_identity;
/**
* System error context
@@ -211,7 +211,7 @@
* loaded or unloaded inside the module initialization or shutdown
* code.
*/
- void *(*request_service) (const char *name);
+ void *(*service_request) (const char *name);
/**
* Notification that the given service is no longer required. This
@@ -223,24 +223,11 @@
*
* @return GNUNET_OK if service was successfully released, GNUNET_SYSERR on
error
*/
- int (*release_service) (void *service);
+ int (*service_release) (void *service);
/* ****************** P2P data exchange **************** */
/**
- * Send an encrypted message to another node.
- *
- * @param receiver the target node
- * @param msg the message to send, NULL to tell
- * the core to try to establish a session
- * @param importance how important is the message?
- * @param maxdelay how long can the message be delayed?
- */
- void (*unicast) (const GNUNET_PeerIdentity * receiver,
- const GNUNET_MessageHeader * msg,
- unsigned int importance, unsigned int maxdelay);
-
- /**
* Send a plaintext message to another node. This is
* not the usual way for communication and should ONLY be
* used by modules that are responsible for setting up
@@ -252,10 +239,24 @@
* @param msg the message to transmit, should contain MESSAGE_HEADERs
* @return GNUNET_OK on success, GNUNET_SYSERR on failure
*/
- int (*connection_send_plaintext) (GNUNET_TSession * session,
- const char *msg, unsigned int size);
+ int (*plaintext_send) (GNUNET_TSession * session,
+ const char *msg, unsigned int size);
+
/**
+ * Send an encrypted message to another node.
+ *
+ * @param receiver the target node
+ * @param msg the message to send, NULL to tell
+ * the core to try to establish a session
+ * @param importance how important is the message?
+ * @param maxdelay how long can the message be delayed?
+ */
+ void (*ciphertext_send) (const GNUNET_PeerIdentity * receiver,
+ const GNUNET_MessageHeader * msg,
+ unsigned int importance, unsigned int maxdelay);
+
+ /**
* Send an encrypted, on-demand build message to another node.
*
* @param receiver the target node
@@ -265,17 +266,32 @@
* @param importance how important is the message?
* @param maxdelay how long can the message wait?
*/
- void (*connection_send_using_callback) (const
- GNUNET_PeerIdentity *
- receiver,
- GNUNET_BuildMessageCallback
- callback, void *closure,
- unsigned short len,
- unsigned int importance,
- unsigned int maxdelay);
+ void (*ciphertext_send_with_callback) (const
+ GNUNET_PeerIdentity *
+ receiver,
+ GNUNET_BuildMessageCallback
+ callback, void *closure,
+ unsigned short len,
+ unsigned int importance,
+ unsigned int maxdelay);
/**
+ * Send a message to ourselves (simulated loopback).
+ * Handle a message (that was decrypted if needed). Processes the
+ * message by calling the registered handler for each message part.
+ *
+ * @param wasEncrypted GNUNET_YES if it was encrypted,
+ * GNUNET_NO if plaintext.
+ * @param session for plaintext messages, the
+ * assumed transport session. Maybe NULL.
+ */
+ void (*loopback_send) (const GNUNET_PeerIdentity * sender,
+ const char *msg,
+ unsigned int size,
+ int wasEncrypted, GNUNET_TSession * session);
+
+ /**
* Register a callback method that should be invoked whenever a message
* is about to be send that has more than minimumPadding bytes left
* before maxing out the MTU.
@@ -290,7 +306,7 @@
* @param priority the higher the priority, the higher preference
* will be given to polling this callback (compared to
* other callbacks). Note that polling will always
- * only be done after all push requests (unicast) have
+ * only be done after all push requests (ciphertext_send) have
* been considered
* @param callback the method to invoke. The receiver is the
* receiver of the message, position is the reference to the
@@ -300,31 +316,30 @@
* that buffer (must be a positive number).
* @return GNUNET_OK if the handler was registered, GNUNET_SYSERR on error
*/
- int (*connection_register_send_callback) (unsigned int
- minimumPadding,
- unsigned int priority,
- GNUNET_BufferFillCallback
- callback);
+ int (*send_callback_register) (unsigned int
+ minimumPadding,
+ unsigned int priority,
+ GNUNET_BufferFillCallback callback);
/**
* Unregister a handler that was registered with
GNUNET_CORE_connection_register_send_callback.
* @return GNUNET_OK if the handler was removed, GNUNET_SYSERR on error
*/
- int (*connection_unregister_send_callback) (unsigned int
- minimumPadding,
- GNUNET_BufferFillCallback
- callback);
+ int (*send_callback_unregister) (unsigned int
+ minimumPadding,
+ GNUNET_BufferFillCallback callback);
/* *********************** notifications ********************* */
+
/**
* Call the given function whenever we get
* disconnected from a particular peer.
*
* @return GNUNET_OK
*/
- int (*register_notify_peer_disconnect) (GNUNET_NodeIteratorCallback
- callback, void *cls);
+ int (*peer_disconnect_notification_register) (GNUNET_NodeIteratorCallback
+ callback, void *cls);
/**
* Stop calling the given function whenever we get
@@ -333,8 +348,8 @@
* @return GNUNET_OK on success, GNUNET_SYSERR
* if this callback is not registered
*/
- int (*unregister_notify_peer_disconnect) (GNUNET_NodeIteratorCallback
- callback, void *cls);
+ int (*peer_disconnect_notification_unregister) (GNUNET_NodeIteratorCallback
+ callback, void *cls);
/**
* Register a handler that is to be called for each
@@ -344,8 +359,7 @@
* P2P message part that is transmitted
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a problem
*/
- int (*connection_register_send_notification_callback)
- (GNUNET_P2PRequestHandler callback);
+ int (*peer_send_notification_register) (GNUNET_P2PRequestHandler callback);
/**
* Unregister a handler that is to be called for each
@@ -355,11 +369,11 @@
* P2P message part that is transmitted
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a problem
*/
- int (*connection_unregister_send_notification_callback)
+ int (*peer_send_notification_unregister)
(GNUNET_P2PRequestHandler callback);
- /* ********************* handlers ***************** */
+ /* ********************* P2P handlers ***************** */
/**
* Register a method as a handler for specific message
@@ -370,8 +384,8 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is already a
* handler for that type
*/
- int (*registerHandler) (unsigned short type,
- GNUNET_P2PRequestHandler callback);
+ int (*p2p_ciphertext_handler_register) (unsigned short type,
+ GNUNET_P2PRequestHandler callback);
/**
* Unregister a method as a handler for specific message
@@ -382,24 +396,11 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a different
* handler for that type
*/
- int (*unregisterHandler) (unsigned short type,
- GNUNET_P2PRequestHandler callback);
+ int (*p2p_ciphertext_handler_unregister) (unsigned short type,
+ GNUNET_P2PRequestHandler
+ callback);
/**
- * Is a handler registered for messages of the given type?
- * @param type the message type
- * @param handlerType 0 for plaintext P2P,
- * 1 for ciphertext P2P,
- * 2 for either plaintext or ciphertext P2P,
- * 3 for client-server
- * GNUNET_NO for ciphertext handlers, GNUNET_SYSERR for either
- * @return number of handlers registered, 0 for none,
- * GNUNET_SYSERR for invalid value of handlerType
- */
- int (*p2p_test_handler_registered) (unsigned short type,
- unsigned short handlerType);
-
- /**
* Register a method as a handler for specific message
* types. Only for encrypted messages!
* @param type the message type
@@ -408,9 +409,9 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is already a
* handler for that type
*/
- int (*plaintext_register_handler) (unsigned short type,
- GNUNET_P2PPlaintextRequestHandler
- callback);
+ int (*p2p_plaintext_handler_register) (unsigned short type,
+ GNUNET_P2PPlaintextRequestHandler
+ callback);
/**
* Unregister a method as a handler for specific message
@@ -422,34 +423,25 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a different
* handler for that type
*/
- int (*plaintext_unregister_handler) (unsigned short type,
- GNUNET_P2PPlaintextRequestHandler
- callback);
+ int (*p2p_plaintext_handler_unregister) (unsigned short type,
+ GNUNET_P2PPlaintextRequestHandler
+ callback);
- /* ***************** traffic management ******************* */
-
-
/**
- * Perform an operation for all connected hosts.
- * No synchronization or other checks are performed.
- *
- * @param method the method to invoke (NULL for counting only)
- * @param arg the second argument to the method
- * @return the number of connected hosts
+ * Is a handler registered for messages of the given type?
+ * @param type the message type
+ * @param handlerType 0 for plaintext P2P,
+ * 1 for ciphertext P2P,
+ * 2 for either plaintext or ciphertext P2P,
+ * 3 for client-server
+ * GNUNET_NO for ciphertext handlers, GNUNET_SYSERR for either
+ * @return number of handlers registered, 0 for none,
+ * GNUNET_SYSERR for invalid value of handlerType
*/
- int (*forAllConnectedNodes) (GNUNET_NodeIteratorCallback method, void *arg);
+ int (*p2p_message_handler_registered_test) (unsigned short type,
+ unsigned short handlerType);
- /**
- * Try to reserve downstream bandwidth for a particular peer.
- *
- * @param peer with whom should bandwidth be reserved?
- * @param amount how many bytes should we expect to receive?
- * (negative amounts can be used to undo a (recent)
- * reservation request
- * @return amount that could actually be reserved
- */
- int (*reserve_downstream_bandwidth) (const GNUNET_PeerIdentity * peer,
- int amount);
+ /* ***************** connection management ******************* */
/**
* Offer the core a session for communication with the
@@ -460,67 +452,54 @@
* use it after this call. If the core does not want/need
* the session, it will also be disconnected.
*/
- void (*offerTSessionFor) (const GNUNET_PeerIdentity * peer,
- GNUNET_TSession * session);
+ void (*p2p_transport_session_offer) (const GNUNET_PeerIdentity * peer,
+ GNUNET_TSession * session);
/**
- * Assign a session key for traffic from or to a given peer.
- * If the core does not yet have an entry for the given peer
- * in the connection table, a new entry is created.
- *
- * @param key the sessionkey,
- * @param peer the other peer,
- * @param forSending GNUNET_NO if it is the key for receiving,
- * GNUNET_YES if it is the key for sending
- */
- void (*connection_assign_session_key_to_peer) (const
- GNUNET_AES_SessionKey
- * key,
- const
- GNUNET_PeerIdentity
- * peer,
- GNUNET_Int32Time
- age, int forSending);
+ * Assign a session key for traffic from or to a given peer.
+ * If the core does not yet have an entry for the given peer
+ * in the connection table, a new entry is created.
+ *
+ * @param key the sessionkey,
+ * @param peer the other peer,
+ * @param forSending GNUNET_NO if it is the key for receiving,
+ * GNUNET_YES if it is the key for sending
+ */
+ void (*p2p_session_key_set) (const
+ GNUNET_AES_SessionKey
+ * key,
+ const
+ GNUNET_PeerIdentity
+ * peer, GNUNET_Int32Time age, int forSending);
- /**
- * Obtain the session key used for traffic from or to a given peer.
- *
- * @param key the sessionkey (set)
- * @param age the age of the key (set)
- * @param peer the other peer,
- * @param forSending GNUNET_NO if it is the key for receiving,
- * GNUNET_YES if it is the key for sending
- * @return GNUNET_SYSERR if no sessionkey is known to the core,
- * GNUNET_OK if the sessionkey was set.
- */
- int (*connection_get_session_key_of_peer) (const
- GNUNET_PeerIdentity *
- peer,
- GNUNET_AES_SessionKey
- * key,
- GNUNET_Int32Time *
- age, int forSending);
+ /**
+ * Obtain the session key used for traffic from or to a given peer.
+ *
+ * @param key the sessionkey (set)
+ * @param age the age of the key (set)
+ * @param peer the other peer,
+ * @param forSending GNUNET_NO if it is the key for receiving,
+ * GNUNET_YES if it is the key for sending
+ * @return GNUNET_SYSERR if no sessionkey is known to the core,
+ * GNUNET_OK if the sessionkey was set.
+ */
+ int (*p2p_session_key_get) (const
+ GNUNET_PeerIdentity *
+ peer,
+ GNUNET_AES_SessionKey
+ * key, GNUNET_Int32Time * age, int forSending);
- /**
+
+ /**
* We have confirmed that the other peer is communicating with us,
* mark the session as up-and-running (assuming the
* core has both sessionkeys, otherwise this method fails --
* this could happen if in between the core has discarded
* the session information).
*/
- void (*connection_mark_session_as_confirmed) (const
- GNUNET_PeerIdentity * peer);
+ void (*p2p_connection_confirm) (const GNUNET_PeerIdentity * peer);
/**
- * Increase the preference for traffic from some other peer.
- *
- * @param node the identity of the other peer
- * @param preference how much should the traffic preference be increased?
- */
- void (*preferTrafficFrom) (const GNUNET_PeerIdentity * node,
- double preference);
-
- /**
* Query how much bandwidth is availabe FROM the given node to
* this node in bpm (at the moment).
*
@@ -528,27 +507,84 @@
* @param last_seen set to last time peer was confirmed up
* @return GNUNET_OK on success, GNUNET_SYSERR if if we are NOT connected
*/
- int (*queryPeerStatus) (const GNUNET_PeerIdentity * node,
- unsigned int *bpm, GNUNET_CronTime * last_seen);
+ int (*p2p_connection_status_check) (const GNUNET_PeerIdentity * node,
+ unsigned int *bpm,
+ GNUNET_CronTime * last_seen);
/**
+ * Get the time of the last encrypted message that was received
+ * from the given peer.
+ * @param time updated with the time
+ * @return GNUNET_SYSERR if we are not connected to the peer at the moment
+ */
+ int (*p2p_connection_last_activity_get) (const
+ GNUNET_PeerIdentity
+ * peer, GNUNET_CronTime * time);
+
+
+ /**
+ * Perform an operation for all connected hosts.
+ * No synchronization or other checks are performed.
+ *
+ * @param method the method to invoke (NULL for counting only)
+ * @param arg the second argument to the method
+ * @return the number of connected hosts
+ */
+ int (*p2p_connections_iterate) (GNUNET_NodeIteratorCallback method,
+ void *arg);
+
+ /**
+ * Try to reserve downstream bandwidth for a particular peer.
+ *
+ * @param peer with whom should bandwidth be reserved?
+ * @param amount how many bytes should we expect to receive?
+ * (negative amounts can be used to undo a (recent)
+ * reservation request
+ * @return amount that could actually be reserved
+ */
+ int (*p2p_bandwidth_downstream_reserve) (const GNUNET_PeerIdentity * peer,
+ int amount);
+
+
+ /**
+ * Increase the preference for traffic from some other peer.
+ *
+ * @param node the identity of the other peer
+ * @param preference how much should the traffic preference be increased?
+ */
+ void (*p2p_connection_preference_increase) (const GNUNET_PeerIdentity *
+ node, double preference);
+
+ /**
* Disconnect a particular peer. Sends a HANGUP message to the other
* side and marks all sessionkeys as dead.
*
* @param peer the peer to disconnect
*/
- void (*connection_disconnect_from_peer) (const GNUNET_PeerIdentity * peer);
+ void (*p2p_connection_close) (const GNUNET_PeerIdentity * peer);
/* **************** Client-server interaction **************** */
/**
+ * Test if we could send a message to the client right now.
+ * @param client
+ * @return GNUNET_OK if we could, GNUNET_NO if not, GNUNET_SYSERR on error
+ */
+ int (*cs_send_message_now_test) (struct GNUNET_ClientHandle * handle,
+ unsigned int size, int would_force);
+
+ /**
* Send a message to the client identified by the handle. Note that
* the core will typically buffer these messages as much as possible
* and only return GNUNET_SYSERR if it runs out of buffers. Returning
GNUNET_OK
* on the other hand does NOT confirm delivery since the actual
* transfer happens asynchronously.
+ *
+ * @param force GNUNET_YES if this message MUST be queued
*/
- int (*sendValueToClient) (struct GNUNET_ClientHandle * handle, int value);
+ int (*cs_send_message) (struct GNUNET_ClientHandle *
+ handle,
+ const GNUNET_MessageHeader * message, int force);
/**
* Send a message to the client identified by the handle. Note that
@@ -556,21 +592,9 @@
* and only return GNUNET_SYSERR if it runs out of buffers. Returning
GNUNET_OK
* on the other hand does NOT confirm delivery since the actual
* transfer happens asynchronously.
- *
- * @param force GNUNET_YES if this message MUST be queued
*/
- int (*cs_send_to_client) (struct GNUNET_ClientHandle *
- handle,
- const GNUNET_MessageHeader * message, int force);
+ int (*cs_send_value) (struct GNUNET_ClientHandle * handle, int value);
- /**
- * Test if we could send a message to the client right now.
- * @param client
- * @return GNUNET_OK if we could, GNUNET_NO if not, GNUNET_SYSERR on error
- */
- int (*cs_test_send_to_client_now) (struct GNUNET_ClientHandle * handle,
- unsigned int size,
- int would_force);
/**
* Send a message to the client identified by the handle. Note that
@@ -579,8 +603,8 @@
* on the other hand does NOT confirm delivery since the actual
* transfer happens asynchronously.
*/
- int (*sendErrorMessageToClient) (struct GNUNET_ClientHandle * handle,
- GNUNET_GE_KIND kind, const char *value);
+ int (*cs_send_error) (struct GNUNET_ClientHandle * handle,
+ GNUNET_GE_KIND kind, const char *value);
/**
* Register a method as a handler for specific message
@@ -591,8 +615,8 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is already a
* handler for that type
*/
- int (*registerClientHandler) (unsigned short type,
- GNUNET_ClientRequestHandler callback);
+ int (*cs_handler_register) (unsigned short type,
+ GNUNET_ClientRequestHandler callback);
/**
* Remove a method as a handler for specific message
@@ -603,8 +627,8 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there is a different
* handler for that type
*/
- int (*unregisterClientHandler) (unsigned short type,
- GNUNET_ClientRequestHandler callback);
+ int (*cs_handler_unregister) (unsigned short type,
+ GNUNET_ClientRequestHandler callback);
/**
* Register a handler to call if any client exits.
@@ -612,7 +636,7 @@
* of every client that disconnected.
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
- int (*cs_exit_handler_register) (GNUNET_ClientExitHandler callback);
+ int (*cs_disconnect_handler_register) (GNUNET_ClientExitHandler callback);
/**
* Unregister a handler to call if any client exits.
@@ -620,82 +644,53 @@
* of every client that disconnected.
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
- int (*cs_exit_handler_unregister) (GNUNET_ClientExitHandler callback);
+ int (*cs_disconnect_handler_unregister) (GNUNET_ClientExitHandler callback);
/**
* Terminate the connection with the given client (asynchronous
* detection of a protocol violation).
*/
- void (*cs_terminate_client_connection) (struct
- GNUNET_ClientHandle * handle);
+ void (*cs_disconnect_now) (struct GNUNET_ClientHandle * handle);
/**
* Create a log context that will transmit errors to the
* given client.
*/
struct GNUNET_GE_Context
- *(*cs_create_client_log_context) (struct GNUNET_ClientHandle * handle);
+ *(*cs_log_context_create) (struct GNUNET_ClientHandle * handle);
/* ************************ MISC ************************ */
/**
- * Send a message to ourselves (simulated loopback).
- * Handle a message (that was decrypted if needed). Processes the
- * message by calling the registered handler for each message part.
- *
- * @param wasEncrypted GNUNET_YES if it was encrypted,
- * GNUNET_NO if plaintext.
- * @param session for plaintext messages, the
- * assumed transport session. Maybe NULL.
+ * Get the current number of slots in the connection table (as computed
+ * from the available bandwidth).
*/
- void (*p2p_inject_message) (const GNUNET_PeerIdentity * sender,
- const char *msg,
- unsigned int size,
- int wasEncrypted, GNUNET_TSession * session);
+ int (*core_slots_count) (void);
/**
* Compute the index (small, positive, pseudo-unique identification
* number) of a hostId.
*/
- unsigned int (*connection_compute_index_of_peer) (const
- GNUNET_PeerIdentity
- * hostId);
+ unsigned int (*core_slot_index_get) (const GNUNET_PeerIdentity * hostId);
/**
- * The the lock of the connection module. A module that registers
- * callbacks may need this.
- */
- struct GNUNET_Mutex *(*connection_get_lock) (void);
-
- /**
- * Get the current number of slots in the connection table (as computed
- * from the available bandwidth).
- */
- int (*connection_get_slot_count) (void);
-
- /**
* Is the given slot used?
* @return 0 if not, otherwise number of peers in
* the slot
*/
- int (*connection_is_slot_used) (int slot);
+ int (*core_slot_test_used) (int slot);
/**
- * Get the time of the last encrypted message that was received
- * from the given peer.
- * @param time updated with the time
- * @return GNUNET_SYSERR if we are not connected to the peer at the moment
+ * The the lock of the connection module. A module that registers
+ * callbacks may need this.
*/
- int (*connection_get_last_activity_of_peer) (const
- GNUNET_PeerIdentity
- * peer,
- GNUNET_CronTime * time);
+ struct GNUNET_Mutex *(*global_lock_get) (void);
/**
* Assert that the given tsession is no longer
* in use by the core.
*/
- int (*connection_assert_tsession_unused) (GNUNET_TSession * tsession);
+ int (*tsession_assert_unused) (GNUNET_TSession * tsession);
} GNUNET_CoreAPIForPlugins;
@@ -757,7 +752,7 @@
/**
* Trigger updates for another module.
*/
- int (*updateModule) (const char *module);
+ int (*service_update) (const char *module);
/**
* Load a service module of the given name. This function must be
@@ -767,7 +762,7 @@
* loaded or unloaded inside the module initialization or shutdown
* code.
*/
- void *(*request_service) (const char *name);
+ void *(*service_request) (const char *name);
/**
* Notification that the given service is no longer required. This
@@ -779,7 +774,7 @@
*
* @return GNUNET_OK if service was successfully released, GNUNET_SYSERR on
error
*/
- int (*release_service) (void *service);
+ int (*service_release) (void *service);
} GNUNET_UpdateAPI;
Modified: GNUnet/src/include/gnunet_datastore_service.h
===================================================================
--- GNUnet/src/include/gnunet_datastore_service.h 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/include/gnunet_datastore_service.h 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -66,20 +66,20 @@
* priority are discarded if the datastore is full. In network
* byte order.
*/
- unsigned int prio;
+ unsigned int priority;
/**
* What are the anonymity requirements for this content?
* Use 0 if anonymity is not required (enables direct
* sharing / DHT routing). In network byte order.
*/
- unsigned int anonymityLevel;
+ unsigned int anonymity_level;
/**
* Expiration time for this item, in NBO (use GNUNET_htonll to read!). Use
* "-1" for items that never expire.
*/
- GNUNET_CronTime expirationTime;
+ GNUNET_CronTime expiration_time;
} GNUNET_DatastoreValue;
Modified: GNUnet/src/include/gnunet_ecrs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_ecrs_lib.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/include/gnunet_ecrs_lib.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -45,7 +45,7 @@
*
* 1.x.x: initial version with triple GNUNET_hash and merkle tree
* 2.x.x: root node with mime-type, filename and version number
- * 2.1.x: combined CHK/3HASH encoding with 25:1 super-nodes
+ * 2.1.x: combined GNUNET_EC_ContentHashKey/3HASH encoding with 25:1
super-nodes
* 2.2.x: with directories
* 3.0.x: with namespaces
* 3.1.x: with namespace meta-data
@@ -70,7 +70,7 @@
/**
- * Fixed SBlock updateInterval codes. Positive values
+ * Fixed GNUNET_EC_SBlock updateInterval codes. Positive values
* are interpreted as durations (in seconds) for periodical
* updates.
*/
@@ -333,7 +333,7 @@
*
* @param baseURI content offered by the sender
* @param sender identity of the peer with the content
- * @param expirationTime how long will the content be offered?
+ * @param expiration_time how long will the content be offered?
* @param signer function to call for obtaining
* RSA signatures for "sender".
* @return the location URI
@@ -592,16 +592,16 @@
/**
* Create a new namespace (and publish an advertismement).
- * This publishes both an NBlock in the namespace itself
+ * This publishes both an GNUNET_EC_NBlock in the namespace itself
* as well as KNBlocks under all keywords specified in
* the advertisementURI.
*
* @param name the name for the namespace
- * @param anonymityLevel for the namespace advertismement
+ * @param anonymity_level for the namespace advertismement
* @param priority for the namespace advertisement
* @param expiration for the namespace advertisement
* @param advertisementURI the keyword (!) URI to advertise the
- * namespace under (KNBlock)
+ * namespace under (GNUNET_EC_KNBlock)
* @param meta meta-data for the namespace advertisement
* @param rootEntry name of the root entry in the namespace (for
* the namespace advertisement)
@@ -775,7 +775,7 @@
dpcb, void *dpcbClosure);
/**
- * Stop a download (aborts if download is incomplete).
+ * Stop a download (aborts if download is incomplete).
*/
int
GNUNET_ECRS_file_download_partial_stop (struct GNUNET_ECRS_DownloadContext
Modified: GNUnet/src/include/gnunet_fragmentation_service.h
===================================================================
--- GNUnet/src/include/gnunet_fragmentation_service.h 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/include/gnunet_fragmentation_service.h 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -47,7 +47,7 @@
*
* @param peer the recipient of the message
* @param mtu maximum size of a fragment
- * @param prio priority of the message
+ * @param priority priority of the message
* @param targetTime desired transmission time
* @param len size of the message
* @param bmc callback to construct the message
@@ -55,7 +55,7 @@
*/
void (*fragment) (const GNUNET_PeerIdentity * peer,
unsigned int mtu,
- unsigned int prio,
+ unsigned int priority,
unsigned int targetTime,
unsigned int len,
GNUNET_BuildMessageCallback bmc, void *bmcClosure);
Modified: GNUnet/src/include/gnunet_fs_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fs_lib.h 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/include/gnunet_fs_lib.h 2008-03-25 06:23:12 UTC (rev 6615)
@@ -63,7 +63,7 @@
*
* @param target identity of host known to have the
* content, NULL if no such identity is known
- * @param anonymityLevel what are the anonymity
+ * @param anonymity_level what are the anonymity
* requirements for this request? 0 for no
* anonymity (DHT/direct transfer ok)
* @param callback method to call for each result
Modified: GNUnet/src/include/gnunet_protocols.h
===================================================================
--- GNUnet/src/include/gnunet_protocols.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/include/gnunet_protocols.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -130,7 +130,7 @@
#define GNUNET_CS_PROTO_GAP_RESULT 9
/**
- * client to gnunetd: insert CHK content (no index)
+ * client to gnunetd: insert GNUNET_EC_ContentHashKey content (no index)
*/
#define GNUNET_CS_PROTO_GAP_INSERT 10
Modified: GNUnet/src/include/gnunet_remote_lib.h
===================================================================
--- GNUnet/src/include/gnunet_remote_lib.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/include/gnunet_remote_lib.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -41,15 +41,31 @@
/**
* Linked list of information about daemon processes.
*/
-struct GNUNET_remote_host
+struct GNUNET_REMOTE_HostInfo
{
+ struct GNUNET_REMOTE_HostInfo *next;
+
+ /**
+ * Identity of the peer running on that host and port.
+ */
GNUNET_PeerIdentity identity;
- struct GNUNET_remote_host *next;
+ /**
+ * Name of the host.
+ */
char *hostname;
- unsigned long long controlPort;
+
+ /**
+ * Process ID.
+ */
pid_t pid;
+ /**
+ * Port used by clients to talk to the daemon on
+ * that machine.
+ */
+ unsigned short port;
+
};
/**
Modified: GNUnet/src/include/gnunet_transport.h
===================================================================
--- GNUnet/src/include/gnunet_transport.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/include/gnunet_transport.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -108,7 +108,7 @@
/**
* The identity of the local node.
*/
- GNUNET_PeerIdentity *myIdentity;
+ GNUNET_PeerIdentity *my_identity;
/**
* System error context
@@ -144,7 +144,7 @@
* loaded or unloaded inside the module initialization or shutdown
* code.
*/
- void *(*request_service) (const char *name);
+ void *(*service_request) (const char *name);
/**
* Notification that the given service is no longer required. This
@@ -156,9 +156,9 @@
*
* @return GNUNET_OK if service was successfully released, GNUNET_SYSERR on
error
*/
- int (*release_service) (void *service);
+ int (*service_release) (void *service);
- int (*connection_assert_tsession_unused) (GNUNET_TSession * tsession);
+ int (*tsession_assert_unused) (GNUNET_TSession * tsession);
} GNUNET_CoreAPIForTransport;
@@ -191,13 +191,13 @@
* the transport should never do ANYTHING
* with it.
*/
- struct GNUNET_PluginHandle *libHandle;
+ struct GNUNET_PluginHandle *library_handle;
/**
* The name of the transport, set by the
* core. Read only for the service itself!
*/
- char *transName;
+ char *transport_name;
/**
* This field holds a cached hello for this
@@ -212,7 +212,7 @@
* The number of the protocol that is supported by this transport
* API (i.e. 6 tcp, 17 udp, 80 http, 25 smtp, etc.)
*/
- unsigned short protocolNumber;
+ unsigned short protocol_number;
/**
* The MTU for the protocol (e.g. 1472 for UDP).
@@ -237,7 +237,7 @@
* (the signature/crc have been verified before)
* @return GNUNET_OK if the helo is well-formed
*/
- int (*verifyHello) (const GNUNET_MessageHello * hello);
+ int (*hello_verify) (const GNUNET_MessageHello * hello);
/**
* Create a hello-Message for the current node. The hello is
@@ -250,9 +250,16 @@
* @return GNUNET_OK on success, GNUNET_SYSERR on error (e.g. send-only
* transports return GNUNET_SYSERR here)
*/
- GNUNET_MessageHello *(*createhello) (void);
+ GNUNET_MessageHello *(*hello_create) (void);
/**
+ * Convert hello to network address.
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ */
+ int (*hello_to_address) (const GNUNET_MessageHello * hello,
+ void **sa, unsigned int *sa_len);
+
+ /**
* Establish a connection to a remote node.
*
* @param hello the hello-Message for the target node
@@ -264,23 +271,6 @@
GNUNET_TSession ** tsession, int may_reuse);
/**
- * Send a message to the specified remote node.
- * @param tsession an opaque session handle (e.g. a socket
- * or the hello_message from connect)
- * @param msg the message
- * @param size the size of the message, <= mtu
- * @param important GNUNET_YES if message is important (i.e. grow
- * buffers to queue if needed)
- * @return GNUNET_SYSERR on error, GNUNET_NO on temporary error (retry),
- * GNUNET_YES/GNUNET_OK on success; after any persistent error,
- * the caller must call "disconnect" and not continue
- * using the session afterwards (useful if the other
- * side closed the connection).
- */
- int (*send) (GNUNET_TSession * tsession,
- const void *msg, unsigned int size, int important);
-
- /**
* A (core) Session is to be associated with a transport session. The
* transport service may want to know in order to call back on the
* core if the connection is being closed. Associate can also be
@@ -317,25 +307,23 @@
int (*disconnect) (GNUNET_TSession * tsession);
/**
- * Start the server process to receive inbound traffic.
- * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
+ * Send a message to the specified remote node.
+ * @param tsession an opaque session handle (e.g. a socket
+ * or the hello_message from connect)
+ * @param msg the message
+ * @param size the size of the message, <= mtu
+ * @param important GNUNET_YES if message is important (i.e. grow
+ * buffers to queue if needed)
+ * @return GNUNET_SYSERR on error, GNUNET_NO on temporary error (retry),
+ * GNUNET_YES/GNUNET_OK on success; after any persistent error,
+ * the caller must call "disconnect" and not continue
+ * using the session afterwards (useful if the other
+ * side closed the connection).
*/
- int (*startTransportServer) (void);
+ int (*send) (GNUNET_TSession * tsession,
+ const void *msg, unsigned int size, int important);
/**
- * Shutdown the server process (stop receiving inbound
- * traffic). Maybe restarted later!
- */
- int (*stopTransportServer) (void);
-
- /**
- * Convert hello to network address.
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
- */
- int (*helloToAddress) (const GNUNET_MessageHello * hello,
- void **sa, unsigned int *sa_len);
-
- /**
* Test if the transport would even try to send
* a message of the given size and importance
* for the given session.<br>
@@ -348,9 +336,21 @@
* GNUNET_NO if the transport would just drop the message,
* GNUNET_SYSERR if the size/session is invalid
*/
- int (*testWouldTry) (GNUNET_TSession * tsession, unsigned int size,
- int important);
+ int (*send_now_test) (GNUNET_TSession * tsession, unsigned int size,
+ int important);
+ /**
+ * Start the server process to receive inbound traffic.
+ * @return GNUNET_OK on success, GNUNET_SYSERR if the operation failed
+ */
+ int (*server_start) (void);
+
+ /**
+ * Shutdown the server process (stop receiving inbound
+ * traffic). Maybe restarted later!
+ */
+ int (*server_stop) (void);
+
} GNUNET_TransportAPI;
/**
Modified: GNUnet/src/include/gnunet_transport_service.h
===================================================================
--- GNUnet/src/include/gnunet_transport_service.h 2008-03-25 03:16:20 UTC
(rev 6614)
+++ GNUnet/src/include/gnunet_transport_service.h 2008-03-25 06:23:12 UTC
(rev 6615)
@@ -49,6 +49,11 @@
typedef struct
{
+ /**
+ * Add an implementation of a transport protocol.
+ */
+ int (*add) (GNUNET_TransportAPI * tapi);
+
/**
* Actually start the transport services and begin
* receiving messages.
@@ -64,22 +69,28 @@
* Is this transport mechanism available (for sending)?
* @return GNUNET_YES or GNUNET_NO
*/
- int (*isAvailable) (unsigned short ttype);
+ int (*test_available) (unsigned short ttype);
/**
- * Add an implementation of a transport protocol.
- */
- int (*add) (GNUNET_TransportAPI * tapi);
-
- /**
* Iterate over all available transport mechanisms.
* @param callback the method to call on each transport API implementation
* @param data second argument to callback
* @return number of transports, GNUNET_SYSERR on error
*/
- int (*forEach) (GNUNET_TransportCallback callback, void *data);
+ int (*iterate_available) (GNUNET_TransportCallback callback, void *data);
/**
+ * Get the cost of a message in for the given transport mechanism.
+ */
+ unsigned int (*cost_get) (int ttype);
+
+ /**
+ * Get the MTU for a given transport type.
+ */
+ int (*mtu_get) (unsigned short ttype);
+
+
+ /**
* Connect to a remote host using the advertised transport
* layer. This may fail if the appropriate transport mechanism is
* not available.
@@ -105,8 +116,8 @@
* (must match when disconnect is called)
* @return session handle on success, NULL on error
*/
- GNUNET_TSession *(*connectFreely) (const GNUNET_PeerIdentity * peer,
- int allowTempList, const char *token);
+ GNUNET_TSession *(*connect_freely) (const GNUNET_PeerIdentity * peer,
+ int allowTempList, const char *token);
/**
* A (core) Session is to be associated with a transport session. The
@@ -126,9 +137,14 @@
int (*associate) (GNUNET_TSession * tsession, const char *token);
/**
- * Get the cost of a message in for the given transport mechanism.
+ * Close the session with the remote node. May only be called on
+ * either connected or associated sessions.
+ * @param token string identifying who is holding the reference
+ * (must match when connect/assciate call)
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
- unsigned int (*getCost) (int ttype);
+ int (*disconnect) (GNUNET_TSession * session, const char *token);
/**
* Send a message. Drop if the operation would block.
@@ -144,14 +160,20 @@
const void *msg, unsigned int size, int important);
/**
- * Close the session with the remote node. May only be called on
- * either connected or associated sessions.
- * @param token string identifying who is holding the reference
- * (must match when connect/assciate call)
+ * Test if the transport would even try to send
+ * a message of the given size and importance
+ * for the given session.<br>
+ * This function is used to check if the core should
+ * even bother to construct (and encrypt) this kind
+ * of message.
*
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return GNUNET_YES if the transport would try (i.e. queue
+ * the message or call the OS to send),
+ * GNUNET_NO if the transport would just drop the message,
+ * GNUNET_SYSERR if the size/session is invalid
*/
- int (*disconnect) (GNUNET_TSession * session, const char *token);
+ int (*send_now_test) (GNUNET_TSession * tsession, unsigned int size,
+ int important);
/**
* Verify that a hello is ok. Call a method
@@ -159,26 +181,21 @@
* @return GNUNET_OK if the attempt to verify is on the way,
* GNUNET_SYSERR if the transport mechanism is not supported
*/
- int (*verifyhello) (const GNUNET_MessageHello * hello);
+ int (*hello_verify) (const GNUNET_MessageHello * hello);
/**
* Get the network address from a HELLO.
*
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
- int (*helloToAddress) (const GNUNET_MessageHello * hello,
- void **sa, unsigned int *sa_len);
+ int (*hello_to_address) (const GNUNET_MessageHello * hello,
+ void **sa, unsigned int *sa_len);
/**
- * Get the MTU for a given transport type.
- */
- int (*getMTU) (unsigned short ttype);
-
- /**
* Create a hello advertisement for the given
* transport type for this node.
*/
- GNUNET_MessageHello *(*createhello) (unsigned short ttype);
+ GNUNET_MessageHello *(*hello_create) (unsigned short ttype);
/**
* Get a message consisting of (if possible) all addresses that this
@@ -193,29 +210,13 @@
* @param buff where to write the hello messages
* @return the number of bytes written to buff, -1 on error
*/
- int (*getAdvertisedhellos) (unsigned int maxLen, char *buff);
+ int (*hello_advertisements_get) (unsigned int maxLen, char *buff);
/**
- * Test if the transport would even try to send
- * a message of the given size and importance
- * for the given session.<br>
- * This function is used to check if the core should
- * even bother to construct (and encrypt) this kind
- * of message.
- *
- * @return GNUNET_YES if the transport would try (i.e. queue
- * the message or call the OS to send),
- * GNUNET_NO if the transport would just drop the message,
- * GNUNET_SYSERR if the size/session is invalid
- */
- int (*testWouldTry) (GNUNET_TSession * tsession, unsigned int size,
- int important);
-
- /**
* Verify that this session is associated (with the given
* token).
*/
- int (*assertAssociated) (GNUNET_TSession * tsession, const char *token);
+ int (*assert_associated) (GNUNET_TSession * tsession, const char *token);
} GNUNET_Transport_ServiceAPI;
Modified: GNUnet/src/include/gnunet_util_core.h
===================================================================
--- GNUnet/src/include/gnunet_util_core.h 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/include/gnunet_util_core.h 2008-03-25 06:23:12 UTC (rev
6615)
@@ -80,7 +80,7 @@
/**
* time this address expires (network byte order)
*/
- GNUNET_Int32Time expirationTime;
+ GNUNET_Int32Time expiration_time;
/**
* advertised MTU for sending (replies can have a different
Modified: GNUnet/src/include/platform.h
===================================================================
--- GNUnet/src/include/platform.h 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/include/platform.h 2008-03-25 06:23:12 UTC (rev 6615)
@@ -23,6 +23,9 @@
* @brief plaform specifics
*
* @author Nils Durner
+ *
+ * This file should never be included by installed
+ * header files (thos starting with "gnunet_").
*/
#ifndef PLATFORM_H
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/server/connection.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -314,7 +314,7 @@
/**
* Entry in the send buffer. Contains the size of the message, the
- * priority, when the message was passed to unicast, a callback to
+ * priority, when the message was passed to ciphertext_send, a callback to
* fill in the actual message and a closure (argument to the
* callback).
*/
@@ -721,9 +721,9 @@
if (root->session.tsession != NULL)
GNUNET_GE_ASSERT (NULL,
GNUNET_OK ==
- transport->assertAssociated (root->session.
- tsession,
- __FILE__));
+ transport->assert_associated (root->session.
+ tsession,
+ __FILE__));
root = root->overflowChain;
}
}
@@ -1626,14 +1626,14 @@
if (be->session.tsession != NULL)
return GNUNET_OK;
be->session.tsession =
- transport->connectFreely (&be->session.sender, GNUNET_NO, __FILE__);
+ transport->connect_freely (&be->session.sender, GNUNET_NO, __FILE__);
if (be->session.tsession == NULL)
{
be->status = STAT_DOWN;
be->time_established = 0;
return GNUNET_NO;
}
- be->session.mtu = transport->getMTU (be->session.tsession->ttype);
+ be->session.mtu = transport->mtu_get (be->session.tsession->ttype);
fragmentIfNecessary (be);
return GNUNET_OK;
}
@@ -1708,11 +1708,11 @@
be->inSendBuffer = GNUNET_NO;
return GNUNET_NO;
}
- ret = transport->testWouldTry (be->session.tsession,
- totalMessageSize,
- (priority >=
- GNUNET_EXTREME_PRIORITY) ? GNUNET_YES :
- GNUNET_NO);
+ ret = transport->send_now_test (be->session.tsession,
+ totalMessageSize,
+ (priority >=
+ 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)
@@ -2930,10 +2930,10 @@
GNUNET_GE_BREAK (NULL, root->session.mtu != 0);
alternative =
- transport->connectFreely (&root->session.sender,
- GNUNET_NO, __FILE__);
+ transport->connect_freely (&root->session.sender,
+ GNUNET_NO, __FILE__);
if ((alternative != NULL)
- && (transport->getMTU (alternative->ttype) == 0))
+ && (transport->mtu_get (alternative->ttype) == 0))
{
tsession = root->session.tsession;
root->session.mtu = 0;
@@ -3541,7 +3541,7 @@
}
cost = -1;
if (be->session.tsession != NULL)
- cost = transport->getCost (be->session.tsession->ttype);
+ cost = transport->cost_get (be->session.tsession->ttype);
/* Question: doesn't this always do takeover in tcp/udp
case, which have the same costs? Should it? -IW
@@ -3553,14 +3553,14 @@
to get to know each other). See also transport paper and the
data on throughput. - CG
*/
- if (((transport->getCost (tsession->ttype) < cost) ||
+ if (((transport->cost_get (tsession->ttype) < cost) ||
((be->consider_transport_switch == GNUNET_YES) &&
- (transport->getMTU (tsession->ttype) == 0))) &&
+ (transport->mtu_get (tsession->ttype) == 0))) &&
(GNUNET_OK == transport->associate (tsession, __FILE__)))
{
GNUNET_GE_ASSERT (NULL,
- GNUNET_OK == transport->assertAssociated (tsession,
- __FILE__));
+ GNUNET_OK == transport->assert_associated (tsession,
+ __FILE__));
ts = be->session.tsession;
if (ts != NULL)
{
@@ -3568,9 +3568,9 @@
transport->disconnect (ts, __FILE__);
}
be->session.tsession = tsession;
- be->session.mtu = transport->getMTU (tsession->ttype);
+ be->session.mtu = transport->mtu_get (tsession->ttype);
if ((be->consider_transport_switch == GNUNET_YES) &&
- (transport->getMTU (tsession->ttype) == 0))
+ (transport->mtu_get (tsession->ttype) == 0))
be->consider_transport_switch = GNUNET_NO;
check_invariants ();
fragmentIfNecessary (be);
@@ -3958,7 +3958,7 @@
* @param priority the higher the priority, the higher preference
* will be given to polling this callback (compared to
* other callbacks). Note that polling will always
- * only be done after all push requests (unicast) have
+ * only be done after all push requests (ciphertext_send) have
* been considered
* @param callback the method to invoke. The receiver is the
* receiver of the message, position is the reference to the
@@ -4072,8 +4072,8 @@
ENTRY ();
GNUNET_GE_ASSERT (ectx, tsession != NULL);
- if ((transport->getMTU (tsession->ttype) > 0) &&
- (transport->getMTU (tsession->ttype) <
+ if ((transport->mtu_get (tsession->ttype) > 0) &&
+ (transport->mtu_get (tsession->ttype) <
size + sizeof (GNUNET_TransportPacket_HEADER)))
{
GNUNET_GE_BREAK (ectx, 0);
Modified: GNUnet/src/server/core.c
===================================================================
--- GNUnet/src/server/core.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/server/core.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -529,65 +529,65 @@
applicationCore.load_monitor = monitor;
applicationCore.cron = cron;
applicationCore.version = 0;
- applicationCore.myIdentity = NULL; /* for now */
- applicationCore.request_service = &GNUNET_CORE_request_service; /*
core.c */
- applicationCore.release_service = &GNUNET_CORE_release_service; /*
core.c */
+ applicationCore.my_identity = NULL; /* for now */
+ applicationCore.service_request = &GNUNET_CORE_request_service; /*
core.c */
+ applicationCore.service_release = &GNUNET_CORE_release_service; /*
core.c */
- applicationCore.connection_send_plaintext =
&GNUNET_CORE_connection_send_plaintext; /* connection.c */
- applicationCore.unicast = &GNUNET_CORE_connection_unicast; /*
connection.c */
- applicationCore.connection_send_using_callback =
&GNUNET_CORE_connection_send_using_callback; /* connection.c */
- applicationCore.forAllConnectedNodes =
&GNUNET_CORE_connection_iterate_peers; /* connection.c */
- applicationCore.connection_register_send_callback =
&GNUNET_CORE_connection_register_send_callback; /* connection.c */
- applicationCore.connection_unregister_send_callback =
&GNUNET_CORE_connection_unregister_send_callback; /* connection.c */
- applicationCore.reserve_downstream_bandwidth =
&GNUNET_CORE_connection_reserve_downstream_bandwidth; /* connection.c */
- applicationCore.register_notify_peer_disconnect =
&GNUNET_CORE_connection_register_notify_peer_disconnect; /* connection .c */
- applicationCore.unregister_notify_peer_disconnect =
&GNUNET_CORE_connection_unregister_notify_peer_disconnect; /* connection
.c */
+ applicationCore.plaintext_send = &GNUNET_CORE_connection_send_plaintext;
/* connection.c */
+ applicationCore.ciphertext_send = &GNUNET_CORE_connection_unicast; /*
connection.c */
+ applicationCore.ciphertext_send_with_callback =
&GNUNET_CORE_connection_send_using_callback; /* connection.c */
+ applicationCore.p2p_connections_iterate =
&GNUNET_CORE_connection_iterate_peers; /* connection.c */
+ applicationCore.send_callback_register =
&GNUNET_CORE_connection_register_send_callback; /* connection.c */
+ applicationCore.send_callback_unregister =
&GNUNET_CORE_connection_unregister_send_callback; /* connection.c */
+ applicationCore.p2p_bandwidth_downstream_reserve =
&GNUNET_CORE_connection_reserve_downstream_bandwidth; /* connection.c */
+ applicationCore.peer_disconnect_notification_register =
&GNUNET_CORE_connection_register_notify_peer_disconnect; /* connection .c
*/
+ applicationCore.peer_disconnect_notification_unregister =
&GNUNET_CORE_connection_unregister_notify_peer_disconnect; /* connection .c */
- applicationCore.connection_register_send_notification_callback =
+ applicationCore.peer_send_notification_register =
&GNUNET_CORE_connection_register_send_notification_callback;
applicationCore.
- connection_unregister_send_notification_callback =
+ peer_send_notification_unregister =
&GNUNET_CORE_connection_unregister_send_notification_callback;
- applicationCore.registerHandler = &GNUNET_CORE_p2p_register_handler; /*
handler.c */
- applicationCore.unregisterHandler = &GNUNET_CORE_p2p_unregister_handler;
/* handler.c */
- applicationCore.plaintext_register_handler =
&GNUNET_CORE_plaintext_register_handler; /* handler.c */
- applicationCore.plaintext_unregister_handler =
&GNUNET_CORE_plaintext_unregister_handler; /* handler.c */
- applicationCore.p2p_test_handler_registered =
&GNUNET_CORE_p2p_test_handler_registered; /* handler.c */
+ applicationCore.p2p_ciphertext_handler_register =
&GNUNET_CORE_p2p_register_handler; /* handler.c */
+ applicationCore.p2p_ciphertext_handler_unregister =
&GNUNET_CORE_p2p_unregister_handler; /* handler.c */
+ applicationCore.p2p_plaintext_handler_register =
&GNUNET_CORE_plaintext_register_handler; /* handler.c */
+ applicationCore.p2p_plaintext_handler_unregister =
&GNUNET_CORE_plaintext_unregister_handler; /* handler.c */
+ applicationCore.p2p_message_handler_registered_test =
&GNUNET_CORE_p2p_test_handler_registered; /* handler.c */
- applicationCore.offerTSessionFor =
&GNUNET_CORE_connection_consider_takeover; /* connection.c */
- applicationCore.connection_assign_session_key_to_peer =
&GNUNET_CORE_connection_assign_session_key_to_peer; /* connection.c */
- applicationCore.connection_get_session_key_of_peer =
&GNUNET_CORE_connection_get_session_key_of_peer; /* connection.c */
- applicationCore.connection_mark_session_as_confirmed =
&GNUNET_CORE_connection_mark_session_as_confirmed; /* connection.c */
- applicationCore.preferTrafficFrom =
&GNUNET_CORE_connection_update_traffic_preference_for_peer; /*
connection.c */
- applicationCore.queryPeerStatus =
&GNUNET_CORE_connection_get_bandwidth_assigned_to_peer; /* connection.c */
- applicationCore.connection_disconnect_from_peer =
&GNUNET_CORE_connection_disconnect_from_peer; /* connection.c */
+ applicationCore.p2p_transport_session_offer =
&GNUNET_CORE_connection_consider_takeover; /* connection.c */
+ applicationCore.p2p_session_key_set =
&GNUNET_CORE_connection_assign_session_key_to_peer; /* connection.c */
+ applicationCore.p2p_session_key_get =
&GNUNET_CORE_connection_get_session_key_of_peer; /* connection.c */
+ applicationCore.p2p_connection_confirm =
&GNUNET_CORE_connection_mark_session_as_confirmed; /* connection.c */
+ applicationCore.p2p_connection_preference_increase =
&GNUNET_CORE_connection_update_traffic_preference_for_peer; /*
connection.c */
+ applicationCore.p2p_connection_status_check =
&GNUNET_CORE_connection_get_bandwidth_assigned_to_peer; /* connection.c */
+ applicationCore.p2p_connection_close =
&GNUNET_CORE_connection_disconnect_from_peer; /* connection.c */
- applicationCore.sendValueToClient = &GNUNET_CORE_cs_send_result_to_client;
/* tcpserver.c */
- applicationCore.cs_send_to_client = &GNUNET_CORE_cs_send_to_client; /*
tcpserver.c */
- applicationCore.cs_test_send_to_client_now =
&GNUNET_CORE_cs_test_send_to_client_now; /* tcpserver.c */
- applicationCore.registerClientHandler = &GNUNET_CORE_register_handler;
/* tcpserver.c */
- applicationCore.unregisterClientHandler = &GNUNET_CORE_unregister_handler;
/* tcpserver.c */
- applicationCore.cs_exit_handler_register =
&GNUNET_CORE_cs_register_exit_handler; /* tcpserver.c */
- applicationCore.cs_exit_handler_unregister =
&GNUNET_CORE_cs_exit_handler_unregister; /* tcpserver.c */
- applicationCore.cs_terminate_client_connection =
&GNUNET_CORE_cs_terminate_client_connection; /* tcpserver.c */
+ applicationCore.cs_send_value = &GNUNET_CORE_cs_send_result_to_client;
/* tcpserver.c */
+ applicationCore.cs_send_message = &GNUNET_CORE_cs_send_to_client; /*
tcpserver.c */
+ applicationCore.cs_send_message_now_test =
&GNUNET_CORE_cs_test_send_to_client_now; /* tcpserver.c */
+ applicationCore.cs_handler_register = &GNUNET_CORE_register_handler; /*
tcpserver.c */
+ applicationCore.cs_handler_unregister = &GNUNET_CORE_unregister_handler;
/* tcpserver.c */
+ applicationCore.cs_disconnect_handler_register =
&GNUNET_CORE_cs_register_exit_handler; /* tcpserver.c */
+ applicationCore.cs_disconnect_handler_unregister =
&GNUNET_CORE_cs_exit_handler_unregister; /* tcpserver.c */
+ applicationCore.cs_disconnect_now =
&GNUNET_CORE_cs_terminate_client_connection; /* tcpserver.c */
- applicationCore.p2p_inject_message = &GNUNET_CORE_p2p_inject_message; /*
handler.c */
- applicationCore.connection_compute_index_of_peer =
&GNUNET_CORE_connection_compute_index_of_peer; /* connection.c */
- applicationCore.connection_get_lock = &GNUNET_CORE_connection_get_lock;
/* connection.c */
- applicationCore.connection_get_slot_count =
&GNUNET_CORE_connection_get_slot_count; /* connection.c */
- applicationCore.connection_is_slot_used =
&GNUNET_CORE_connection_is_slot_used; /* connection.c */
- applicationCore.connection_get_last_activity_of_peer =
&GNUNET_CORE_connection_get_last_activity_of_peer; /* connection.c */
- applicationCore.connection_assert_tsession_unused =
&GNUNET_CORE_connection_assert_tsession_unused; /* connection.c */
+ applicationCore.loopback_send = &GNUNET_CORE_p2p_inject_message; /*
handler.c */
+ applicationCore.core_slot_index_get =
&GNUNET_CORE_connection_compute_index_of_peer; /* connection.c */
+ applicationCore.global_lock_get = &GNUNET_CORE_connection_get_lock; /*
connection.c */
+ applicationCore.core_slots_count = &GNUNET_CORE_connection_get_slot_count;
/* connection.c */
+ applicationCore.core_slot_test_used = &GNUNET_CORE_connection_is_slot_used;
/* connection.c */
+ applicationCore.p2p_connection_last_activity_get =
&GNUNET_CORE_connection_get_last_activity_of_peer; /* connection.c */
+ applicationCore.tsession_assert_unused =
&GNUNET_CORE_connection_assert_tsession_unused; /* connection.c */
- applicationCore.sendErrorMessageToClient =
&GNUNET_CORE_cs_send_error_to_client; /* tcpserver.c */
- applicationCore.cs_create_client_log_context =
&GNUNET_CORE_cs_create_client_log_context; /* tcpserver.c */
+ applicationCore.cs_send_error = &GNUNET_CORE_cs_send_error_to_client; /*
tcpserver.c */
+ applicationCore.cs_log_context_create =
&GNUNET_CORE_cs_create_client_log_context; /* tcpserver.c */
identity = GNUNET_CORE_request_service ("identity");
if (identity == NULL)
return GNUNET_SYSERR;
identity->getPeerIdentity (identity->getPublicPrivateKey (), &myIdentity);
- applicationCore.myIdentity = &myIdentity; /* core.c */
+ applicationCore.my_identity = &myIdentity; /* core.c */
if (GNUNET_CORE_cs_init (ectx, cfg) != GNUNET_OK)
{
GNUNET_CORE_release_service (identity);
Modified: GNUnet/src/server/gnunet-peer-info.c
===================================================================
--- GNUnet/src/server/gnunet-peer-info.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/server/gnunet-peer-info.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -79,7 +79,7 @@
return GNUNET_OK;
addr = NULL;
addr_len = 0;
- have_addr = transport->helloToAddress (hello, &addr, &addr_len);
+ have_addr = transport->hello_to_address (hello, &addr, &addr_len);
GNUNET_free (hello);
if (have_addr == GNUNET_OK)
{
@@ -134,7 +134,7 @@
}
addr = NULL;
addr_len = 0;
- have_addr = transport->helloToAddress (hello, &addr, &addr_len);
+ have_addr = transport->hello_to_address (hello, &addr, &addr_len);
GNUNET_free (hello);
if (have_addr != GNUNET_OK)
{
Modified: GNUnet/src/server/gnunet-transport-check.c
===================================================================
--- GNUnet/src/server/gnunet-transport-check.c 2008-03-25 03:16:20 UTC (rev
6614)
+++ GNUnet/src/server/gnunet-transport-check.c 2008-03-25 06:23:12 UTC (rev
6615)
@@ -110,22 +110,23 @@
int ret;
GNUNET_GE_ASSERT (ectx, tapi != NULL);
- if (tapi->protocolNumber == GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT)
+ if (tapi->protocol_number == GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT)
{
*res = GNUNET_OK;
return; /* NAT cannot be tested */
}
- helo = tapi->createhello ();
+ helo = tapi->hello_create ();
if (helo == NULL)
{
- fprintf (stderr, _("`%s': Could not create hello.\n"), tapi->transName);
+ fprintf (stderr, _("`%s': Could not create hello.\n"),
+ tapi->transport_name);
*res = GNUNET_SYSERR;
return;
}
tsession = NULL;
if (GNUNET_OK != tapi->connect (helo, &tsession, GNUNET_NO))
{
- fprintf (stderr, _("`%s': Could not connect.\n"), tapi->transName);
+ fprintf (stderr, _("`%s': Could not connect.\n"), tapi->transport_name);
*res = GNUNET_SYSERR;
GNUNET_free (helo);
return;
@@ -159,7 +160,8 @@
ntohs (noise->size));
if (ret != GNUNET_OK)
{
- fprintf (stderr, _("`%s': Could not send.\n"), tapi->transName);
+ fprintf (stderr, _("`%s': Could not send.\n"),
+ tapi->transport_name);
*res = GNUNET_SYSERR;
tapi->disconnect (tsession);
GNUNET_semaphore_destroy (sem);
@@ -175,7 +177,7 @@
{
FPRINTF (stderr,
_("`%s': Did not receive message within %llu ms.\n"),
- tapi->transName, timeout);
+ tapi->transport_name, timeout);
*res = GNUNET_SYSERR;
tapi->disconnect (tsession);
GNUNET_semaphore_destroy (sem);
@@ -187,7 +189,8 @@
end = GNUNET_get_time ();
if (GNUNET_OK != tapi->disconnect (tsession))
{
- fprintf (stderr, _("`%s': Could not disconnect.\n"), tapi->transName);
+ fprintf (stderr, _("`%s': Could not disconnect.\n"),
+ tapi->transport_name);
*res = GNUNET_SYSERR;
GNUNET_semaphore_destroy (sem);
return;
@@ -195,7 +198,7 @@
GNUNET_semaphore_destroy (sem);
printf (_
("`%s' transport OK. It took %ums to transmit %llu messages of %llu
bytes each.\n"),
- tapi->transName,
+ tapi->transport_name,
(unsigned int) ((end - start) / GNUNET_CRON_MILLISECONDS), total,
expectedSize);
}
@@ -221,7 +224,7 @@
unsigned long long verbose;
stats[0]++; /* one more seen */
- if (GNUNET_NO == transport->isAvailable (ntohs (xhello->protocol)))
+ if (GNUNET_NO == transport->test_available (ntohs (xhello->protocol)))
{
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
@@ -245,7 +248,7 @@
unsigned int addr_len;
int have_addr;
- have_addr = transport->helloToAddress (xhello, &addr, &addr_len);
+ have_addr = transport->hello_to_address (xhello, &addr, &addr_len);
if (have_addr == GNUNET_NO)
{
str = GNUNET_strdup ("NAT"); /* most likely */
@@ -263,10 +266,10 @@
hello = GNUNET_malloc (ntohs (xhello->header.size));
memcpy (hello, xhello, ntohs (xhello->header.size));
- myHello = transport->createhello (ntohs (xhello->protocol));
+ myHello = transport->hello_create (ntohs (xhello->protocol));
if (myHello == NULL)
/* try NAT */
- myHello = transport->createhello (GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT);
+ myHello = transport->hello_create (GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT);
if (myHello == NULL)
{
GNUNET_free (hello);
@@ -497,7 +500,7 @@
else
{
while ((Xrepeat-- > 0) && (GNUNET_shutdown_test () == GNUNET_NO))
- transport->forEach (&testTAPI, &res);
+ transport->iterate_available (&testTAPI, &res);
}
GNUNET_cron_stop (cron);
GNUNET_CORE_release_service (identity);
Modified: GNUnet/src/server/gnunet-update.c
===================================================================
--- GNUnet/src/server/gnunet-update.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/server/gnunet-update.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -186,9 +186,9 @@
struct GNUNET_CronManager *cron;
char *topo;
- uapi.updateModule = &updateModule;
- uapi.request_service = &GNUNET_CORE_request_service;
- uapi.release_service = &GNUNET_CORE_release_service;
+ uapi.service_update = &updateModule;
+ uapi.service_request = &GNUNET_CORE_request_service;
+ uapi.service_release = &GNUNET_CORE_release_service;
uapi.ectx = ectx;
uapi.cfg = cfg;
Modified: GNUnet/src/server/tcpserver.c
===================================================================
--- GNUnet/src/server/tcpserver.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/server/tcpserver.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -247,12 +247,10 @@
int
GNUNET_CORE_cs_test_send_to_client_now (struct GNUNET_ClientHandle *handle,
- unsigned int size,
- int force)
+ unsigned int size, int force)
{
- return GNUNET_select_test_write_now (selector, handle->sock,
- size, GNUNET_NO,
- force);
+ return GNUNET_select_test_write_now (selector, handle->sock,
+ size, GNUNET_NO, force);
}
void
Modified: GNUnet/src/server/tcpserver.h
===================================================================
--- GNUnet/src/server/tcpserver.h 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/server/tcpserver.h 2008-03-25 06:23:12 UTC (rev 6615)
@@ -96,9 +96,9 @@
* Test if we would be able to queue a message for delivery to this
* client right now.
*/
-int GNUNET_CORE_cs_test_send_to_client_now (struct GNUNET_ClientHandle *handle,
- unsigned int size,
- int would_force);
+int GNUNET_CORE_cs_test_send_to_client_now (struct GNUNET_ClientHandle
+ *handle, unsigned int size,
+ int would_force);
/**
Modified: GNUnet/src/transports/common.c
===================================================================
--- GNUnet/src/transports/common.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/transports/common.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -214,7 +214,7 @@
GNUNET_GE_BREAK_OP (NULL, 0);
return GNUNET_SYSERR; /* invalid (external error) */
}
- if ((ntohs (hello->protocol) != myAPI.protocolNumber) ||
+ if ((ntohs (hello->protocol) != myAPI.protocol_number) ||
(ntohs (hello->header.type) != GNUNET_P2P_PROTO_HELLO))
{
GNUNET_GE_BREAK (NULL, 0);
@@ -439,7 +439,7 @@
haddr->port = htons (port);
haddr->availability = htons (available);
msg->senderAddressSize = htons (sizeof (HostAddress));
- msg->protocol = htons (myAPI.protocolNumber);
+ msg->protocol = htons (myAPI.protocol_number);
msg->MTU = htonl (myAPI.mtu);
return msg;
}
@@ -490,12 +490,12 @@
GNUNET_GC_detach_change_listener (cfg, &reload_configuration, NULL);
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
if (upnp != NULL)
{
- coreAPI->release_service (upnp);
+ coreAPI->service_release (upnp);
upnp = NULL;
}
GNUNET_free_non_null (filteredNetworksIPv4);
Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/transports/http.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -1145,7 +1145,7 @@
url = httpSession->cs.client.url;
if (url == NULL)
{
- GNUNET_hash_to_enc (&coreAPI->myIdentity->hashPubKey, &enc);
+ GNUNET_hash_to_enc (&coreAPI->my_identity->hashPubKey, &enc);
available = ntohs (haddr->availability) & available_protocols;
if (available == (VERSION_AVAILABLE_IPV4 | VERSION_AVAILABLE_IPV6))
{
@@ -2128,7 +2128,7 @@
"HTTP", "UPNP",
GNUNET_YES) == GNUNET_YES)
{
- upnp = coreAPI->request_service ("upnp");
+ upnp = coreAPI->service_request ("upnp");
if (upnp == NULL)
{
@@ -2141,7 +2141,7 @@
}
}
- stats = coreAPI->request_service ("stats");
+ stats = coreAPI->service_request ("stats");
if (stats != NULL)
{
stat_bytesReceived
@@ -2177,19 +2177,19 @@
"GNUNETD", "HTTP-PROXY", "",
&proxy);
- myAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_HTTP;
+ myAPI.protocol_number = GNUNET_TRANSPORT_PROTOCOL_NUMBER_HTTP;
myAPI.mtu = 0;
myAPI.cost = 20000; /* about equal to udp */
- myAPI.verifyHello = &verify_hello;
- myAPI.createhello = &create_hello;
+ myAPI.hello_verify = &verify_hello;
+ myAPI.hello_create = &create_hello;
myAPI.connect = &httpConnect;
myAPI.associate = &httpAssociate;
myAPI.send = &httpSend;
myAPI.disconnect = &httpDisconnect;
- myAPI.startTransportServer = &startTransportServer;
- myAPI.stopTransportServer = &stopTransportServer;
- myAPI.helloToAddress = &hello_to_address;
- myAPI.testWouldTry = &httpTestWouldTry;
+ myAPI.server_start = &startTransportServer;
+ myAPI.server_stop = &stopTransportServer;
+ myAPI.hello_to_address = &hello_to_address;
+ myAPI.send_now_test = &httpTestWouldTry;
EXIT ();
return &myAPI;
Modified: GNUnet/src/transports/nat.c
===================================================================
--- GNUnet/src/transports/nat.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/transports/nat.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -90,7 +90,7 @@
if (((0 == strcmp (choice, "YES")) ||
((0 == strcmp (choice, "AUTO")) &&
(lan_ip_detected ()))) &&
- (0 != memcmp (&coreAPI->myIdentity->hashPubKey,
+ (0 != memcmp (&coreAPI->my_identity->hashPubKey,
&hello->senderIdentity.hashPubKey,
sizeof (GNUNET_HashCode))))
{
@@ -232,19 +232,19 @@
inittransport_nat (GNUNET_CoreAPIForTransport * core)
{
coreAPI = core;
- natAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT;
+ natAPI.protocol_number = GNUNET_TRANSPORT_PROTOCOL_NUMBER_NAT;
natAPI.mtu = 0;
natAPI.cost = 30000;
- natAPI.verifyHello = &verifyHello;
- natAPI.createhello = &createhello;
+ natAPI.hello_verify = &verifyHello;
+ natAPI.hello_create = &createhello;
natAPI.connect = &natConnect;
natAPI.send = &natSend;
natAPI.associate = &natAssociate;
natAPI.disconnect = &natDisconnect;
- natAPI.startTransportServer = &startTransportServer;
- natAPI.stopTransportServer = &stopTransportServer;
- natAPI.helloToAddress = &helloToAddress;
- natAPI.testWouldTry = &testWouldTry;
+ natAPI.server_start = &startTransportServer;
+ natAPI.server_stop = &stopTransportServer;
+ natAPI.hello_to_address = &helloToAddress;
+ natAPI.send_now_test = &testWouldTry;
return &natAPI;
}
Modified: GNUnet/src/transports/smtp.c
===================================================================
--- GNUnet/src/transports/smtp.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/transports/smtp.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -620,7 +620,7 @@
mp = (SMTPMessage *) & m[size];
mp->header.size = htons (size + sizeof (SMTPMessage));
mp->header.type = htons (0);
- mp->sender = *coreAPI->myIdentity;
+ mp->sender = *coreAPI->my_identity;
gm_cls.ebody = NULL;
gm_cls.pos = 0;
gm_cls.esize =
@@ -703,7 +703,7 @@
tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello));
tsession->peer = hello->senderIdentity;
memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
- tsession->ttype = smtpAPI.protocolNumber;
+ tsession->ttype = smtpAPI.protocol_number;
(*tsessionPtr) = tsession;
return GNUNET_OK;
}
@@ -824,7 +824,7 @@
"SMTP",
"RATELIMIT",
0, 0, 1024 * 1024, &rate_limit);
- stats = coreAPI->request_service ("stats");
+ stats = coreAPI->service_request ("stats");
if (stats != NULL)
{
stat_bytesReceived
@@ -845,7 +845,7 @@
GNUNET_GE_ADMIN | GNUNET_GE_BULK |
GNUNET_GE_FATAL, "mkfifo");
GNUNET_free (pipename);
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
return NULL;
}
@@ -868,19 +868,19 @@
sa.sa_flags = 0;
sigaction (SIGPIPE, &sa, &old_handler);
- smtpAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP;
+ smtpAPI.protocol_number = GNUNET_TRANSPORT_PROTOCOL_NUMBER_SMTP;
smtpAPI.mtu = mtu - sizeof (SMTPMessage);
smtpAPI.cost = 50;
- smtpAPI.verifyHello = &api_verify_hello;
- smtpAPI.createhello = &api_create_hello;
+ smtpAPI.hello_verify = &api_verify_hello;
+ smtpAPI.hello_create = &api_create_hello;
smtpAPI.connect = &api_connect;
smtpAPI.send = &api_send;
smtpAPI.associate = &api_associate;
smtpAPI.disconnect = &api_disconnect;
- smtpAPI.startTransportServer = &api_start_transport_server;
- smtpAPI.stopTransportServer = &api_stop_transport_server;
- smtpAPI.helloToAddress = &api_hello_to_address;
- smtpAPI.testWouldTry = &api_test_would_try;
+ smtpAPI.server_start = &api_start_transport_server;
+ smtpAPI.server_stop = &api_stop_transport_server;
+ smtpAPI.hello_to_address = &api_hello_to_address;
+ smtpAPI.send_now_test = &api_test_would_try;
return &smtpAPI;
}
@@ -891,7 +891,7 @@
GNUNET_free (smtp_server_name);
if (stats != NULL)
{
- coreAPI->release_service (stats);
+ coreAPI->service_release (stats);
stats = NULL;
}
GNUNET_mutex_destroy (lock);
Modified: GNUnet/src/transports/tcp.c
===================================================================
--- GNUnet/src/transports/tcp.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/transports/tcp.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -166,8 +166,7 @@
GNUNET_mutex_unlock (lock);
GNUNET_GE_ASSERT (coreAPI->ectx,
GNUNET_OK ==
- coreAPI->
- connection_assert_tsession_unused (tcpsession->tsession));
+ coreAPI->tsession_assert_unused (tcpsession->tsession));
GNUNET_mutex_lock (lock);
GNUNET_free (tcpsession->tsession);
GNUNET_free (tcpsession);
@@ -327,7 +326,7 @@
tcpSession->sock = sock;
/* fill in placeholder identity to mark that we
are waiting for the welcome message */
- tcpSession->sender = *(coreAPI->myIdentity);
+ tcpSession->sender = *(coreAPI->my_identity);
tcpSession->expectingWelcome = GNUNET_YES;
tcpSession->users = 0;
tcpSession->in_select = GNUNET_YES;
@@ -337,7 +336,7 @@
tsession->ttype = GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP;
tsession->internal = tcpSession;
tcpSession->tsession = tsession;
- tsession->peer = *(coreAPI->myIdentity);
+ tsession->peer = *(coreAPI->my_identity);
if (addr_len > 0)
{
tcpSession->accept_addr = GNUNET_malloc (addr_len);
@@ -502,7 +501,7 @@
connection! */
welcome.header.size = htons (sizeof (TCPWelcome));
welcome.header.type = htons (0);
- welcome.clientIdentity = *(coreAPI->myIdentity);
+ welcome.clientIdentity = *(coreAPI->my_identity);
if (GNUNET_OK !=
GNUNET_select_write (selector, s, &welcome.header, GNUNET_NO,
GNUNET_YES))
@@ -630,7 +629,7 @@
GNUNET_socket_destroy (s);
return GNUNET_SYSERR;
}
- return tcp_connect_helper (hello, s, myAPI.protocolNumber, tsessionPtr);
+ return tcp_connect_helper (hello, s, myAPI.protocol_number, tsessionPtr);
}
/**
@@ -783,7 +782,7 @@
if (GNUNET_GC_get_configuration_value_yesno (cfg, "TCP", "UPNP", GNUNET_YES)
== GNUNET_YES)
{
- upnp = coreAPI->request_service ("upnp");
+ upnp = coreAPI->service_request ("upnp");
if (upnp == NULL)
{
@@ -796,7 +795,7 @@
}
}
- stats = coreAPI->request_service ("stats");
+ stats = coreAPI->service_request ("stats");
if (stats != NULL)
{
stat_bytesReceived
@@ -805,19 +804,19 @@
stat_bytesDropped
= stats->create (gettext_noop ("# bytes dropped by TCP (outgoing)"));
}
- myAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP;
+ myAPI.protocol_number = GNUNET_TRANSPORT_PROTOCOL_NUMBER_TCP;
myAPI.mtu = 0;
myAPI.cost = 20000; /* about equal to udp */
- myAPI.verifyHello = &verify_hello;
- myAPI.createhello = &create_hello;
+ myAPI.hello_verify = &verify_hello;
+ myAPI.hello_create = &create_hello;
myAPI.connect = &tcp_connect;
myAPI.associate = &tcp_associate;
myAPI.send = &tcp_send;
myAPI.disconnect = &tcp_disconnect;
- myAPI.startTransportServer = &tcp_transport_server_start;
- myAPI.stopTransportServer = &tcp_transport_server_stop;
- myAPI.helloToAddress = &hello_to_address;
- myAPI.testWouldTry = &tcp_test_would_try;
+ myAPI.server_start = &tcp_transport_server_start;
+ myAPI.server_stop = &tcp_transport_server_stop;
+ myAPI.hello_to_address = &hello_to_address;
+ myAPI.send_now_test = &tcp_test_would_try;
return &myAPI;
}
Modified: GNUnet/src/transports/test.c
===================================================================
--- GNUnet/src/transports/test.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/transports/test.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -114,7 +114,7 @@
tsession = mp->tsession;
if (tsession == NULL)
{
- hello = transport->createhello ();
+ hello = transport->hello_create ();
/* HACK hello -- change port! */
((HostAddress *) & hello[1])->port =
htons (ntohs (((HostAddress *) & hello[1])->port) - OFFSET);
@@ -239,11 +239,11 @@
goto cleanup;
}
api.cron = GNUNET_cron_create (api.ectx);
- api.myIdentity = &me;
+ api.my_identity = &me;
api.receive = &receive;
- api.request_service = &request_service;
- api.release_service = NULL; /* not needed */
- api.connection_assert_tsession_unused = &connection_assert_tsession_unused;
+ api.service_request = &request_service;
+ api.service_release = NULL; /* not needed */
+ api.tsession_assert_unused = &connection_assert_tsession_unused;
GNUNET_cron_start (api.cron);
res = GNUNET_OK;
transport = init (&api);
@@ -253,7 +253,7 @@
GNUNET_plugin_unload (plugin);
goto cleanup;
}
- transport->startTransportServer ();
+ transport->server_start ();
GNUNET_GE_ASSERT (NULL, (transport->mtu >= expectedSize)
|| (transport->mtu == 0));
GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS); /* give other process
time to start */
@@ -265,14 +265,14 @@
else
{
/* client - initiate requests */
- hello = transport->createhello ();
+ hello = transport->hello_create ();
/* HACK hello -- change port! */
((HostAddress *) & hello[1])->port =
htons (ntohs (((HostAddress *) & hello[1])->port) + OFFSET);
if (GNUNET_OK != transport->connect (hello, &tsession, GNUNET_NO))
{
GNUNET_free (hello);
- transport->stopTransportServer ();
+ transport->server_stop ();
GNUNET_plugin_unload (plugin);
goto cleanup;
}
@@ -303,7 +303,7 @@
transport->disconnect (tsession);
}
- transport->stopTransportServer ();
+ transport->server_stop ();
done = GNUNET_plugin_resolve_function (plugin, "donetransport_", GNUNET_NO);
if (done != NULL)
done ();
Modified: GNUnet/src/transports/test_repeat.c
===================================================================
--- GNUnet/src/transports/test_repeat.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/transports/test_repeat.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -116,7 +116,7 @@
tsession = mp->tsession;
if (tsession == NULL)
{
- hello = transport->createhello ();
+ hello = transport->hello_create ();
/* HACK hello -- change port! */
((HostAddress *) & hello[1])->port =
htons (ntohs (((HostAddress *) & hello[1])->port) - OFFSET);
@@ -250,11 +250,11 @@
goto cleanup;
}
api.cron = GNUNET_cron_create (api.ectx);
- api.myIdentity = &me;
+ api.my_identity = &me;
api.receive = &receive;
- api.request_service = &request_service;
- api.release_service = NULL; /* not needed */
- api.connection_assert_tsession_unused = &connection_assert_tsession_unused;
+ api.service_request = &request_service;
+ api.service_release = NULL; /* not needed */
+ api.tsession_assert_unused = &connection_assert_tsession_unused;
GNUNET_cron_start (api.cron);
res = GNUNET_OK;
transport = init (&api);
@@ -264,7 +264,7 @@
GNUNET_plugin_unload (plugin);
goto cleanup;
}
- transport->startTransportServer ();
+ transport->server_start ();
GNUNET_GE_ASSERT (NULL, (transport->mtu >= expectedSize)
|| (transport->mtu == 0));
GNUNET_thread_sleep (50 * GNUNET_CRON_MILLISECONDS); /* give other process
time to start */
@@ -279,14 +279,14 @@
{
fprintf (stderr, ".");
/* client - initiate requests */
- hello = transport->createhello ();
+ hello = transport->hello_create ();
/* HACK hello -- change port! */
((HostAddress *) & hello[1])->port =
htons (ntohs (((HostAddress *) & hello[1])->port) + OFFSET);
if (GNUNET_OK != transport->connect (hello, &tsession, GNUNET_NO))
{
GNUNET_free (hello);
- transport->stopTransportServer ();
+ transport->server_stop ();
GNUNET_plugin_unload (plugin);
goto cleanup;
}
@@ -317,14 +317,14 @@
transport->disconnect (tsession);
if ((xround % 3) == 0)
{
- transport->stopTransportServer ();
- transport->startTransportServer ();
+ transport->server_stop ();
+ transport->server_start ();
}
}
fprintf (stderr, "\n");
}
- transport->stopTransportServer ();
+ transport->server_stop ();
done = GNUNET_plugin_resolve_function (plugin, "donetransport_", GNUNET_NO);
if (done != NULL)
done ();
Modified: GNUnet/src/transports/udp.c
===================================================================
--- GNUnet/src/transports/udp.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/transports/udp.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -162,7 +162,7 @@
memset (tsession, 0, sizeof (GNUNET_TSession));
tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello));
memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
- tsession->ttype = myAPI.protocolNumber;
+ tsession->ttype = myAPI.protocol_number;
tsession->peer = hello->senderIdentity;
*tsessionPtr = tsession;
if (stats != NULL)
@@ -362,7 +362,7 @@
mp = GNUNET_malloc (ssize);
mp->header.size = htons (ssize);
mp->header.type = 0;
- mp->sender = *(coreAPI->myIdentity);
+ mp->sender = *(coreAPI->my_identity);
memcpy (&mp[1], message, size);
ok = GNUNET_SYSERR;
@@ -546,14 +546,14 @@
if (GNUNET_GC_get_configuration_value_yesno (cfg, "UDP", "UPNP", GNUNET_YES)
== GNUNET_YES)
{
- upnp = coreAPI->request_service ("upnp");
+ upnp = coreAPI->service_request ("upnp");
if (upnp == NULL)
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 \"UDP\" to
\"NO\"\n");
}
- stats = coreAPI->request_service ("stats");
+ stats = coreAPI->service_request ("stats");
if (stats != NULL)
{
stat_bytesReceived
@@ -564,19 +564,19 @@
stat_udpConnected
= stats->create (gettext_noop ("# UDP connections (right now)"));
}
- myAPI.protocolNumber = GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP;
+ myAPI.protocol_number = GNUNET_TRANSPORT_PROTOCOL_NUMBER_UDP;
myAPI.mtu = mtu - sizeof (UDPMessage);
myAPI.cost = 20000;
- myAPI.verifyHello = &verify_hello;
- myAPI.createhello = &create_hello;
+ myAPI.hello_verify = &verify_hello;
+ myAPI.hello_create = &create_hello;
myAPI.connect = &udp_connect;
myAPI.send = &udp_send;
myAPI.associate = &udp_associate;
myAPI.disconnect = &udp_disconnect;
- myAPI.startTransportServer = &udp_transport_server_start;
- myAPI.stopTransportServer = &udp_transport_server_stop;
- myAPI.helloToAddress = &hello_to_address;
- myAPI.testWouldTry = &udp_test_would_try;
+ myAPI.server_start = &udp_transport_server_start;
+ myAPI.server_stop = &udp_transport_server_stop;
+ myAPI.hello_to_address = &hello_to_address;
+ myAPI.send_now_test = &udp_test_would_try;
return &myAPI;
}
Modified: GNUnet/src/util/crypto/hashing.c
===================================================================
--- GNUnet/src/util/crypto/hashing.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/util/crypto/hashing.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -424,11 +424,11 @@
GNUNET_free (buf);
return GNUNET_SYSERR;
}
- if (GNUNET_YES == GNUNET_shutdown_test())
- {
+ if (GNUNET_YES == GNUNET_shutdown_test ())
+ {
GNUNET_free (buf);
return GNUNET_SYSERR;
- }
+ }
sha512_update (&ctx, buf, delta);
if (pos + delta > pos)
pos += delta;
Modified: GNUnet/src/util/network/select.c
===================================================================
--- GNUnet/src/util/network/select.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/util/network/select.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -1041,7 +1041,7 @@
GNUNET_GE_ASSERT (NULL, session->wapos >= session->wspos);
if ((force == GNUNET_NO) &&
(((sh->memory_quota > 0) &&
- (session->wapos - session->wspos + len > sh->memory_quota)) ))
+ (session->wapos - session->wspos + len > sh->memory_quota))))
{
/* not enough free space, not allowed to grow that much */
GNUNET_mutex_unlock (sh->lock);
@@ -1074,32 +1074,32 @@
if ((sh->memory_quota > 0) &&
(newBufferSize > sh->memory_quota) && (force == GNUNET_NO))
newBufferSize = sh->memory_quota;
- if (newBufferSize > GNUNET_MAX_GNUNET_malloc_CHECKED)
- {
- /* not enough free space, not allowed to grow that much,
- even with forcing! */
- GNUNET_mutex_unlock (sh->lock);
- return GNUNET_NO;
- }
+ if (newBufferSize > GNUNET_MAX_GNUNET_malloc_CHECKED)
+ {
+ /* not enough free space, not allowed to grow that much,
+ even with forcing! */
+ GNUNET_mutex_unlock (sh->lock);
+ return GNUNET_NO;
+ }
GNUNET_GE_ASSERT (NULL,
newBufferSize >=
len + session->wapos - session->wspos);
- if (newBufferSize != session->wsize)
- {
- newBuffer = GNUNET_malloc (newBufferSize);
- memcpy (newBuffer,
- &session->wbuff[session->wspos],
- session->wapos - session->wspos);
- GNUNET_free_non_null (session->wbuff);
- session->wbuff = newBuffer;
- }
- else
- {
- if (session->wspos != 0)
- memmove(session->wbuff,
- &session->wbuff[session->wspos],
- session->wapos - session->wspos);
- }
+ if (newBufferSize != session->wsize)
+ {
+ newBuffer = GNUNET_malloc (newBufferSize);
+ memcpy (newBuffer,
+ &session->wbuff[session->wspos],
+ session->wapos - session->wspos);
+ GNUNET_free_non_null (session->wbuff);
+ session->wbuff = newBuffer;
+ }
+ else
+ {
+ if (session->wspos != 0)
+ memmove (session->wbuff,
+ &session->wbuff[session->wspos],
+ session->wapos - session->wspos);
+ }
session->wsize = newBufferSize;
session->wapos = session->wapos - session->wspos;
session->wspos = 0;
Modified: GNUnet/src/util/os/priority.c
===================================================================
--- GNUnet/src/util/os/priority.c 2008-03-25 03:16:20 UTC (rev 6614)
+++ GNUnet/src/util/os/priority.c 2008-03-25 06:23:12 UTC (rev 6615)
@@ -41,31 +41,31 @@
* and the usual numeric nice() increments */
if (strcmp (str, "NORMAL") == 0)
#ifdef MINGW
- prio = NORMAL_PRIORITY_CLASS;
+ priority = NORMAL_PRIORITY_CLASS;
#else
prio = 0;
#endif
else if (strcmp (str, "ABOVE NORMAL") == 0)
#ifdef MINGW
- prio = ABOVE_NORMAL_PRIORITY_CLASS;
+ priority = ABOVE_NORMAL_PRIORITY_CLASS;
#else
prio = -5;
#endif
else if (strcmp (str, "BELOW NORMAL") == 0)
#ifdef MINGW
- prio = BELOW_NORMAL_PRIORITY_CLASS;
+ priority = BELOW_NORMAL_PRIORITY_CLASS;
#else
prio = 10;
#endif
else if (strcmp (str, "HIGH") == 0)
#ifdef MINGW
- prio = HIGH_PRIORITY_CLASS;
+ priority = HIGH_PRIORITY_CLASS;
#else
prio = -10;
#endif
else if (strcmp (str, "IDLE") == 0)
#ifdef MINGW
- prio = IDLE_PRIORITY_CLASS;
+ priority = IDLE_PRIORITY_CLASS;
#else
prio = 19;
#endif
@@ -81,22 +81,22 @@
#ifdef MINGW
/* Convert the nice increment to a priority class */
- if (prio == 0)
- prio = NORMAL_PRIORITY_CLASS;
- else if (prio > 0 && prio <= 10)
- prio = BELOW_NORMAL_PRIORITY_CLASS;
- else if (prio > 0)
- prio = IDLE_PRIORITY_CLASS;
- else if (prio < 0 && prio >= -10)
- prio = ABOVE_NORMAL_PRIORITY_CLASS;
- else if (prio < 0)
- prio = HIGH_PRIORITY_CLASS;
+ if (priority == 0)
+ priority = NORMAL_PRIORITY_CLASS;
+ else if (priority > 0 && priority <= 10)
+ priority = BELOW_NORMAL_PRIORITY_CLASS;
+ else if (priority > 0)
+ priority = IDLE_PRIORITY_CLASS;
+ else if (priority < 0 && priority >= -10)
+ priority = ABOVE_NORMAL_PRIORITY_CLASS;
+ else if (priority < 0)
+ priority = HIGH_PRIORITY_CLASS;
#endif
}
/* Set process priority */
#ifdef MINGW
- SetPriorityClass (GetCurrentProcess (), prio);
+ SetPriorityClass (GetCurrentProcess (), priority);
#else
errno = 0;
nice (prio);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6615 - in GNUnet/src: applications/advertising applications/bootstrap_http applications/chat applications/datastore applications/dht/module applications/dstore_mysql applications/dstore_sqlite applications/fragmentation applications/fs applications/fs/ecrs applications/fs/fsui applications/fs/gap applications/fs/lib applications/getoption applications/hostlist applications/identity applications/pingpong applications/rpc applications/session applications/sqstore_mysql applications/sqstore_sqlite applications/stats applications/tbench applications/template applications/topology_default applications/tracekit applications/traffic applications/transport applications/vpn include server transports util/crypto util/network util/os,
gnunet <=