* DHT: [Nate]
- implement DHT service
- implement performance tests
-* FS: [CG]
- - service:
- + trust: do not charge when "idle" / load considerations (migration, routing)
- + artificial delays
- + active reply route caching design & implementation; gap extension!
- - non-anonymous FS service (needs DHT)
- + DHT integration for search
- + CS-DHT-functions (DHT-put of LOC)
- + P2P-functions (DHT-get)
* GNUNET-GTK: [CG]
- implement publish dialog details:
+ open (import directory structure)
- datacache
- datastore
* FS: [CG]
- - reconstruct IBLOCKS from DBLOCKS if possible (during download; see FIXME in fs_download)
- - add support for pushing "already seen" search results to FS service for bloomfilter (can wait)
- - use different 'priority' for probe downloads vs. normal downloads
+ - library:
+ + reconstruct IBLOCKS from DBLOCKS if possible (during download; see FIXME in fs_download)
+ + add support for pushing "already seen" search results to FS service for bloomfilter (can wait)
+ + use different 'priority' for probe downloads vs. normal downloads
+ - service:
+ + trust: do not charge when "idle" / load considerations (migration, routing)
+ + artificial delays
+ + active reply route caching design & implementation; gap extension!
+ - non-anonymous FS service (needs DHT)
+ + DHT integration for search
+ + CS-DHT-functions (DHT-put of LOC)
+ + P2P-functions (DHT-get)
- implement FS performance tests
+ insert
+ download
/* setup transport connection */
transport = GNUNET_TRANSPORT_connect (sched,
cfg,
+ &my_identity,
NULL,
&handle_transport_receive,
&handle_transport_notify_connect,
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, NULL, NULL);
+ p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, NULL, NULL, NULL);
GNUNET_assert (p->th != NULL);
GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
}
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL, NULL, NULL);
+ p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, NULL, NULL, NULL);
GNUNET_assert (p->th != NULL);
GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
}
if (coreAPI == NULL)
return;
- transport_handle = GNUNET_TRANSPORT_connect(sched, cfg, NULL, NULL, NULL, NULL);
+ transport_handle = GNUNET_TRANSPORT_connect(sched, cfg,
+ NULL, NULL, NULL, NULL, NULL);
if (transport_handle != NULL)
GNUNET_TRANSPORT_get_hello (transport_handle, &process_hello, NULL);
else
GNUNET_break (0);
return GNUNET_SYSERR;
}
- transport = GNUNET_TRANSPORT_connect (s, c, NULL, NULL, NULL, NULL);
+ transport = GNUNET_TRANSPORT_connect (s, c, NULL, NULL, NULL, NULL, NULL);
if (NULL == transport)
{
curl_global_cleanup ();
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, p, NULL,
+ p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, p, NULL,
¬ify_connect, NULL);
GNUNET_assert (p->th != NULL);
GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
*
* @param sched scheduler to use
* @param cfg configuration to use
+ * @param self our own identity (API should check that it matches
+ * the identity found by transport), or NULL (no check)
* @param cls closure for the callbacks
* @param rec receive function to call
* @param nc function to call on connect events
*sched,
const struct
GNUNET_CONFIGURATION_Handle
- *cfg, void *cls,
+ *cfg,
+ const struct GNUNET_PeerIdentity *self,
+ void *cls,
GNUNET_TRANSPORT_ReceiveCallback
rec,
GNUNET_TRANSPORT_NotifyConnect
d->th = GNUNET_TRANSPORT_connect (d->sched,
- d->cfg, d, NULL, NULL, NULL);
+ d->cfg,
+ &d->id,
+ d, NULL, NULL, NULL);
if (d->th == NULL)
{
if (GNUNET_YES == d->dead)
#endif
ctx->d2th = GNUNET_TRANSPORT_connect (d2->sched,
- d2->cfg, d2, NULL, NULL, NULL);
+ d2->cfg,
+ &d2->id,
+ d2, NULL, NULL, NULL);
if (ctx->d2th == NULL)
{
GNUNET_CORE_disconnect(ctx->d1core);
}
ctx->d2th = GNUNET_TRANSPORT_connect (ctx->d2->sched,
- ctx->d2->cfg, ctx->d2, NULL, NULL, NULL);
+ ctx->d2->cfg,
+ &ctx->d2->id,
+ ctx->d2, NULL, NULL, NULL);
if (ctx->d2th == NULL)
{
GNUNET_CORE_disconnect(ctx->d1core);
NULL,
NULL,
NULL,
+ NULL,
NULL);
handle = GNUNET_CORE_connect (sched,
cfg,
struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
+ const struct StartMessage *start;
struct TransportClient *c;
struct ConnectInfoMessage cim;
struct NeighbourList *n;
+ start = (const struct StartMessage*) message;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received `%s' request from client\n", "START");
}
c = c->next;
}
+ if ( (GNUNET_NO != ntohl (start->do_check)) &&
+ (0 != memcmp (&start->self,
+ &my_identity,
+ sizeof (struct GNUNET_PeerIdentity))) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Rejecting control connection from peer `%s', which is not me!\n"),
+ GNUNET_i2s (&start->self));
+ GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ return;
+ }
c = GNUNET_malloc (sizeof (struct TransportClient));
c->next = clients;
clients = c;
{
static const struct GNUNET_SERVER_MessageHandler handlers[] = {
{&handle_start, NULL,
- GNUNET_MESSAGE_TYPE_TRANSPORT_START, 0},
+ GNUNET_MESSAGE_TYPE_TRANSPORT_START, sizeof (struct StartMessage)},
{&handle_hello, NULL,
GNUNET_MESSAGE_TYPE_HELLO, 0},
{&handle_send, NULL,
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->th = GNUNET_TRANSPORT_connect (sched, p->cfg,
- p,
+ NULL, p,
¬ify_receive,
¬ify_connect, ¬ify_disconnect);
GNUNET_assert (p->th != NULL);
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
- p->th = GNUNET_TRANSPORT_connect (sched, p->cfg,
+ p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL,
p,
¬ify_receive,
¬ify_connect,
*/
#define MIN_QUOTA_REFRESH_TIME 2000
+/**
+ * Message from the transport service to the library
+ * asking to check if both processes agree about this
+ * peers identity.
+ */
+struct StartMessage
+{
+
+ /**
+ * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_START
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Should the 'self' field be checked?
+ */
+ uint32_t do_check;
+
+ /**
+ * Identity we think we have. If it does not match, the
+ * receiver should print out an error message and disconnect.
+ */
+ struct GNUNET_PeerIdentity self;
+
+};
+
+
/**
* Message from the transport service to the library
* informing about neighbors.
/**
* Closure for the callbacks.
*/
- void *cls;
+ void *cls;
/**
* Function to call for received data.
*/
struct NeighbourList *neighbours;
+ /**
+ * Peer identity as assumed by this process, or all zeros.
+ */
+ struct GNUNET_PeerIdentity self;
+
/**
* ID of the task trying to reconnect to the service.
*/
*/
int in_disconnect;
+ /**
+ * Should we check that 'self' matches what the service thinks?
+ * (if GNUNET_NO, then 'self' is all zeros!).
+ */
+ int check_self;
};
static size_t
send_start (void *cls, size_t size, void *buf)
{
- struct GNUNET_MessageHeader *s = buf;
+ struct GNUNET_TRANSPORT_Handle *h = cls;
+ struct StartMessage s;
if (buf == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Transmitting `%s' request.\n", "START");
#endif
- GNUNET_assert (size >= sizeof (struct GNUNET_MessageHeader));
- s->size = htons (sizeof (struct GNUNET_MessageHeader));
- s->type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START);
- return sizeof (struct GNUNET_MessageHeader);
+ GNUNET_assert (size >= sizeof (struct StartMessage));
+ s.header.size = htons (sizeof (struct StartMessage));
+ s.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START);
+ s.do_check = htonl (h->check_self);
+ s.self = h->self;
+ memcpy (buf, &s, sizeof (struct StartMessage));
+ return sizeof (struct StartMessage);
}
pos = pos->next;
}
schedule_control_transmit (h,
- sizeof (struct GNUNET_MessageHeader),
+ sizeof (struct StartMessage),
GNUNET_YES,
- GNUNET_TIME_UNIT_FOREVER_REL, &send_start, NULL);
+ GNUNET_TIME_UNIT_FOREVER_REL, &send_start, h);
GNUNET_CLIENT_receive (h->client,
&demultiplexer, h, GNUNET_TIME_UNIT_FOREVER_REL);
}
*
* @param sched scheduler to use
* @param cfg configuration to use
+ * @param self our own identity (API should check that it matches
+ * the identity found by transport), or NULL (no check)
* @param cls closure for the callbacks
* @param rec receive function to call
* @param nc function to call on connect events
struct GNUNET_TRANSPORT_Handle *
GNUNET_TRANSPORT_connect (struct GNUNET_SCHEDULER_Handle *sched,
const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_PeerIdentity *self,
void *cls,
GNUNET_TRANSPORT_ReceiveCallback rec,
GNUNET_TRANSPORT_NotifyConnect nc,
struct GNUNET_TRANSPORT_Handle *ret;
ret = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_Handle));
+ if (self != NULL)
+ {
+ ret->self = *self;
+ ret->check_self = GNUNET_YES;
+ }
ret->sched = sched;
ret->cfg = cfg;
ret->cls = cls;