gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3267 - in GNUnet: . src/applications/chat src/applications


From: grothoff
Subject: [GNUnet-SVN] r3267 - in GNUnet: . src/applications/chat src/applications/fragmentation src/applications/rpc src/applications/testbed src/applications/vpn src/include src/server
Date: Sun, 20 Aug 2006 12:56:52 -0700 (PDT)

Author: grothoff
Date: 2006-08-20 12:56:42 -0700 (Sun, 20 Aug 2006)
New Revision: 3267

Modified:
   GNUnet/src/applications/chat/chat.c
   GNUnet/src/applications/chat/chat.h
   GNUnet/src/applications/fragmentation/fragmentationtest.c
   GNUnet/src/applications/rpc/Makefile.am
   GNUnet/src/applications/rpc/parameters.c
   GNUnet/src/applications/rpc/rpc.c
   GNUnet/src/applications/testbed/testbed.c
   GNUnet/src/applications/vpn/vpn.c
   GNUnet/src/include/gnunet_core.h
   GNUnet/src/include/gnunet_rpc_service.h
   GNUnet/src/server/connection.h
   GNUnet/todo
Log:
fixing rpc

Modified: GNUnet/src/applications/chat/chat.c
===================================================================
--- GNUnet/src/applications/chat/chat.c 2006-08-20 19:40:43 UTC (rev 3266)
+++ GNUnet/src/applications/chat/chat.c 2006-08-20 19:56:42 UTC (rev 3267)
@@ -50,7 +50,7 @@
 }
 
 typedef struct {
-  const P2P_MESSAGE_HEADER * message;
+  const MESSAGE_HEADER * message;
   unsigned int prio;
   unsigned int delay;
 } BCC;
@@ -63,7 +63,7 @@
                   bcc->delay);
 }
 
-static void broadcastToConnected(const P2P_MESSAGE_HEADER * message,
+static void broadcastToConnected(const MESSAGE_HEADER * message,
                                 unsigned int prio,
                                 unsigned int delay) {
   BCC bcc;
@@ -75,7 +75,7 @@
 }
 
 static int handleChatMSG(const PeerIdentity * sender,
-                        const P2P_MESSAGE_HEADER * message) {
+                        const MESSAGE_HEADER * message) {
   int i;
   int j;
   CS_chat_MESSAGE * cmsg;

Modified: GNUnet/src/applications/chat/chat.h
===================================================================
--- GNUnet/src/applications/chat/chat.h 2006-08-20 19:40:43 UTC (rev 3266)
+++ GNUnet/src/applications/chat/chat.h 2006-08-20 19:56:42 UTC (rev 3267)
@@ -31,7 +31,7 @@
 #define CHAT_MSG_LENGTH 1024
 
 typedef struct {
-  P2P_MESSAGE_HEADER header;
+  MESSAGE_HEADER header;
   char nick[CHAT_NICK_LENGTH];
   char message[CHAT_MSG_LENGTH];
 } P2P_chat_MESSAGE;

Modified: GNUnet/src/applications/fragmentation/fragmentationtest.c
===================================================================
--- GNUnet/src/applications/fragmentation/fragmentationtest.c   2006-08-20 
19:40:43 UTC (rev 3266)
+++ GNUnet/src/applications/fragmentation/fragmentationtest.c   2006-08-20 
19:56:42 UTC (rev 3267)
@@ -81,7 +81,7 @@
  * @param length of the data portion
  * @param id the identity of the fragment
  */
-static P2P_MESSAGE_HEADER * makeFragment(unsigned short start,
+static MESSAGE_HEADER * makeFragment(unsigned short start,
                                         unsigned short size,
                                         unsigned short tot,
                                         int id) {
@@ -123,7 +123,7 @@
 /* **************** actual testcases ***************** */
 
 static void testSimpleFragment() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
 
   pep = makeFragment(0, 16, 32, 42);
   processFragment(&mySender, pep);
@@ -134,7 +134,7 @@
 }
 
 static void testSimpleFragmentTimeout() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
 
   pep = makeFragment(0, 16, 32, 42);
   processFragment(&mySender, pep);
@@ -149,7 +149,7 @@
 }
 
 static void testSimpleFragmentReverse() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
 
   pep = makeFragment(16, 16, 32, 42);
   processFragment(&mySender, pep);
@@ -160,7 +160,7 @@
 }
 
 static void testManyFragments() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
   int i;
 
   for (i=0;i<50;i++) {
@@ -174,7 +174,7 @@
 }
 
 static void testManyFragmentsMegaLarge() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
   int i;
 
   for (i=0;i<4000;i++) {
@@ -188,7 +188,7 @@
 }
 
 static void testLastFragmentEarly() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
   int i;
 
   for (i=0;i<5;i++) {
@@ -206,7 +206,7 @@
 }
 
 static void testManyInterleavedFragments() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
   int i;
 
   for (i=0;i<50;i++) {
@@ -225,7 +225,7 @@
 }
 
 static void testManyInterleavedOverlappingFragments() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
   int i;
 
   for (i=0;i<50;i++) {
@@ -244,7 +244,7 @@
 }
 
 static void testManyOverlappingFragments() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
   int i;
 
   for (i=0;i<50;i++) {
@@ -258,7 +258,7 @@
 }
 
 static void testManyOverlappingFragmentsTimeout() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
   int i;
 
   for (i=0;i<50;i++) {
@@ -278,7 +278,7 @@
 }
 
 static void testManyFragmentsMultiId() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
   int i;
   int id;
 
@@ -299,7 +299,7 @@
 }
 
 static void testManyFragmentsMultiIdCollisions() {
-  P2P_MESSAGE_HEADER * pep;
+  MESSAGE_HEADER * pep;
   int i;
   int id;
 

Modified: GNUnet/src/applications/rpc/Makefile.am
===================================================================
--- GNUnet/src/applications/rpc/Makefile.am     2006-08-20 19:40:43 UTC (rev 
3266)
+++ GNUnet/src/applications/rpc/Makefile.am     2006-08-20 19:56:42 UTC (rev 
3267)
@@ -13,6 +13,7 @@
 
 libgnunetmodule_rpc_la_LIBADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/util/cron/libgnunetutil_cron.la \
   $(top_builddir)/src/applications/rpc/libgnunetmodule_rpc_util.la
 
 libgnunetmodule_rpc_la_LDFLAGS = \
@@ -22,6 +23,7 @@
   parameters.c 
 
 libgnunetmodule_rpc_util_la_LIBADD = \
+  $(top_builddir)/src/util/containers/libgnunetutil_containers.la \
   $(top_builddir)/src/util/libgnunetutil.la 
 
 

Modified: GNUnet/src/applications/rpc/parameters.c
===================================================================
--- GNUnet/src/applications/rpc/parameters.c    2006-08-20 19:40:43 UTC (rev 
3266)
+++ GNUnet/src/applications/rpc/parameters.c    2006-08-20 19:56:42 UTC (rev 
3267)
@@ -1,6 +1,7 @@
 /*
       This file is part of GNUnet
-
+      (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors)
+  
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
       by the Free Software Foundation; either version 2, or (at your
@@ -24,9 +25,10 @@
  * @author Antti Salonen, Christian Grothoff
  */
 
-#include "platform.h"
 #include "gnunet_util.h"
+#include "gnunet_util_containers.h"
 #include "gnunet_rpc_service.h"
+#include "platform.h"
 
 /**
  * A parameter to/from an RPC call. These (and nothing else) are stored in

Modified: GNUnet/src/applications/rpc/rpc.c
===================================================================
--- GNUnet/src/applications/rpc/rpc.c   2006-08-20 19:40:43 UTC (rev 3266)
+++ GNUnet/src/applications/rpc/rpc.c   2006-08-20 19:56:42 UTC (rev 3267)
@@ -79,8 +79,9 @@
  * lock must be held by the thread that accesses any module-wide accessable
  * data structures.
  */
-static Mutex * rpcLock;
+static struct MUTEX * rpcLock;
 
+static struct GE_Context * ectx;
 
 /* *************** RPC registration ****************** */
 
@@ -350,8 +351,9 @@
 
   pi = (PeerInfo*) vectorGetFirst(peerInformation);
   while (pi != NULL) {
-    if (hostIdentityEquals(id,
-                          &pi->identity))
+    if (0 == memcmp(id,
+                   &pi->identity,
+                   sizeof(PeerIdentity)))
       return pi;
     pi = (PeerInfo*) vectorGetNext(peerInformation);
   }
@@ -453,8 +455,9 @@
   MUTEX_LOCK(rpcLock);
   pi = vectorGetFirst(peerInformation);
   while (pi != NULL) {
-    if (hostIdentityEquals(peer,
-                          &pi->identity)) {
+    if (0 == memcmp(peer,
+                   &pi->identity,
+                   sizeof(PeerIdentity))) {
       for (i=0;i<MTRACK_COUNT;i++) {
        if (pi->lastRequestId[i] == messageID) {
          if (pi->lastRequestTimes[i] != 0) { /* resend */
@@ -488,7 +491,7 @@
  * indicate the number of return values.
  */
 typedef struct {
-  P2P_MESSAGE_HEADER header;
+  MESSAGE_HEADER header;
   TIME_T timestamp;
   unsigned int sequenceNumber;
   unsigned int importance;
@@ -514,7 +517,7 @@
  * times out).
  */
 typedef struct {
-  P2P_MESSAGE_HEADER header;
+  MESSAGE_HEADER header;
   /**
    * The number of the original request for which this is the
    * ACK.
@@ -623,7 +626,8 @@
  * each CallInstance.  Not renewed if the call times out,
  * deleted if the appropriate response is received.
  */
-static void retryRPCJob(CallInstance * call) {
+static void retryRPCJob(void * ctx) {
+  CallInstance * call = ctx;
   cron_t now;
 
   now = get_time();
@@ -695,10 +699,11 @@
     }
     GE_ASSERT(ectx,  (get_time() + 1 * cronMINUTES > call->expirationTime) ||
                   (call->expirationTime - get_time() < 1 * cronHOURS) );
-    addCronJob((CronJob) &retryRPCJob,
-              call->repetitionFrequency,
-              0,
-              call);
+    cron_add_job(coreAPI->cron,
+                &retryRPCJob,
+                call->repetitionFrequency,
+                0,
+                call);
   }
   MUTEX_UNLOCK(rpcLock);
 }
@@ -840,10 +845,11 @@
   GE_ASSERT(ectx,  (get_time() + 1 * cronMINUTES > calls->expirationTime) ||
                 (calls->expirationTime - get_time() < 1 * cronHOURS) );
   /* for right now: schedule cron job to send reply! */
-  addCronJob((CronJob)&retryRPCJob,
-            0,
-            0,
-            calls);
+  cron_add_job(coreAPI->cron,
+              &retryRPCJob,
+              0,
+              0,
+              calls);
   MUTEX_UNLOCK (rpcLock);
 }
 
@@ -854,7 +860,7 @@
  * reply.
  */
 static int handleRPCMessageReq(const PeerIdentity *sender,
-                              const P2P_MESSAGE_HEADER * message) {
+                              const MESSAGE_HEADER * message) {
   P2P_rpc_MESSAGE * req;
   CallInstance * calls;
   unsigned int sq;
@@ -867,15 +873,17 @@
 
   if ( (ntohs(message->type) != P2P_PROTO_rpc_REQ) ||
        (ntohs(message->size) < sizeof(P2P_rpc_MESSAGE)) ) {
-    LOG (LOG_WARNING,
-        _("Invalid message of type %u received.  Dropping.\n"),
-        ntohs(message->type));
+    GE_LOG(ectx,
+          GE_WARNING | GE_REQUEST | GE_ADMIN,
+          _("Invalid message of type %u received.  Dropping.\n"),
+          ntohs(message->type));
     return SYSERR;
   }
   req = (P2P_rpc_MESSAGE *) message;
   sq = ntohl(req->sequenceNumber);
 #if DEBUG_RPC
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+  GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
       "Received RPC request with id %u.\n",
       sq);
 #endif
@@ -894,8 +902,9 @@
     if (calls->sequenceNumber < minSQ)
       minSQ = calls->sequenceNumber;
     if ( (calls->sequenceNumber == sq) &&
-        (hostIdentityEquals(&calls->receiver,
-                            sender)) )
+        (0 == memcmp(&calls->receiver,
+                     sender,
+                     sizeof(PeerIdentity))) )
       break;
     calls = vectorGetNext(incomingCalls);
   }
@@ -992,7 +1001,7 @@
  * Also always sends an ACK.
  */
 static int handleRPCMessageRes(const PeerIdentity * sender,
-                              const P2P_MESSAGE_HEADER * message) {
+                              const MESSAGE_HEADER * message) {
   P2P_rpc_MESSAGE * res;
   CallInstance * call;
 
@@ -1005,18 +1014,22 @@
   }
   res = (P2P_rpc_MESSAGE *) message;
 #if DEBUG_RPC
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "Received RPC reply with id %u.\n",
-      ntohl(res->sequenceNumber));
+  GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "Received RPC reply with id %u.\n",
+        ntohl(res->sequenceNumber));
 #endif
 
-  suspendCron();
+  cron_suspend(coreAPI->cron,
+              NO);
   MUTEX_LOCK (rpcLock);
 
   /* Locate the CallInstance structure. */
   call = vectorGetFirst(outgoingCalls);
   while (call != NULL) {
-    if ( hostIdentityEquals(&call->receiver, sender) &&
+    if ( (0 == memcmp(&call->receiver, 
+                     sender,
+                     sizeof(PeerIdentity))) &&
         (call->sequenceNumber == ntohl(res->sequenceNumber)) )
       break;
     call = vectorGetNext(outgoingCalls);
@@ -1052,9 +1065,10 @@
     notifyPeerReply(sender,
                    MINGLE(call->sequenceNumber,
                           P2P_PROTO_rpc_REQ));
-    delCronJob((CronJob) &retryRPCJob,
-              0,
-              call);
+    cron_del_job(coreAPI->cron,
+                &retryRPCJob,
+                0,
+                call);
     FREE(call->msg);
     FREE(call);
     if (reply != NULL)
@@ -1065,7 +1079,8 @@
          0,/* not important, ACK should be tiny enough to go through anyway */
          0 /* right away */);
   MUTEX_UNLOCK (rpcLock);
-  resumeCron();
+  cron_resume_jobs(coreAPI->cron,
+                  NO);
   return OK;
 }
 
@@ -1074,15 +1089,16 @@
  * Handle a peer-to-peer message of type P2P_PROTO_rpc_ACK.
  */
 static int handleRPCMessageAck(const PeerIdentity *sender,
-                              const P2P_MESSAGE_HEADER * message) {
+                              const MESSAGE_HEADER * message) {
   RPC_ACK_Message * ack;
   CallInstance *call;
 
   if ( (ntohs(message->type) != P2P_PROTO_rpc_ACK) ||
        (ntohs(message->size) != sizeof(RPC_ACK_Message)) ) {
-    LOG (LOG_WARNING,
-        _("Invalid message of type %u received.  Dropping.\n"),
-         ntohs (message->type));
+    GE_LOG(ectx,
+          GE_WARNING | GE_REQUEST | GE_ADMIN,
+          _("Invalid message of type %u received.  Dropping.\n"),
+          ntohs (message->type));
     return SYSERR;
   }
 
@@ -1092,13 +1108,16 @@
       "Received RPC ACK with id %u.\n",
       ntohl(ack->sequenceNumber));
 #endif
-  suspendCron();
+  cron_suspend(coreAPI->cron,
+              NO);
   MUTEX_LOCK(rpcLock);
 
   /* Locate the CallInstance structure. */
   call = (CallInstance*) vectorGetFirst(incomingCalls);
   while (call != NULL) {
-    if ( hostIdentityEquals(&call->receiver, sender) &&
+    if ( (0 == memcmp(&call->receiver, 
+                     sender,
+                     sizeof(PeerIdentity))) &&
         (call->sequenceNumber == ntohl(ack->sequenceNumber)) )
       break;
     call = (CallInstance*) vectorGetNext(incomingCalls);
@@ -1110,9 +1129,10 @@
     notifyPeerReply(sender,
                    MINGLE(ntohl(ack->sequenceNumber),
                           P2P_PROTO_rpc_RES));
-    delCronJob((CronJob) &retryRPCJob,
-              0,
-              call);
+    cron_del_job(coreAPI->cron,
+                &retryRPCJob,
+                0,
+                call);
     vectorRemoveObject(incomingCalls,
                       call);
     FREE(call->msg);
@@ -1130,14 +1150,15 @@
   }
 
   MUTEX_UNLOCK (rpcLock);
-  resumeCron();
+  cron_resume_jobs(coreAPI->cron,
+                  NO);
   return OK;
 }
 
 /* ********************* RPC service functions ******************** */
 
 typedef struct {
-  Semaphore * sem;
+  struct SEMAPHORE * sem;
   RPC_Param * result;
   unsigned short ec;
 } RPC_EXEC_CLS;
@@ -1208,14 +1229,16 @@
   call->finishedCallback = (RPCFinishedCallback) &RPC_execute_callback;
   call->rpcCallbackArgs = &cls;
   vectorInsertLast(outgoingCalls, call);
-  GE_ASSERT(ectx,  (get_time() + 1 * cronMINUTES > call->expirationTime) ||
-                (call->expirationTime - get_time() < 1 * cronHOURS) );
-  addCronJob((CronJob) &retryRPCJob,
-            0,
-            0,
-            call);
+  GE_ASSERT(ectx,  
+           (get_time() + 1 * cronMINUTES > call->expirationTime) ||
+           (call->expirationTime - get_time() < 1 * cronHOURS) );
+  cron_add_job(coreAPI->cron,
+              &retryRPCJob,
+              0,
+              0,
+              call);
   MUTEX_UNLOCK (rpcLock);
-  SEMAPHORE_DOWN(cls.sem);
+  SEMAPHORE_DOWN(cls.sem, YES);
   SEMAPHORE_DESTROY(cls.sem);
   RPC_STATUS(name, "completed synchronously", call);
   return cls.ec;
@@ -1293,10 +1316,11 @@
   vectorInsertLast(outgoingCalls, ret->call);
   GE_ASSERT(ectx,  (get_time() + 1 * cronMINUTES > ret->call->expirationTime) 
||
                 (ret->call->expirationTime - get_time() < 1 * cronHOURS) );
-  addCronJob((CronJob) &retryRPCJob,
-            0,
-            0,
-            ret->call);
+  cron_add_job(coreAPI->cron,
+              &retryRPCJob,
+              0,
+              0,
+              ret->call);
   MUTEX_UNLOCK (rpcLock);
   return ret;
 }
@@ -1310,17 +1334,16 @@
  */
 static int RPC_stop(RPC_Record * record) {
   int ret;
-  int cronRunning;
 
   RPC_STATUS("", "stopped", record);
-  cronRunning = isCronRunning();
-  if (cronRunning)
-    suspendIfNotCron();
-  delCronJob((CronJob) &retryRPCJob,
-            0,
-            record->call);
-  if (cronRunning)
-    resumeIfNotCron();
+  cron_suspend(coreAPI->cron,
+              YES);
+  cron_del_job(coreAPI->cron,
+              &retryRPCJob,
+              0,
+              record->call);
+  cron_resume_jobs(coreAPI->cron,
+                  YES);
   MUTEX_LOCK(rpcLock);
   if (NULL != vectorRemoveObject(outgoingCalls, record->call)) {
     FREE(record->call->msg);
@@ -1341,9 +1364,10 @@
 void release_module_rpc() {
   CallInstance * call;
 
-  delCronJob(&agePeerStats,
-            PEER_TRACKING_TIME_INTERVAL,
-            NULL);
+  cron_del_job(coreAPI->cron,
+              &agePeerStats,
+              PEER_TRACKING_TIME_INTERVAL,
+              NULL);
   coreAPI->unregisterHandler(P2P_PROTO_rpc_REQ,
                             &handleRPCMessageReq);
   coreAPI->unregisterHandler(P2P_PROTO_rpc_RES,
@@ -1359,9 +1383,10 @@
   if (NULL != incomingCalls) {
     while(vectorSize (incomingCalls) > 0) {
       call = (CallInstance*) vectorRemoveLast(incomingCalls);
-      delCronJob((CronJob)&retryRPCJob,
-                0,
-                call);
+      cron_del_job(coreAPI->cron,
+                  &retryRPCJob,
+                  0,
+                  call);
       FREE(call->msg);
       FREE(call);
     }
@@ -1371,9 +1396,10 @@
   if (NULL != outgoingCalls) {
     while(vectorSize (outgoingCalls) > 0) {
       call = (CallInstance*) vectorRemoveLast(outgoingCalls);
-      delCronJob((CronJob) &retryRPCJob,
-                0,
-                call);
+      cron_del_job(coreAPI->cron,
+                  &retryRPCJob,
+                  0,
+                  call);
       FREE(call->msg);
       FREE(call);
     }
@@ -1404,6 +1430,7 @@
   static RPC_ServiceAPI rpcAPI;
   int rvalue;
 
+  ectx = capi->ectx;
   rpcLock = capi->getConnectionModuleLock();
   coreAPI = capi;
   peerInformation = vectorNew(16);
@@ -1443,10 +1470,11 @@
     rpcAPI.RPC_unregister_async = &RPC_unregister_async;
     rpcAPI.RPC_start = &RPC_start;
     rpcAPI.RPC_stop = &RPC_stop;
-    addCronJob(&agePeerStats,
-              PEER_TRACKING_TIME_INTERVAL,
-              PEER_TRACKING_TIME_INTERVAL,
-              NULL);
+    cron_add_job(coreAPI->cron,
+                &agePeerStats,
+                PEER_TRACKING_TIME_INTERVAL,
+                PEER_TRACKING_TIME_INTERVAL,
+                NULL);
     return &rpcAPI;
   }
 }
@@ -1476,11 +1504,11 @@
 }
 
 static void async_RPC_Complete_callback(RPC_Param * results,
-                                       Semaphore * sign) {
+                                       struct SEMAPHORE * sign) {
   unsigned int dl;
   char * reply;
 
-  SEMAPHORE_DOWN(sign);
+  SEMAPHORE_DOWN(sign, YES);
   if ( (OK != RPC_paramValueByName(results,
                                   "response",
                                   &dl,
@@ -1503,10 +1531,11 @@
   char * reply;
   int code;
   RPC_Record * record;
-  Semaphore * sign;
+  struct SEMAPHORE * sign;
 
-  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
-      "RPC testcase starting\n");
+  GE_LOG(ectx, 
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "RPC testcase starting\n");
   rpcAPI = capi->requestService("rpc");
   if (rpcAPI == NULL) {
     GE_BREAK(ectx, 0);

Modified: GNUnet/src/applications/testbed/testbed.c
===================================================================
--- GNUnet/src/applications/testbed/testbed.c   2006-08-20 19:40:43 UTC (rev 
3266)
+++ GNUnet/src/applications/testbed/testbed.c   2006-08-20 19:56:42 UTC (rev 
3267)
@@ -66,7 +66,7 @@
  */
 static void tb_ADD_PEER(ClientHandle client,
                        TESTBED_CS_MESSAGE * msg) {
-  P2P_MESSAGE_HEADER noise;
+  MESSAGE_HEADER noise;
   TESTBED_ADD_PEER_MESSAGE * hm
     = (TESTBED_ADD_PEER_MESSAGE*) msg;
 
@@ -88,7 +88,7 @@
   }
 
   identity->addHost(&hm->helo);
-  noise.size = htons(sizeof(P2P_MESSAGE_HEADER));
+  noise.size = htons(sizeof(MESSAGE_HEADER));
   noise.type = htons(P2P_PROTO_noise);
   coreAPI->unicast(&hm->helo.senderIdentity,
                   &noise,

Modified: GNUnet/src/applications/vpn/vpn.c
===================================================================
--- GNUnet/src/applications/vpn/vpn.c   2006-08-20 19:40:43 UTC (rev 3266)
+++ GNUnet/src/applications/vpn/vpn.c   2006-08-20 19:56:42 UTC (rev 3267)
@@ -117,7 +117,7 @@
  */
 #define maxi(a,b) ((a)>(b)?(a):(b))
 #define mini(a,b) ((a)<(b)?(a):(b))
-#define HEADER_FRAME maxi(sizeof(P2P_MESSAGE_HEADER), sizeof(struct tun_pi))
+#define HEADER_FRAME maxi(sizeof(MESSAGE_HEADER), sizeof(struct tun_pi))
 
 /* we can't actually send messages this long... maybe 2 bytes shorter tho
  * planned includes a way to send yet longer messages
@@ -716,7 +716,7 @@
        char frame[IP_FRAME + HEADER_FRAME];
        struct ip6_hdr* fp;
        struct tun_pi* tp;
-       P2P_MESSAGE_HEADER* gp;
+       MESSAGE_HEADER* gp;
        struct timeval timeout;
 
        /* need the cast otherwise it increments by HEADER_FRAME * 
sizeof(frame) rather than HEADER_FRAME */
@@ -724,7 +724,7 @@
 
        /* this trick decrements the pointer by the sizes of the respective 
structs */
        tp = ((struct tun_pi*)fp)-1;
-       gp = ((P2P_MESSAGE_HEADER*)fp)-1;
+       gp = ((MESSAGE_HEADER*)fp)-1;
        running = 1;
        LOG(LOG_DEBUG, _("RFC4193 Thread running (frame %d tunnel %d f2f %d) 
...\n"), fp, tp, gp);
 
@@ -777,7 +777,7 @@
                                 */
                                if (valid_incoming(ret, tp, fp)) {
                                        gp->type = htons(P2P_PROTO_aip_IP);
-                                       gp->size = 
htons(sizeof(P2P_MESSAGE_HEADER) + ret - sizeof(struct tun_pi));
+                                       gp->size = htons(sizeof(MESSAGE_HEADER) 
+ ret - sizeof(struct tun_pi));
                                        
coreAPI->unicast(&((store1+i)->peer),gp,EXTREME_PRIORITY,1);
                                        
coreAPI->preferTrafficFrom(&((store1+i)->peer),1000);
                                }
@@ -817,14 +817,14 @@
  * If we've not seen the peer before, create a new TAP and tell our thread 
about it?
  * else scan the array of TAPS and copy the message into it.
  *
- * Mainly this routine exchanges the P2P_MESSAGE_HEADER on incoming ipv6 
packets
+ * Mainly this routine exchanges the MESSAGE_HEADER on incoming ipv6 packets
  * for a TUN/TAP header for writing it to TUNTAP.
  */
-static int handlep2pMSG(const PeerIdentity * sender, const P2P_MESSAGE_HEADER 
* gp) {
+static int handlep2pMSG(const PeerIdentity * sender, const MESSAGE_HEADER * 
gp) {
        int i = 0, fd;
        char loginfo[100];
 
-       P2P_MESSAGE_HEADER * rgp = NULL;
+       MESSAGE_HEADER * rgp = NULL;
        char frame[IP_FRAME + sizeof(struct tun_pi)];
         const struct ip6_hdr* fp = (struct ip6_hdr*)(gp+1);
         struct ip6_hdr* new_fp = (struct ip6_hdr*)(((char*)&frame) + 
sizeof(struct tun_pi));
@@ -867,10 +867,10 @@
                ipinfo(loginfo, fp);
 
                /* do packet memcpy outside of mutex for speed */
-               memcpy(new_fp, fp, ntohs(gp->size)-sizeof(P2P_MESSAGE_HEADER));
+               memcpy(new_fp, fp, ntohs(gp->size)-sizeof(MESSAGE_HEADER));
 
                MUTEX_LOCK(&lock);
-               VLOG _("<- GNUnet(%d) : %s\n"), ntohs(gp->size) - 
sizeof(P2P_MESSAGE_HEADER), loginfo);
+               VLOG _("<- GNUnet(%d) : %s\n"), ntohs(gp->size) - 
sizeof(MESSAGE_HEADER), loginfo);
                for (i = 0; i < entries1; i++) {
                        if (isEqual(sender, &((store1+i)->peer))) {
                                fd = ((store1+i)->fd);
@@ -880,7 +880,7 @@
                                /* We are only allowed one call to write() per 
packet.
                                 * We need to write packet and packetinfo 
together in one go.
                                 */
-                               write(fd, tp, ntohs(gp->size) + sizeof(struct 
tun_pi) - sizeof(P2P_MESSAGE_HEADER));
+                               write(fd, tp, ntohs(gp->size) + sizeof(struct 
tun_pi) - sizeof(MESSAGE_HEADER));
                                
coreAPI->preferTrafficFrom(&((store1+i)->peer),1000);
                                MUTEX_UNLOCK(&lock);
                                return OK;
@@ -911,17 +911,17 @@
        case P2P_PROTO_aip_GETROUTE:
                /** peer wants an entry from our routing table */
                VLOG _("Receive route request\n"));
-               if (ntohs(gp->size) == (sizeof(P2P_MESSAGE_HEADER) + 
sizeof(int))) {
+               if (ntohs(gp->size) == (sizeof(MESSAGE_HEADER) + sizeof(int))) {
                        i = ntohl(*((int*)fp));
                        MUTEX_LOCK(&lock);
                        if (i < realised_entries) {
                                VLOG _("Prepare route announcement level 
%d\n"), i);
-                               rgp = MALLOC(sizeof(P2P_MESSAGE_HEADER) + 
sizeof(transit_route));
+                               rgp = MALLOC(sizeof(MESSAGE_HEADER) + 
sizeof(transit_route));
                                if (rgp == NULL) {
                                        MUTEX_UNLOCK(&lock);
                                        return OK;
                                }
-                               rgp->size = htons(sizeof(P2P_MESSAGE_HEADER) + 
sizeof(transit_route));
+                               rgp->size = htons(sizeof(MESSAGE_HEADER) + 
sizeof(transit_route));
                                rgp->type = htons(P2P_PROTO_aip_ROUTE);
                                ((transit_route*)(rgp+1))->owner = 
(realised_store+i)->owner;
                                ((transit_route*)(rgp+1))->hops = 
htonl((realised_store+i)->hops);
@@ -933,12 +933,12 @@
                                return OK;
                        }
                        VLOG _("Send outside table info %d\n"), i);
-                       rgp = MALLOC(sizeof(P2P_MESSAGE_HEADER) + sizeof(int));
+                       rgp = MALLOC(sizeof(MESSAGE_HEADER) + sizeof(int));
                        if (rgp == NULL) {
                                MUTEX_UNLOCK(&lock);
                                return OK;
                        }
-                       rgp->size = htons(sizeof(P2P_MESSAGE_HEADER) + 
sizeof(int));
+                       rgp->size = htons(sizeof(MESSAGE_HEADER) + sizeof(int));
                        rgp->type = htons(P2P_PROTO_aip_ROUTES);
                        *((int*)(rgp+1)) = htonl(realised_entries);
                        MUTEX_UNLOCK(&lock);
@@ -950,7 +950,7 @@
        case P2P_PROTO_aip_ROUTE:
                VLOG _("Receive route announce.\n"));
                /** peer sent us a route, insert it into routing table, then 
req next entry */
-               if (ntohs(gp->size) == (sizeof(P2P_MESSAGE_HEADER) + 
sizeof(transit_route))) {
+               if (ntohs(gp->size) == (sizeof(MESSAGE_HEADER) + 
sizeof(transit_route))) {
                        MUTEX_LOCK(&lock);
                        VLOG _("Going to try insert route into local 
table.\n"));
                        for (i = 0; i < entries1; i++) {
@@ -962,13 +962,13 @@
                                                        i);
                                        if ((store1+i)->route_entry < 
GNUNET_VIEW_LIMIT) {
                                                (store1+i)->route_entry++;
-                                               rgp = 
MALLOC(sizeof(P2P_MESSAGE_HEADER) + sizeof(int));
+                                               rgp = 
MALLOC(sizeof(MESSAGE_HEADER) + sizeof(int));
                                                if (rgp == NULL) {
                                                        MUTEX_UNLOCK(&lock);
                                                        return OK;
                                                }
                                                rgp->type = 
htons(P2P_PROTO_aip_GETROUTE);
-                                               rgp->size = 
htons(sizeof(P2P_MESSAGE_HEADER) + sizeof(int));
+                                               rgp->size = 
htons(sizeof(MESSAGE_HEADER) + sizeof(int));
                                                *((int*)(rgp+1)) = 
htonl((store1+i)->route_entry);
                                                VLOG _("Request level %d from 
peer %d\n"), (store1+i)->route_entry, i);
                                                
coreAPI->unicast(&((store1+i)->peer),rgp,EXTREME_PRIORITY,60);
@@ -981,7 +981,7 @@
                }
                return OK;
        case P2P_PROTO_aip_ROUTES:
-               if (ntohs(gp->size) == (sizeof(P2P_MESSAGE_HEADER) + 
sizeof(int))) {
+               if (ntohs(gp->size) == (sizeof(MESSAGE_HEADER) + sizeof(int))) {
                        /* if this is the last route message, we do route 
realisation
                         * that is, insert the routes into the operating system.
                         */
@@ -1167,7 +1167,7 @@
 
 /** The console client is used to admin/debug vpn */
 static int csHandle(ClientHandle c, const CS_MESSAGE_HEADER * message) {
-       P2P_MESSAGE_HEADER * rgp = NULL;
+       MESSAGE_HEADER * rgp = NULL;
        int i;
        PeerIdentity id;
        int parameter = ntohs(message->size) - sizeof(CS_MESSAGE_HEADER);
@@ -1256,10 +1256,10 @@
                        (store1+i)->route_entry = 0;
                        /* lets send it to everyone - expect response only from 
VPN enabled nodes tho :-) */
 /*                     if ((store1+i)->active == YES) { */
-                               rgp = MALLOC(sizeof(P2P_MESSAGE_HEADER) + 
sizeof(int));
+                               rgp = MALLOC(sizeof(MESSAGE_HEADER) + 
sizeof(int));
                                if (rgp == NULL) { break; }
                                rgp->type = htons(P2P_PROTO_aip_GETROUTE);
-                               rgp->size = htons(sizeof(P2P_MESSAGE_HEADER) + 
sizeof(int));
+                               rgp->size = htons(sizeof(MESSAGE_HEADER) + 
sizeof(int));
                                *((int*)(rgp+1)) = 
htonl((store1+i)->route_entry);
                                cprintf(c, CS_PROTO_VPN_REPLY, "Request level 
%d from peer %d ", (store1+i)->route_entry, i);
                                id2ip(c, &((store1+i)->peer));
@@ -1317,10 +1317,10 @@
                                        }
 
                                        /* req route level 0
-                                       rgp = MALLOC(sizeof(P2P_MESSAGE_HEADER) 
+ sizeof(int));
+                                       rgp = MALLOC(sizeof(MESSAGE_HEADER) + 
sizeof(int));
                                        if (rgp != NULL) { 
                                                rgp->type = 
htons(P2P_PROTO_aip_GETROUTE);
-                                               rgp->size = 
htons(sizeof(P2P_MESSAGE_HEADER) + sizeof(int));
+                                               rgp->size = 
htons(sizeof(MESSAGE_HEADER) + sizeof(int));
                                                *((int*)(rgp+1)) = 0;
                                                
coreAPI->unicast(&id,rgp,EXTREME_PRIORITY,4);
                                                cprintf(c, " Sent");

Modified: GNUnet/src/include/gnunet_core.h
===================================================================
--- GNUnet/src/include/gnunet_core.h    2006-08-20 19:40:43 UTC (rev 3266)
+++ GNUnet/src/include/gnunet_core.h    2006-08-20 19:56:42 UTC (rev 3267)
@@ -312,7 +312,7 @@
    * from the GNUnet core.
    *
    * @param session the transport session
-   * @param msg the message to transmit, should contain P2P_MESSAGE_HEADERs
+   * @param msg the message to transmit, should contain MESSAGE_HEADERs
    * @return OK on success, SYSERR on failure
    */
   int (*sendPlaintext)(TSession * session,

Modified: GNUnet/src/include/gnunet_rpc_service.h
===================================================================
--- GNUnet/src/include/gnunet_rpc_service.h     2006-08-20 19:40:43 UTC (rev 
3266)
+++ GNUnet/src/include/gnunet_rpc_service.h     2006-08-20 19:56:42 UTC (rev 
3267)
@@ -28,6 +28,7 @@
 #define GNUNET_RPC_SERVICE_H
 
 #include "gnunet_core.h"
+#include "gnunet_util_containers.h"
 #include "gnunet_blockstore.h"
 
 #ifdef __cplusplus

Modified: GNUnet/src/server/connection.h
===================================================================
--- GNUnet/src/server/connection.h      2006-08-20 19:40:43 UTC (rev 3266)
+++ GNUnet/src/server/connection.h      2006-08-20 19:56:42 UTC (rev 3267)
@@ -37,7 +37,7 @@
  * decrypting the message.  It provides a timestamp and sequence
  * number (to guard against replay attacks).  The header is followed
  * by the 'data' which contains a sequence of GNUnet p2p messages,
- * each with its own P2P_MESSAGE_HEADER.
+ * each with its own MESSAGE_HEADER.
  */
 typedef struct {
   /* hash of the plaintext, used to verify message integrity;
@@ -125,7 +125,7 @@
  * from the GNUnet core.
  *
  * @param session the transport session
- * @param msg the message to transmit, should contain P2P_MESSAGE_HEADERs
+ * @param msg the message to transmit, should contain MESSAGE_HEADERs
  * @return OK on success, SYSERR on failure
  */
 int sendPlaintext(TSession * tsession,

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-08-20 19:40:43 UTC (rev 3266)
+++ GNUnet/todo 2006-08-20 19:56:42 UTC (rev 3267)
@@ -29,10 +29,10 @@
       traffic, ecrs_core, template, tbench, tracekit, fs/fslib,
       fs/module, gap, fs/ecrs, fs/uritrack, fs/namespace,
       fs/fsui, fs/collection, fs/tools, bootstrap_http,
-      sqstore_mysql, topology_f2f compile
+      sqstore_mysql, topology_f2f, rpc compile
     + fs/fsui, fs/collection, fs/uritrack, fs/namespace
       must still be revised to match new API!
-    + rest: dht, rpc, vpn
+    + rest: dht, vpn
     + low priority: chat, kvstore_sqlite, testbed
   * setup:
     + main binary compiles, plugins are missing





reply via email to

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