gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r369 - in GNUnet: . src/applications src/applications/ident


From: grothoff
Subject: [GNUnet-SVN] r369 - in GNUnet: . src/applications src/applications/identity src/applications/session src/applications/topology_default src/applications/transport src/include src/util
Date: Fri, 4 Mar 2005 22:39:01 -0800 (PST)

Author: grothoff
Date: 2005-03-04 22:39:00 -0800 (Fri, 04 Mar 2005)
New Revision: 369

Modified:
   GNUnet/configure.ac
   GNUnet/src/applications/Makefile.am
   GNUnet/src/applications/OVERVIEW
   GNUnet/src/applications/identity/identity.c
   GNUnet/src/applications/session/connect.c
   GNUnet/src/applications/topology_default/topology.c
   GNUnet/src/applications/transport/transport.c
   GNUnet/src/include/gnunet_topology_service.h
   GNUnet/src/util/configuration.c
Log:
bugfixes

Modified: GNUnet/configure.ac
===================================================================
--- GNUnet/configure.ac 2005-03-05 06:08:01 UTC (rev 368)
+++ GNUnet/configure.ac 2005-03-05 06:39:00 UTC (rev 369)
@@ -552,6 +552,7 @@
 src/applications/testbed/Makefile
 src/applications/template/Makefile
 src/applications/topology_default/Makefile
+src/applications/topology_f2f/Makefile
 src/applications/tracekit/Makefile
 src/applications/traffic/Makefile
 src/applications/transport/Makefile

Modified: GNUnet/src/applications/Makefile.am
===================================================================
--- GNUnet/src/applications/Makefile.am 2005-03-05 06:08:01 UTC (rev 368)
+++ GNUnet/src/applications/Makefile.am 2005-03-05 06:39:00 UTC (rev 369)
@@ -31,6 +31,7 @@
  template \
  $(TESTBED_DIR) \
  topology_default \
+ topology_f2f \
  tracekit \
  traffic \
  transport

Modified: GNUnet/src/applications/OVERVIEW
===================================================================
--- GNUnet/src/applications/OVERVIEW    2005-03-05 06:08:01 UTC (rev 368)
+++ GNUnet/src/applications/OVERVIEW    2005-03-05 06:39:00 UTC (rev 369)
@@ -13,6 +13,7 @@
 session->transport
 session->identity
 session->pingpong
+session->topology
 
 pingpong->identity
 pingpong->transport

Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2005-03-05 06:08:01 UTC (rev 
368)
+++ GNUnet/src/applications/identity/identity.c 2005-03-05 06:39:00 UTC (rev 
369)
@@ -274,9 +274,9 @@
   unsigned int protoNumber;
   char * fullname;
 
-  GNUNET_ASSERT(sizeof(EncName) == 33);
+  GNUNET_ASSERT(sizeof(EncName) == 104);
   if (2 == sscanf(filename,
-                 "%32c.%u",
+                 "%103c.%u",
                  (char*)&id,
                  &protoNumber)) {
     id.encoding[sizeof(EncName)-1] = '\0';

Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c   2005-03-05 06:08:01 UTC (rev 
368)
+++ GNUnet/src/applications/session/connect.c   2005-03-05 06:39:00 UTC (rev 
369)
@@ -297,6 +297,9 @@
   EncName enc;
 
   GNUNET_ASSERT(receiver != NULL);
+  if ( (topology != NULL) &&
+       (topology->allowConnection(receiver) == SYSERR) )
+    return SYSERR;
   hash2enc(&receiver->hashPubKey,
           &enc);
   /* first: do we have a HELO for the other guy? */
@@ -435,6 +438,9 @@
   char * plaintext;
   EncName enc;
 
+  if ( (topology != NULL) &&
+       (topology->allowConnection(sender) == SYSERR) )
+    return SYSERR;
   hash2enc(&sender->hashPubKey,
           &enc);
 #if DEBUG_SESSION
@@ -581,6 +587,9 @@
  *         NO if we're going to try to establish one asynchronously
  */
 static int tryConnect(const PeerIdentity * peer) {
+  if ( (topology != NULL) &&
+       (topology->allowConnection(peer) == SYSERR) )
+    return SYSERR;
   if (coreAPI->queryBPMfromPeer(peer) != 0)
     return YES; /* trivial case */
   if (OK == exchangeKey(peer, NULL, NULL)) 
@@ -632,6 +641,7 @@
     identity = NULL;
     return NULL;
   }
+  topology = capi->requestService("topology");
 
   LOG(LOG_DEBUG,
       _("'%s' registering handler %d (plaintext and ciphertext)\n"),
@@ -653,6 +663,10 @@
                                      &acceptSessionKey);
   coreAPI->unregisterHandler(p2p_PROTO_SKEY,
                             &acceptSessionKeyUpdate);
+  if (topology != NULL) {
+    coreAPI->releaseService(topology);
+    topology = NULL;
+  }
   coreAPI->releaseService(identity);
   identity = NULL;
   coreAPI->releaseService(transport);

Modified: GNUnet/src/applications/topology_default/topology.c
===================================================================
--- GNUnet/src/applications/topology_default/topology.c 2005-03-05 06:08:01 UTC 
(rev 368)
+++ GNUnet/src/applications/topology_default/topology.c 2005-03-05 06:39:00 UTC 
(rev 369)
@@ -254,6 +254,10 @@
   return saturation;
 }
 
+static int allowConnection(const PeerIdentity peer) {
+  return OK; /* allow everything */
+}
+
 Topology_ServiceAPI * 
 provide_module_topology_default(CoreAPIForApplication * capi) {
   static Topology_ServiceAPI api;
@@ -299,6 +303,7 @@
 
   api.estimateNetworkSize = &estimateNetworkSize;
   api.getSaturation = &estimateSaturation;
+  api.allowConnectionFrom = &allowConnection;
   return &api;
 }
 

Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c       2005-03-05 06:08:01 UTC 
(rev 368)
+++ GNUnet/src/applications/transport/transport.c       2005-03-05 06:39:00 UTC 
(rev 369)
@@ -406,12 +406,12 @@
 
     perm = permute(tapis_count);
     ttype = tapis_count-1;
-    while ( ((tapis[perm[ttype]] == NULL) ||
-            (tapis[perm[ttype]] != NULL && 
-            tapis[perm[ttype]]->helo == NULL)) &&
-           (ttype < 0xFFFF) )
+    while ( (ttype < tapis_count) &&
+           ( (tapis[perm[ttype]] == NULL) ||
+             (tapis[perm[ttype]] != NULL && 
+              tapis[perm[ttype]]->helo == NULL) ) )
       ttype--;
-    if (ttype == 0xFFFF) {
+    if (ttype >= tapis_count) {
       FREE(perm);
       MUTEX_UNLOCK(&tapis_lock);
       return SYSERR;
@@ -604,6 +604,10 @@
        _("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);
+
     next = dso;
     do {
       pos = next;

Modified: GNUnet/src/include/gnunet_topology_service.h
===================================================================
--- GNUnet/src/include/gnunet_topology_service.h        2005-03-05 06:08:01 UTC 
(rev 368)
+++ GNUnet/src/include/gnunet_topology_service.h        2005-03-05 06:39:00 UTC 
(rev 369)
@@ -64,6 +64,13 @@
    */
   double (*getSaturation)();
 
+  /**
+   * Will the topology allow a connection from the specified peer?
+   * @return OK if a connection maybe established, SYSERR if not.
+   */
+  int (*allowConnectionFrom)(const PeerIdentity * peer);
+
+
 } Topology_ServiceAPI;
 
 #endif

Modified: GNUnet/src/util/configuration.c
===================================================================
--- GNUnet/src/util/configuration.c     2005-03-05 06:08:01 UTC (rev 368)
+++ GNUnet/src/util/configuration.c     2005-03-05 06:39:00 UTC (rev 369)
@@ -402,7 +402,7 @@
   char * expCfgName;
 
   cfgName = getConfigurationString("FILES",
-                                  "gnunet.conf");
+                                  "gnunet.conf");  
   if (cfgName == NULL) {
     if (testConfigurationString("GNUNETD",
                                "_MAGIC_",





reply via email to

[Prev in Thread] Current Thread [Next in Thread]