[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3179 - in GNUnet: . src/applications/transport src/include
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3179 - in GNUnet: . src/applications/transport src/include |
Date: |
Sat, 29 Jul 2006 22:54:11 -0700 (PDT) |
Author: grothoff
Date: 2006-07-29 22:54:09 -0700 (Sat, 29 Jul 2006)
New Revision: 3179
Modified:
GNUnet/src/applications/transport/transport.c
GNUnet/src/include/gnunet_transport.h
GNUnet/src/include/gnunet_transport_service.h
GNUnet/todo
Log:
transport compiles
Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c 2006-07-30 05:19:51 UTC
(rev 3178)
+++ GNUnet/src/applications/transport/transport.c 2006-07-30 05:54:09 UTC
(rev 3179)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2001, 2002, 2004, 2005 Christian Grothoff (and other contributing
authors)
+ (C) 2001, 2002, 2004, 2005, 2006 Christian Grothoff (and other
contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -35,14 +35,21 @@
#define DEBUG_TRANSPORT NO
static CoreAPIForTransport ctapi;
+
static CoreAPIForApplication * coreAPI;
+
static Identity_ServiceAPI * identity;
static TransportAPI ** tapis = NULL;
+
static unsigned int tapis_count = 0;
-static unsigned int helo_live;
-static Mutex tapis_lock;
+static unsigned long long helo_live;
+
+static struct MUTEX * tapis_lock;
+
+static struct GE_Context * ectx;
+
#define HELLO_RECREATE_FREQ (5 * cronMINUTES)
@@ -51,17 +58,13 @@
* Create signed hello for this transport and put it into
* the cache tapi->helo.
*/
-static void createSignedhello(TransportAPI * tapi) {
- MUTEX_LOCK(&tapis_lock);
+static void createSignedhello(void * cls) {
+ TransportAPI * tapi = cls;
+ MUTEX_LOCK(tapis_lock);
FREENONNULL(tapi->helo);
tapi->helo = tapi->createhello();
if (NULL == tapi->helo) {
-#if DEBUG_TRANSPORT
- LOG(LOG_INFO,
- "Transport `%s' failed to create hello\n",
- tapi->transName);
-#endif
- MUTEX_UNLOCK(&tapis_lock);
+ MUTEX_UNLOCK(tapis_lock);
return;
}
memcpy(&tapi->helo->publicKey,
@@ -80,13 +83,13 @@
P2P_hello_MESSAGE_size(tapi->helo)
- sizeof(Signature)
- sizeof(PublicKey)
- - sizeof(P2P_MESSAGE_HEADER),
+ - sizeof(MESSAGE_HEADER),
&tapi->helo->signature)) {
FREE(tapi->helo);
tapi->helo = NULL;
- BREAK();
+ GE_BREAK(ectx, 0);
}
- MUTEX_UNLOCK(&tapis_lock);
+ MUTEX_UNLOCK(tapis_lock);
}
/**
@@ -111,10 +114,11 @@
tapi->protocolNumber+1);
tapis[tapi->protocolNumber] = tapi;
tapi->helo = NULL;
- addCronJob((CronJob)&createSignedhello,
- HELLO_RECREATE_FREQ,
- HELLO_RECREATE_FREQ,
- tapi);
+ cron_add_job(coreAPI->cron,
+ &createSignedhello,
+ HELLO_RECREATE_FREQ,
+ HELLO_RECREATE_FREQ,
+ tapi);
return OK;
}
@@ -122,36 +126,27 @@
* Convert hello to string.
*/
static char * heloToString(const P2P_hello_MESSAGE * helo) {
- TransportAPI * tapi;
unsigned short prot;
- if (ntohs(helo->protocol) >= tapis_count) {
- LOG(LOG_INFO,
- "%s failed, transport type %d not supported\n",
- __FUNCTION__,
- ntohs(helo->protocol));
+ prot = ntohs(helo->protocol);
+ if ( (ntohs(helo->protocol) >= tapis_count) ||
+ (tapis[prot] == NULL) ) {
+ GE_LOG(ectx,
+ GE_INFO | GE_REQUEST | GE_USER,
+ _("Converting peer address to string failed, transport type %d not
supported\n"),
+ ntohs(helo->protocol));
return NULL;
}
- prot = ntohs(helo->protocol);
- tapi = tapis[prot];
- if (tapi == NULL) {
- LOG(LOG_INFO,
- "%s failed, transport type %d not supported\n",
- __FUNCTION__,
- ntohs(helo->protocol));
- return NULL;
- } else
- return tapi->addressToString(helo);
+ return tapis[prot]->addressToString(helo);
}
-
/**
* Iterate over all available transport mechanisms.
* @param callback the method to call on each transport API implementation
* @param data second argument to callback
*/
static int forEachTransport(TransportCallback callback,
- void * data) {
+ void * data) {
int i;
int ret;
@@ -177,38 +172,23 @@
* @return OK on success, SYSERR on error
*/
static TSession * transportConnect(const P2P_hello_MESSAGE * helo) {
- TransportAPI * tapi;
unsigned short prot;
TSession * tsession;
- if (ntohs(helo->protocol) >= tapis_count) {
- LOG(LOG_INFO,
- "%s failed, transport type %d not supported\n",
- __FUNCTION__,
- ntohs(helo->protocol));
+ prot = ntohs(helo->protocol);
+ if ( (ntohs(helo->protocol) >= tapis_count) ||
+ (tapis[prot] == NULL) ) {
+ GE_LOG(ectx,
+ GE_INFO | GE_REQUEST | GE_USER | GE_ADMIN,
+ _("Transport connection attempt failed, transport type %d not
supported\n"),
+ ntohs(helo->protocol));
return NULL;
}
- prot = ntohs(helo->protocol);
- tapi = tapis[prot];
- if (tapi == NULL) {
- LOG(LOG_INFO,
- "%s failed, transport type %d not supported\n",
- __FUNCTION__,
- ntohs(helo->protocol));
- return NULL;
- } else {
- if (OK == tapi->connect(helo,
- &tsession)) {
- tsession->ttype = prot;
-#if DEBUG_TRANSPORT
- LOG(LOG_DEBUG,
- "Core connected to tsession %p.\n",
- *tsession);
-#endif
- return tsession;
- } else
- return NULL;
- }
+ if (OK != tapis[prot]->connect(helo,
+ &tsession))
+ return NULL;
+ tsession->ttype = prot;
+ return tsession;
}
static TSession * transportConnectFreely(const PeerIdentity * peer,
@@ -218,7 +198,7 @@
int * perm;
TSession * ret;
- MUTEX_LOCK(&tapis_lock);
+ MUTEX_LOCK(tapis_lock);
ret = NULL;
perm = permute(WEAK, tapis_count);
for (i=0;i<tapis_count;i++) {
@@ -232,13 +212,13 @@
FREE(helo);
if (ret != NULL) {
FREE(perm);
- MUTEX_UNLOCK(&tapis_lock);
+ MUTEX_UNLOCK(tapis_lock);
return ret;
}
}
}
FREE(perm);
- MUTEX_UNLOCK(&tapis_lock);
+ MUTEX_UNLOCK(tapis_lock);
return NULL;
}
@@ -254,38 +234,21 @@
* SYSERR if not.
*/
static int transportAssociate(TSession * tsession) {
- TransportAPI * tapi;
-
- if (tsession == NULL)
+ if ( (tsession == NULL) ||
+ (tsession->ttype >= tapis_count) ||
+ (tapis[tsession->ttype] == NULL) )
return SYSERR;
- if (tsession->ttype >= tapis_count)
- return SYSERR;
- tapi = tapis[tsession->ttype];
- if (tapi == NULL)
- return SYSERR;
- else {
-#if DEBUG_TRANSPORT
- LOG(LOG_DEBUG,
- "Core associates with tsession %p.\n",
- tsession);
-#endif
- return tapi->associate(tsession);
- }
+ return tapis[tsession->ttype]->associate(tsession);
}
-
/**
* Get the cost of a message in for the given transport mechanism.
*/
static unsigned int transportGetCost(int ttype) {
- TransportAPI * tapi;
-
- if (ttype >= tapis_count)
+ if ( (ttype >= tapis_count) ||
+ (tapis[ttype] == NULL) )
return SYSERR; /* -1 = INFTY */
- tapi = tapis[ttype];
- if (tapi == NULL)
- return SYSERR; /* -1 = INFTY */
- return tapi->cost;
+ return tapis[ttype]->cost;
}
/**
@@ -293,109 +256,50 @@
* @param tsession the transport session identifying the connection
* @param msg the message to send
* @param size the size of the message
- * @param isEncrypted YES if the message is encrypted
- * @param crc the CRC of the (plaintext) message
+ * @param important
* @return OK on success, SYSERR on persistent error, NO on
* temporary error
*/
static int transportSend(TSession * tsession,
const void * msg,
- const unsigned int size) {
- TransportAPI * tapi;
-
+ unsigned int size,
+ int important) {
if (tsession == NULL) {
- LOG(LOG_DEBUG,
- "transportSend attempted on uni-directional pipe, failing.\n");
+ GE_LOG(ectx,
+ GE_DEBUG | GE_DEVELOPER | GE_BULK,
+ "Transmission attempted on uni-directional pipe, failing.\n");
return SYSERR; /* can't do that, can happen for unidirectional pipes
that call core with TSession being NULL. */
}
- if (tsession->ttype >= tapis_count) {
- LOG(LOG_FAILURE,
- "%s failed, transport type %d unknown.\n",
- __FUNCTION__,
- tsession->ttype);
+ if ( (tsession->ttype >= tapis_count) ||
+ (tapis[tsession->ttype] == NULL) ) {
+ GE_LOG(ectx,
+ GE_ERROR | GE_BULK | GE_USER,
+ _("Transmission attempt failed, transport type %d unknown.\n"),
+ tsession->ttype);
return SYSERR;
}
- tapi = tapis[tsession->ttype];
- if (tapi == NULL) {
- LOG(LOG_FAILURE,
- "%s failed, transport type %d unknown.\n",
- __FUNCTION__,
- tsession->ttype);
- return SYSERR;
- } else
- return tapi->send(tsession,
- msg,
- size);
+ return tapis[tsession->ttype]->send(tsession,
+ msg,
+ size,
+ important);
}
/**
- * Send a message. Try to be more reliable than usual.
- *
- * @param tsession the transport session identifying the connection
- * @param msg the message to send
- * @param size the size of the message
- * @return OK on success, SYSERR on error
- */
-static int transportSendReliable(TSession * tsession,
- const void * msg,
- const unsigned int size) {
- TransportAPI * tapi;
-
- if (tsession == NULL) {
- LOG(LOG_DEBUG,
- "Cannot send reliable on this connection (not bi-directional!)\n");
- return SYSERR; /* can't do that, can happen for unidirectional pipes
- that call core with TSession being NULL. */
- }
- if (tsession->ttype >= tapis_count) {
- LOG(LOG_FAILURE,
- "%s failed, transport type %d unknown.\n",
- __FUNCTION__,
- tsession->ttype);
- return SYSERR;
- }
- tapi = tapis[tsession->ttype];
- if (tapi == NULL) {
- LOG(LOG_FAILURE,
- "%s failed, transport type %d unknown.\n",
- __FUNCTION__,
- tsession->ttype);
- return SYSERR;
- }
- else
- return tapi->sendReliable(tsession,
- msg,
- size);
-}
-
-/**
* Close the session with the remote node.
* @return OK on success, SYSERR on error
*/
static int transportDisconnect(TSession * tsession) {
- TransportAPI * tapi;
-
if (tsession == NULL) {
- BREAK();
+ GE_BREAK(ectx, 0);
return SYSERR;
}
- if (tsession->ttype >= tapis_count) {
- BREAK();
+ if ( (tsession->ttype >= tapis_count) ||
+ (tapis[tsession->ttype] == NULL) ) {
+ GE_BREAK(ectx, 0);
return SYSERR;
}
- tapi = tapis[tsession->ttype];
- if (tapi == NULL) {
- BREAK();
- return SYSERR;
- } else {
-#if DEBUG_TRANSPORT
- LOG(LOG_DEBUG,
- "Core calls disconnect on tsession %p.\n",
- tsession);
-#endif
- return tapi->disconnect(tsession);
- }
+ return tapis[tsession->ttype]->disconnect(tsession);
}
/**
@@ -405,50 +309,27 @@
* SYSERR if the transport mechanism is not supported
*/
static int transportVerifyHelo(const P2P_hello_MESSAGE * helo) {
- TransportAPI * tapi;
-
- if (ntohs(helo->protocol) >= tapis_count) {
- LOG(LOG_EVERYTHING,
- "Advertised transport type %d"
- " does not match any known transport.\n",
- ntohs(helo->protocol));
- return SYSERR;
- }
- tapi = tapis[ntohs(helo->protocol)];
- if (tapi == NULL) {
- if (ntohs(helo->protocol) != NAT_PROTOCOL_NUMBER) {
- LOG(LOG_EVERYTHING,
- "Advertised transport type %d"
- " does not match any known transport.\n",
- ntohs(helo->protocol));
- return SYSERR;
- } else {
- LOG(LOG_EVERYTHING,
- "Advertised transport type is NAT,"
- " but nat module is not loaded."
- " Rudimentary sanity check enforced.\n");
- if ((ntohs(helo->header.size) != P2P_hello_MESSAGE_size(helo)) ||
- (ntohs(helo->header.type) != p2p_PROTO_hello) )
- return SYSERR; /* obviously invalid */
- return OK;
- }
- } else
- return tapi->verifyHelo(helo);
+ unsigned short prot;
+
+ prot = ntohs(helo->protocol);
+ if ( (prot == NAT_PROTOCOL_NUMBER) &&
+ ( (ntohs(helo->header.size) != P2P_hello_MESSAGE_size(helo)) ||
+ (ntohs(helo->header.type) != p2p_PROTO_hello) ) )
+ return SYSERR; /* invalid */
+ if ( (ntohs(helo->protocol) >= tapis_count) ||
+ (tapis[prot] == NULL) )
+ return SYSERR; /* not supported */
+ return tapis[prot]->verifyHelo(helo);
}
/**
* Get the MTU for a given transport type.
*/
static int transportGetMTU(unsigned short ttype) {
- TransportAPI * tapi;
-
- if (ttype >= tapis_count)
+ if ( (ttype >= tapis_count) ||
+ (tapis[ttype] == NULL) )
return SYSERR;
- tapi = tapis[ttype];
- if (tapi == NULL)
- return SYSERR;
- else
- return tapi->mtu;
+ return tapis[ttype]->mtu;
}
/**
@@ -459,7 +340,7 @@
TransportAPI * tapi;
P2P_hello_MESSAGE * helo;
- MUTEX_LOCK(&tapis_lock);
+ MUTEX_LOCK(tapis_lock);
if (ttype == ANY_PROTOCOL_NUMBER) {
int * perm;
@@ -472,42 +353,31 @@
ttype--; /* unsigned, will wrap around! */
if (ttype >= tapis_count) {
FREE(perm);
- MUTEX_UNLOCK(&tapis_lock);
+ MUTEX_UNLOCK(tapis_lock);
return NULL;
}
ttype = perm[ttype];
FREE(perm);
}
- if (ttype >= tapis_count) {
- LOG(LOG_WARNING,
- _("No transport of type %d known.\n"),
- ttype);
- MUTEX_UNLOCK(&tapis_lock);
+ if ( (ttype >= tapis_count) ||
+ (tapis[ttype] == NULL) ) {
+ GE_LOG(ectx,
+ GE_WARNING | GE_BULK | GE_USER,
+ _("No transport of type %d known.\n"),
+ ttype);
+ MUTEX_UNLOCK(tapis_lock);
return NULL;
}
tapi = tapis[ttype];
- if (tapi == NULL) {
- LOG(LOG_WARNING,
- _("No transport of type %d known.\n"),
- ttype);
- MUTEX_UNLOCK(&tapis_lock);
- return NULL;
- }
if (tapi->helo == NULL) {
-#if DEBUG_TRANSPORT
- LOG(LOG_DEBUG,
- "Transport of type %d configured for sending only (no hello).\n",
- ttype);
-#endif
- MUTEX_UNLOCK(&tapis_lock);
- return NULL;
+ MUTEX_UNLOCK(tapis_lock);
+ return NULL; /* send-only transport */
}
-
helo = MALLOC(P2P_hello_MESSAGE_size(tapi->helo));
memcpy(helo,
tapi->helo,
P2P_hello_MESSAGE_size(tapi->helo));
- MUTEX_UNLOCK(&tapis_lock);
+ MUTEX_UNLOCK(tapis_lock);
return helo;
}
@@ -525,13 +395,13 @@
* @return the number of bytes written to buff, -1 on error
*/
static int getAdvertisedhellos(unsigned int maxLen,
- char * buff) {
+ char * buff) {
int i;
int tcount;
P2P_hello_MESSAGE ** helos;
int used;
- MUTEX_LOCK(&tapis_lock);
+ MUTEX_LOCK(tapis_lock);
tcount = 0;
for (i=0;i<tapis_count;i++)
if (tapis[i] != NULL)
@@ -546,10 +416,11 @@
tcount++;
}
}
- MUTEX_UNLOCK(&tapis_lock);
+ MUTEX_UNLOCK(tapis_lock);
if (tcount == 0) {
- LOG(LOG_DEBUG,
- "no transport succeeded in creating a hello\n");
+ GE_LOG(ectx,
+ GE_INFO | GE_USER | GE_REQUEST,
+ _("No transport succeeded in creating a hello!\n"));
return SYSERR;
}
used = 0;
@@ -568,9 +439,10 @@
FREE(helos[i]);
FREE(helos);
if (used == 0)
- LOG(LOG_DEBUG,
- "%s failed: no hellos fit in %u bytes\n",
- maxLen);
+ GE_LOG(ectx,
+ GE_DEBUG | GE_DEVELOPER | GE_REQUEST,
+ "No hellos fit in %u bytes.\n",
+ maxLen);
return used;
}
@@ -581,6 +453,7 @@
*/
static void startTransports(P2P_PACKETProcessor mpp) {
int i;
+
ctapi.receive = mpp;
for (i=0;i<tapis_count;i++)
if (tapis[i] != NULL)
@@ -592,6 +465,7 @@
*/
static void stopTransports() {
int i;
+
for (i=0;i<tapis_count;i++)
if (tapis[i] != NULL)
tapis[i]->stopTransportServer();
@@ -619,10 +493,11 @@
blocks the startup process in this case.
This is why we create the HELLOs in another
thread. */
- addCronJob(&initHello,
- 0,
- 0,
- tapi);
+ cron_add_job(coreAPI->cron,
+ &initHello,
+ 0,
+ 0,
+ tapi);
}
static void doneHelper(TransportAPI * tapi,
@@ -630,14 +505,13 @@
/* In the (rare) case that we shutdown transports
before the cron-jobs had a chance to run, stop
the cron-jobs */
- delCronJob(&initHello,
- 0,
- tapi);
+ cron_del_job(coreAPI->cron,
+ &initHello,
+ 0,
+ tapi);
}
-
-
/**
* Initialize the transport layer.
*/
@@ -649,13 +523,25 @@
char * dso;
char * next;
char * pos;
- void * lib;
+ struct PluginHandle * lib;
EncName myself;
- GNUNET_ASSERT(sizeof(P2P_hello_MESSAGE) == 600);
+ ectx = capi->ectx;
+ if (-1 == GC_get_configuration_value_number(capi->cfg,
+ "GNUNETD",
+ "HELLOEXPIRES",
+ 1,
+ MAX_HELLO_EXPIRES / 60,
+ 60,
+ &helo_live))
+ return NULL;
+ helo_live *= 60;
+
+ GE_ASSERT(ectx,
+ sizeof(P2P_hello_MESSAGE) == 600);
identity = capi->requestService("identity");
if (identity == NULL) {
- BREAK();
+ GE_BREAK(ectx, 0);
return NULL;
}
coreAPI = capi;
@@ -665,78 +551,78 @@
ctapi.requestService = coreAPI->requestService;
ctapi.releaseService = coreAPI->releaseService;
- helo_live = getConfigurationInt("GNUNETD",
- "HELLOEXPIRES") * 60; /* minutes to seconds */
- if (helo_live > MAX_HELLO_EXPIRES)
- helo_live = MAX_HELLO_EXPIRES;
-
- if (helo_live <= 0) {
- helo_live = 60 * 60;
- LOG(LOG_WARNING,
- _("Option `%s' not set in configuration in section `%s',"
- " setting to %dm.\n"),
- "HELLOEXPIRES", "GNUNETD", helo_live / 60);
- }
GROW(tapis,
tapis_count,
UDP_PROTOCOL_NUMBER+1);
- MUTEX_CREATE_RECURSIVE(&tapis_lock);
+ tapis_lock = MUTEX_CREATE(YES);
/* now load transports */
- dso = getConfigurationString("GNUNETD",
- "TRANSPORTS");
- if (dso == NULL) {
- LOG(LOG_WARNING,
- _("You should specify at least one transport service"
- " under option `%s' in section `%s'.\n"),
- "TRANSPORTS", "GNUNETD");
- } else {
- LOG(LOG_DEBUG,
- "Loading transports `%s'\n",
- dso);
+ dso = NULL;
+ GE_ASSERT(ectx,
+ -1 != GC_get_configuration_value_string(capi->cfg,
+ "GNUNETD",
+ "TRANSPORTS",
+ "udp tcp nat",
+ &dso));
+ GE_LOG(ectx,
+ GE_INFO | GE_USER | GE_BULK,
+ _("Loading transports `%s'\n"),
+ dso);
+ next = dso;
+ do {
+ pos = next;
+ while ( (*next != '\0') &&
+ (*next != ' ') )
+ next++;
+ if (*next == '\0')
+ next = NULL; /* terminate! */
+ else {
+ *next = '\0'; /* add 0-termination for pos */
+ next++;
+ }
+ lib = os_plugin_load(ectx,
+ "libgnunettransport_",
+ pos);
+ if (lib == NULL) {
+ GE_LOG(ectx,
+ GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ _("Could not load transport plugin `%s'\n"),
+ pos);
+ continue;
+ }
+ tptr = os_plugin_resolve_function(lib,
+ "inittransport_",
+ YES);
+ if (tptr == NULL) {
+ GE_LOG(ectx,
+ GE_ERROR | GE_ADMIN | GE_USER | GE_DEVELOPER | GE_IMMEDIATE,
+ _("Transport library `%s' did not provide required function
'%s%s'.\n"),
+ pos,
+ "inittransport_",
+ pos);
+ os_plugin_unload(lib);
+ continue;
+ }
+ tapi = tptr(&ctapi);
+ tapi->libHandle = lib;
+ tapi->transName = STRDUP(pos);
+ addTransport(tapi);
+ GE_LOG(ectx,
+ GE_INFO | GE_USER | GE_BULK,
+ _("Loaded transport `%s'\n"),
+ pos);
+ } while (next != NULL);
+ FREE(dso);
- next = dso;
- do {
- pos = next;
- while ( (*next != '\0') &&
- (*next != ' ') )
- next++;
- if (*next == '\0')
- next = NULL; /* terminate! */
- else {
- *next = '\0'; /* add 0-termination for pos */
- next++;
- }
- lib = loadDynamicLibrary("libgnunettransport_",
- pos);
- tptr = bindDynamicMethod(lib,
- "inittransport_",
- pos);
- if (tptr == NULL)
- errexit(_("Transport library `%s' did not provide "
- "required function '%s%s'.\n"),
- pos,
- "inittransport_",
- pos);
- tapi = tptr(&ctapi);
- tapi->libHandle = lib;
- tapi->transName = STRDUP(pos);
- addTransport(tapi);
- LOG(LOG_DEBUG,
- "Loaded transport `%s'\n",
- pos);
- } while (next != NULL);
- FREE(dso);
- }
-
-
- IFLOG(LOG_DEBUG,
- hash2enc(&coreAPI->myIdentity->hashPubKey,
- &myself));
- LOG(LOG_DEBUG,
- _("I am peer `%s'.\n"),
- &myself);
+ IF_GELOG(ectx,
+ GE_INFO | GE_REQUEST | GE_USER,
+ hash2enc(&coreAPI->myIdentity->hashPubKey,
+ &myself));
+ GE_LOG(ectx,
+ GE_INFO | GE_REQUEST | GE_USER,
+ _("I am peer `%s'.\n"),
+ &myself);
forEachTransport(&initHelper, NULL);
ret.start = &startTransports;
@@ -749,7 +635,6 @@
ret.associate = &transportAssociate;
ret.getCost = &transportGetCost;
ret.send = &transportSend;
- ret.sendReliable = &transportSendReliable;
ret.disconnect = &transportDisconnect;
ret.verifyhello = &transportVerifyHelo;
ret.heloToString = &heloToString;
@@ -771,26 +656,24 @@
forEachTransport(&doneHelper, NULL);
for (i=0;i<tapis_count;i++) {
if (tapis[i] != NULL) {
- delCronJob((CronJob)&createSignedhello,
- HELLO_RECREATE_FREQ,
- tapis[i]);
- ptr = bindDynamicMethod(tapis[i]->libHandle,
- "donetransport_",
- tapis[i]->transName);
+ cron_del_job(coreAPI->cron,
+ &createSignedhello,
+ HELLO_RECREATE_FREQ,
+ tapis[i]);
+ ptr = os_plugin_resolve_function(tapis[i]->libHandle,
+ "donetransport_",
+ NO);
if (ptr != NULL)
ptr();
FREE(tapis[i]->transName);
FREENONNULL(tapis[i]->helo);
tapis[i]->helo = NULL;
- if (0 == getConfigurationInt("GNUNETD",
- "VALGRIND"))
- /* do not unload plugins if we're using
- valgrind */
- unloadDynamicLibrary(tapis[i]->libHandle);
+ os_plugin_unload(tapis[i]->libHandle);
}
}
- MUTEX_DESTROY(&tapis_lock);
+ MUTEX_DESTROY(tapis_lock);
+ tapis_lock = NULL;
GROW(tapis,
tapis_count,
0);
Modified: GNUnet/src/include/gnunet_transport.h
===================================================================
--- GNUnet/src/include/gnunet_transport.h 2006-07-30 05:19:51 UTC (rev
3178)
+++ GNUnet/src/include/gnunet_transport.h 2006-07-30 05:54:09 UTC (rev
3179)
@@ -184,7 +184,7 @@
* the transport should never do ANYTHING
* with it.
*/
- void * libHandle;
+ struct PluginHandle * libHandle;
/**
* The name of the transport, set by the
Modified: GNUnet/src/include/gnunet_transport_service.h
===================================================================
--- GNUnet/src/include/gnunet_transport_service.h 2006-07-30 05:19:51 UTC
(rev 3178)
+++ GNUnet/src/include/gnunet_transport_service.h 2006-07-30 05:54:09 UTC
(rev 3179)
@@ -126,27 +126,16 @@
* @param session the session identifying the connection
* @param msg the message to send
* @param size the size of the message
+ * @param important the message is important
* @return OK on success, SYSERR on persistent error, NO on
* temporary error
*/
int (*send)(TSession * session,
const void * msg,
- const unsigned int size);
+ unsigned int size,
+ int important);
/**
- * Send a message.
- * Try to be more reliable than the usual transportSend.
- *
- * @param session the session identifying the connection
- * @param msg the message to send
- * @param size the size of the message
- * @return OK on success, SYSERR on error
- */
- int (*sendReliable)(TSession * session,
- const void * msg,
- const unsigned int size);
-
- /**
* Close the session with the remote node. May only be called on
* either connected or associated sessions.
*
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-07-30 05:19:51 UTC (rev 3178)
+++ GNUnet/todo 2006-07-30 05:54:09 UTC (rev 3179)
@@ -25,7 +25,13 @@
* server:
+ needs testing, also likely to be missing features
* applications:
- + nothing compiles
+ + identity, transport compile
+ + for core: fragmentation, session, topology_default, pingpong, stats
+ + for basics: advertising, bootstrap_http, state, getoption, traffic
+ + for fs: datastore, fs, gap, sqstore_sqlite
+ + rest: sqstore_mysql, dht, chat, kvstore_sqlite,
+ sqstore_mysql, rpc, tbench, template, testbed,
+ topology_f2f, vpn, tracekit
* setup:
+ nothing compiles
- adapt util testcases and main GNUnet codebase
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3179 - in GNUnet: . src/applications/transport src/include,
grothoff <=