]> p2p-next.cs.pub.ro Git - swift-upb.git/commitdiff
Renamed p2tp to swift everywhere.
authorVictor Grishchenko <victor.grishchenko@gmail.com>
Tue, 26 Jan 2010 16:27:36 +0000 (17:27 +0100)
committerVictor Grishchenko <victor.grishchenko@gmail.com>
Tue, 26 Jan 2010 16:27:36 +0000 (17:27 +0100)
For the purpose of consistency.

30 files changed:
bin64.cpp
compat.cpp
compat.h
compat/hirestimeofday.cpp
compat/hirestimeofday.h
compat/util.cpp
compat/util.h
datagram.cpp
datagram.h
exec/hasher.cpp
exec/leecher.cpp
exec/seeder.cpp
exec/trial.cpp
ext/ledbat_controller.cpp
ext/mmap_storer.cpp
ext/seq_picker.cpp
ext/simple_selector.cpp
hashtree.cpp
hashtree.h
mfold/doseq.sh
send_control.cpp
sendrecv.cpp
swift.cpp [moved from p2tp.cpp with 86% similarity]
swift.h [moved from p2tp.h with 99% similarity]
tests/connecttest.cpp
tests/dgramtest.cpp
tests/hashtest.cpp
tests/ledbattest.cpp
tests/transfertest.cpp
transfer.cpp

index 6b2ccb5c03189e52520d47f20e0bb76b79eae990..bb2615467c5ec869496ccebea0073e87149c3341 100644 (file)
--- a/bin64.cpp
+++ b/bin64.cpp
@@ -1,6 +1,6 @@
 /*
  *  bin64.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Victor Grishchenko on 10/10/09.
  *  Copyright 2009 Delft University of Technology. All rights reserved.
index 0945744220a3bec1493d6ba60e63de488f59544e..c81bdbfb14ff6bc7feef43fe92384d96359f3f96 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  compat.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Arno Bakker, Victor Grishchenko
  *  Copyright 2009 Delft University of Technology. All rights reserved.
@@ -21,7 +21,7 @@
 #include <sys/time.h>
 #endif
 
-namespace p2tp {
+namespace swift {
 
 #ifdef _WIN32
 static HANDLE map_handles[1024];
index 1bfeedf61bce0f726918f74a941cfdabca6be441..ffd1378aad5bde3a185dc7a3b3a8c1f0dbb3fbab 100644 (file)
--- a/compat.h
+++ b/compat.h
@@ -33,7 +33,7 @@
 #define S_IROTH _S_IREAD
 #endif
 
-namespace p2tp {
+namespace swift {
 
 /** tint is the time integer type; microsecond-precise. */
 typedef int64_t tint;
index f5aad7c9599129c11fa2cc034ac92576a258b8eb..29595bef50d8bdbf143dfa9977ce1ec8ac6b5169 100644 (file)
@@ -11,7 +11,7 @@
 #include <sys/time.h>\r
 #endif\r
 \r
-namespace p2tp {\r
+namespace swift {\r
 \r
 HiResTimeOfDay* HiResTimeOfDay::_instance = 0;\r
 \r
@@ -112,7 +112,7 @@ tint HiResTimeOfDay::getTimeUSec(void)
   \r
   \r
   \r
-// ARNOTODO: move to p2tp.cpp\r
+// ARNOTODO: move to swift.cpp\r
 \r
 #ifdef _WIN32\r
 static WSADATA _WSAData;\r
@@ -138,7 +138,7 @@ void LibraryInit(void)
 #ifdef TEST\r
 #include <iostream>\r
 \r
-using namespace p2tp;\r
+using namespace swift;\r
 \r
 int main()\r
 {\r
index 731da1e24a6e095f1ba6ddf7b6559eead8804508..362dd967ca117d57f6e75b3fc3fbfaf0474b6add 100644 (file)
@@ -17,7 +17,7 @@
 #include <windows.h>\r
 #endif\r
 \r
-namespace p2tp {\r
+namespace swift {\r
 \r
 typedef int64_t tint;\r
 #define TINT_SEC ((tint)1000000)\r
index 281dfac52691a390fe859bd8f04479b779781390..579ef8430afeb0f7a794817db8347e0f8fa5d3c0 100644 (file)
@@ -11,7 +11,7 @@
 #include <Tchar.h>\r
 #endif\r
 \r
-namespace p2tp\r
+namespace swift\r
 {\r
 \r
 std::string gettmpdir(void)\r
index aa99df670823b74828625fa66c41c6aaa3f5f9cf..dd9256b8f2927a323b5589458ebff274bca587e2 100644 (file)
@@ -10,7 +10,7 @@
 \r
 #include <string>\r
 \r
-namespace p2tp\r
+namespace swift\r
 {\r
        /**\r
         * Return path of temporary directory.\r
index 76ec217a62c9c239f81ed29e4e9faf46dfbb67c0..93124e00095747e45264057ff341788fe6069899 100644 (file)
@@ -19,7 +19,7 @@
 #include "datagram.h"
 #include "compat.h"
 
-namespace p2tp {
+namespace swift {
 
 tint Datagram::now = Datagram::Time();
 tint Datagram::start = now;
index 6866be1a33bc6731a9e228b61b7ec568d038424b..30a9ec31960ebe6cfd0d0a8df3344e895b084557 100644 (file)
@@ -37,7 +37,7 @@
 #include "compat.h"
 
 
-namespace p2tp {
+namespace swift {
 
 #define MAXDGRAMSZ 2800
 #ifndef _WIN32
index 1e7127e08f10587efd4357e4c8df834bb1f69044..c95f1193620316d7a52f3304fa3daefe7d150a3f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  hasher.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Victor Grishchenko on 11/8/09.
  *  Copyright 2009 Delft University of Technology. All rights reserved.
@@ -17,7 +17,7 @@ int main (int argn, char** args) {
         return 1;
     }
 
-    p2tp::HashTree* ht = new p2tp::HashTree(args[1]);
+    swift::HashTree* ht = new swift::HashTree(args[1]);
 
     printf("SHA1 Merkle tree root hash: %s\n",ht->root_hash().hex().c_str());
 
index ff08ad8345cf7a25b4adc1f709886928e6d2cf33..38cdaa7cb0fe928b361b919a38c7009dc12cb052 100644 (file)
@@ -1,16 +1,16 @@
 /*
  *  leecher.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Victor Grishchenko on 11/3/09.
  *  Copyright 2009 Delft University of Technology. All rights reserved.
  *
  */
-#include "p2tp.h"
+#include "swift.h"
 #include <time.h>
 
 
-using namespace p2tp;
+using namespace swift;
 
 
 /** P2TP downloader. Params: root hash, filename, tracker ip/port, own ip/port */
@@ -28,7 +28,7 @@ int main (int argn, char** args) {
         return -2;
     }
 
-    p2tp::LibraryInit();
+    swift::LibraryInit();
 
     char* filename = args[2];
 
@@ -43,28 +43,28 @@ int main (int argn, char** args) {
     else
         bindaddr = Address((uint32_t)INADDR_ANY,rand()%10000+7000);
 
-    assert(0<p2tp::Listen(bindaddr));
+    assert(0<swift::Listen(bindaddr));
 
-       p2tp::SetTracker(tracker);
+       swift::SetTracker(tracker);
 
-       int file = p2tp::Open(filename,root_hash);
+       int file = swift::Open(filename,root_hash);
     printf("Downloading %s\n",root_hash.hex().c_str());
 
     tint start = NOW;
 
-    while (!p2tp::IsComplete(file)){// && NOW-start<TINT_SEC*60) {
-           p2tp::Loop(TINT_SEC);
+    while (!swift::IsComplete(file)){// && NOW-start<TINT_SEC*60) {
+           swift::Loop(TINT_SEC);
         eprintf("done %lli of %lli (seq %lli) %lli dgram %lli bytes up, %lli dgram %lli bytes down\n",
-               p2tp::Complete(file), p2tp::Size(file), p2tp::SeqComplete(file),
+               swift::Complete(file), swift::Size(file), swift::SeqComplete(file),
                Datagram::dgrams_up, Datagram::bytes_up,
                Datagram::dgrams_down, Datagram::bytes_down );
     }
 
-    bool complete = p2tp::IsComplete(file);
+    bool complete = swift::IsComplete(file);
 
-       p2tp::Close(file);
+       swift::Close(file);
 
-       p2tp::Shutdown();
+       swift::Shutdown();
 
     return !complete;
 }
index 629f7d4bd241fdfd561eebf90e2ea3a7a5365ed0..9f78fa6598f4f7a14d6fbdaf69f890252e6f3c62 100644 (file)
@@ -6,10 +6,10 @@
  *  Copyright 2009 Delft University of Technology. All rights reserved.
  *
  */
-#include "p2tp.h"
+#include "swift.h"
 
 
-using namespace p2tp;
+using namespace swift;
 
 
 /** P2TP seeder. Params: filename, own ip/port, tracker ip/port */
@@ -20,13 +20,13 @@ int main (int argn, char** args) {
         return -1;
     }
 
-    p2tp::LibraryInit();
+    swift::LibraryInit();
 
     char* filename = args[1];
 
     if (argn>=4) {
         Address tracker(args[3]);
-        p2tp::SetTracker(tracker);
+        swift::SetTracker(tracker);
     }
     Address bindaddr(args[2]);
 
@@ -35,22 +35,22 @@ int main (int argn, char** args) {
         return -2;
     }
 
-    assert(0<p2tp::Listen(bindaddr));
+    assert(0<swift::Listen(bindaddr));
     printf("seeder bound to %s\n",bindaddr.str());
 
 
-       int file = p2tp::Open(filename);
+       int file = swift::Open(filename);
     printf("seeding %s %s\n",filename,RootMerkleHash(file).hex().c_str());
 
     while (true) {
-           p2tp::Loop(TINT_SEC*60);
+           swift::Loop(TINT_SEC*60);
         printf("%lli dgram %lli bytes up, %lli dgram %lli bytes down\n",
                Datagram::dgrams_up, Datagram::bytes_up,
                Datagram::dgrams_down, Datagram::bytes_down );
     }
 
-       p2tp::Close(file);
+       swift::Close(file);
 
-       p2tp::Shutdown();
+       swift::Shutdown();
 
 }
index 10d772818a924a1302fed972f7a39b0d14346447..2850be1528f5243cb073feaa0856bbf42839a5cd 100644 (file)
@@ -1,12 +1,12 @@
 /*
  *  leecher.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Victor Grishchenko on 11/3/09.
  *  Copyright 2009 Delft University of Technology. All rights reserved.
  *
  */
-#include "p2tp.h"
+#include "swift.h"
 #include <time.h>
 #include <string>
 #include "compat/util.h"
@@ -15,7 +15,7 @@
 #endif
 
 
-using namespace p2tp;
+using namespace swift;
 
 
 /** P2TP downloader. Params: root hash, filename, tracker ip/port, own ip/port */
@@ -23,7 +23,7 @@ int main (int argn, char** args) {
     THIS IS NOT TRIAL BRANCH
     srand(time(NULL));
     Sha1Hash root_hash(true,"32e5d9d2d8c0f6073e2820cf47b15b58c2e42a23");
-    p2tp::LibraryInit();
+    swift::LibraryInit();
 
     // Arno: use tempdir
     std::string tmpdir = gettmpdir();
@@ -37,27 +37,27 @@ int main (int argn, char** args) {
             bindaddr((uint32_t)INADDR_ANY,10000),
             fallback("victor2.p2p-next.org:12345");
 
-    if (0>p2tp::Listen(bindaddr)) {
+    if (0>swift::Listen(bindaddr)) {
         print_error("cannot bind");
         return 1;
     }
-       p2tp::SetTracker(tracker);
-       int file = p2tp::Open(filename,root_hash);
+       swift::SetTracker(tracker);
+       int file = swift::Open(filename,root_hash);
     printf("Downloading %s\n",root_hash.hex().c_str());
     int count = 400;
-    while (!p2tp::IsComplete(file) && count-->0) {
-           p2tp::Loop(TINT_SEC/10);
+    while (!swift::IsComplete(file) && count-->0) {
+           swift::Loop(TINT_SEC/10);
         if (count==100) 
             FileTransfer::file(file)->OnPexIn(fallback);
         printf("done %lli of %lli (seq %lli) %lli dgram %lli bytes up, %lli dgram %lli bytes down\n",
-               p2tp::Complete(file), p2tp::Size(file), p2tp::SeqComplete(file),
+               swift::Complete(file), swift::Size(file), swift::SeqComplete(file),
                Datagram::dgrams_up, Datagram::bytes_up,
                Datagram::dgrams_down, Datagram::bytes_down );
     }
-    int ret = !p2tp::IsComplete(file);
+    int ret = !swift::IsComplete(file);
 
-       p2tp::Close(file);
-       p2tp::Shutdown();
+       swift::Close(file);
+       swift::Shutdown();
 
     return ret;
 
index 5bc19bd308d8f9879c7d45bc96623e0de8ba10de..090911a1d7620605470908e7ed4016fce0839046 100644 (file)
@@ -1,15 +1,15 @@
 /*
  *  ledbat_controller.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Victor Grishchenko on 10/6/09.
  *  Copyright 2009 Delft University of Technology. All rights reserved.
  *
  */
 
-#include "p2tp.h"
+#include "swift.h"
 
-using namespace p2tp;
+using namespace swift;
 
 class LedbatController : public CongestionController {
 public:
index aeff70ce3b91ddfc33f0b75b2e891755c64b1271..dfa5b1b0fee27a403be86f9365ee99ae6202c8be 100644 (file)
@@ -1,12 +1,12 @@
 /*
  *  mmap_storer.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Victor Grishchenko on 10/7/09.
  *  Copyright 2009 Delft University of Technology. All rights reserved.
  *
  */
-#include "p2tp.h"
+#include "swift.h"
 
 class MMappedStorer : public DataStorer {
 public:
index 3132236a57644763fd2fa4e3192ce05495a74b8b..dfaa20b6931606de7a83422228df8ac2c6948982 100644 (file)
@@ -1,16 +1,19 @@
 /*
  *  seq_picker.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Victor Grishchenko on 10/6/09.
  *  Copyright 2009 Delft University of Technology. All rights reserved.
  *
  */
 
-#include "p2tp.h"
+#include "swift.h"
 
-using namespace p2tp;
+using namespace swift;
 
+
+/** Picks pieces nearly sequentialy; some local randomization (twisting)
+    is introduced to prevent synchronization among multiple channels. */
 class SeqPiecePicker : public PiecePicker {
     
     binmap_t            ack_hint_out_;
@@ -41,7 +44,7 @@ public:
         if (!file().size()) {
             return bin64_t(0,0); // whoever sends it first
         }
-    retry:
+    retry:      // bite me
         twist_ &= (file().peak(0)) & ((1<<6)-1);
         if (twist_) {
             offer.twist(twist_);
index 2396b1159d7582d93d6a28f2e1e65c59701abd19..3b51e98adc33d5c747fe7d53abf299d81516091c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  simple_selector.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Victor Grishchenko on 10/6/09.
  *  Copyright 2009 Delft University of Technology. All rights reserved.
@@ -8,9 +8,9 @@
  */
 
 #include <queue>
-#include "p2tp.h"
+#include "swift.h"
 
-using namespace p2tp;
+using namespace swift;
 
 class SimpleSelector : public PeerSelector {
     typedef std::pair<Address,Sha1Hash> memo_t;
index 47213e7a3d4906afefd54e99bef015c28c49c1c0..538d05dc6348122c4910d4a33143812cb0ee439f 100644 (file)
@@ -22,7 +22,7 @@
 #endif
 
 
-using namespace p2tp;
+using namespace swift;
 
 #define HASHSZ 20
 const size_t Sha1Hash::SIZE = HASHSZ;
index 7878bf1d0531b31c9e457b748cbab4fb3da3026b..e31d8a4ec57e45111f72c8cf58320fb2dec1c7d5 100644 (file)
@@ -13,7 +13,7 @@
 #include <string.h>
 #include <string>
 
-namespace p2tp {
+namespace swift {
 
 
 /** SHA-1 hash, 20 bytes of data */
index 30e04615a4b9fc0ffdd8ea49fd1c924e0af0712f..b61d969fec4642432bb879b7d3fa279387791663 100755 (executable)
@@ -5,7 +5,13 @@
 # docmd.sh); all failed executions are
 # put to the FAILURES file
 rm -f FAILURES
-for srv in `cat servers.txt`; do
+
+if [ -z "$SERVERS" ]; then
+    SERVERS="das2.txt"
+fi
+HOSTS=`cat $SERVERS | awk '{print $2}'`
+
+for srv in $HOSTS; do
     ( for cmd in $@; do
         if ! ./docmd.sh $srv $cmd; then
             echo $srv >> FAILURES
index 4e504dd92a957ae96b7e7358b5a0481a2d6192d1..11b91104617ea41b6729de402e3cc1152e15183b 100644 (file)
@@ -7,9 +7,9 @@
  *
  */
 
-#include "p2tp.h"
+#include "swift.h"
 
-using namespace p2tp;
+using namespace swift;
 using namespace std;
 
 tint Channel::MIN_DEV = 50*TINT_MSEC;
index 72d00fcb074d9865fb410017bd518e39fa6420d0..1533ce529cccdc93b433bc68e32ace52c9154df5 100644 (file)
@@ -6,11 +6,11 @@
  *  Copyright 2009 Delft University of Technology. All rights reserved.
  *
  */
-#include "p2tp.h"
+#include "swift.h"
 #include "compat/util.h"
 
 
-using namespace p2tp;
+using namespace swift;
 using namespace std;
 
 /*
similarity index 86%
rename from p2tp.cpp
rename to swift.cpp
index 65390d9b7573fcd72157d7ef7776dd04e8a55fec..350a1fd982840f2d1555891aadd5ded877e66371 100644 (file)
--- a/p2tp.cpp
+++ b/swift.cpp
@@ -1,5 +1,5 @@
 /*
- *  p2tp.cpp
+ *  swift.cpp
  *  serp++
  *
  *  Created by Victor Grishchenko on 3/6/09.
 #include <string.h>
 
 //#include <glog/logging.h>
-#include "p2tp.h"
+#include "swift.h"
 #include "datagram.h"
 
 using namespace std;
-using namespace p2tp;
+using namespace swift;
 
-p2tp::tint Channel::last_tick = 0;
+swift::tint Channel::last_tick = 0;
 int Channel::MAX_REORDERING = 4;
 bool Channel::SELF_CONN_OK = false;
-p2tp::tint Channel::TIMEOUT = TINT_SEC*60;
+swift::tint Channel::TIMEOUT = TINT_SEC*60;
 std::vector<Channel*> Channel::channels(1);
 SOCKET Channel::sockets[8] = {0,0,0,0,0,0,0,0};
 int Channel::socket_count = 0;
@@ -70,7 +70,7 @@ Channel::~Channel () {
 }
 
 
-void     p2tp::SetTracker(const Address& tracker) {
+void     swift::SetTracker(const Address& tracker) {
     Channel::tracker = tracker;
 }
 
@@ -83,7 +83,7 @@ int Channel::EncodeID(int unscrambled) {
 }
 
 
-int     p2tp::Listen (Address addr) {
+int     swift::Listen (Address addr) {
     int sock = Datagram::Bind(addr);
     if (sock!=INVALID_SOCKET)
         Channel::sockets[Channel::socket_count++] = sock;
@@ -91,7 +91,7 @@ int     p2tp::Listen (Address addr) {
 }
 
 
-void    p2tp::Shutdown (int sock_des) {
+void    swift::Shutdown (int sock_des) {
     for(int i=0; i<Channel::socket_count; i++)
         if (sock_des==-1 || Channel::sockets[i]==sock_des) {
             Datagram::Close(Channel::sockets[i]);
@@ -100,12 +100,12 @@ void    p2tp::Shutdown (int sock_des) {
 }
 
 
-void    p2tp::Loop (tint till) {
+void    swift::Loop (tint till) {
     Channel::Loop(till);
 }
 
 
-int      p2tp::Open (const char* filename, const Sha1Hash& hash) {
+int      swift::Open (const char* filename, const Sha1Hash& hash) {
     FileTransfer* ft = new FileTransfer(filename, hash);
     int fdes = ft->file().file_descriptor();
     if (fdes>0) {
@@ -126,19 +126,19 @@ int      p2tp::Open (const char* filename, const Sha1Hash& hash) {
 }
 
 
-void    p2tp::Close (int fd) {
+void    swift::Close (int fd) {
     // FIXME delete all channels
     if (fd>FileTransfer::files.size() && FileTransfer::files[fd])
         delete FileTransfer::files[fd];
 }
 
 
-void    p2tp::AddPeer (Address address, const Sha1Hash& root) {
+void    swift::AddPeer (Address address, const Sha1Hash& root) {
     Channel::peer_selector->AddPeer(address,root);
 }
 
 
-uint64_t  p2tp::Size (int fdes) {
+uint64_t  swift::Size (int fdes) {
     if (FileTransfer::files.size()>fdes && FileTransfer::files[fdes])
         return FileTransfer::files[fdes]->file().size();
     else
@@ -146,7 +146,7 @@ uint64_t  p2tp::Size (int fdes) {
 }
 
 
-bool  p2tp::IsComplete (int fdes) {
+bool  swift::IsComplete (int fdes) {
     if (FileTransfer::files.size()>fdes && FileTransfer::files[fdes])
         return FileTransfer::files[fdes]->file().is_complete();
     else
@@ -154,7 +154,7 @@ bool  p2tp::IsComplete (int fdes) {
 }
 
 
-uint64_t  p2tp::Complete (int fdes) {
+uint64_t  swift::Complete (int fdes) {
     if (FileTransfer::files.size()>fdes && FileTransfer::files[fdes])
         return FileTransfer::files[fdes]->file().complete();
     else
@@ -162,7 +162,7 @@ uint64_t  p2tp::Complete (int fdes) {
 }
 
 
-uint64_t  p2tp::SeqComplete (int fdes) {
+uint64_t  swift::SeqComplete (int fdes) {
     if (FileTransfer::files.size()>fdes && FileTransfer::files[fdes])
         return FileTransfer::files[fdes]->file().seq_complete();
     else
@@ -170,7 +170,7 @@ uint64_t  p2tp::SeqComplete (int fdes) {
 }
 
 
-const Sha1Hash& p2tp::RootMerkleHash (int file) {
+const Sha1Hash& swift::RootMerkleHash (int file) {
     FileTransfer* trans = FileTransfer::file(file);
     if (!trans)
         return Sha1Hash::ZERO;
diff --git a/p2tp.h b/swift.h
similarity index 99%
rename from p2tp.h
rename to swift.h
index f372998f7f2eacfbb6db707f7332198bb48d1cda..8c65dd32931af2397e578dc4e061f7c075b206b9 100644 (file)
--- a/p2tp.h
+++ b/swift.h
@@ -1,5 +1,5 @@
 /*
- *  p2tp.h
+ *  swift.h
  *  the main header file for libswift, normally you should only read this one
  *
  *  Created by Victor Grishchenko on 3/6/09.
@@ -63,7 +63,7 @@ Messages
 #include "datagram.h"
 #include "hashtree.h"
 
-namespace p2tp {
+namespace swift {
 
     #define NOW Datagram::now
     
index 580a3736e0ab3db88fc86a37abfe39849b6697c5..40a7ae5bfd3972aaf6b5df25ae9f7ff544e2ea73 100644 (file)
@@ -9,11 +9,11 @@
 
 #include <gtest/gtest.h>
 //#include <glog/logging.h>
-#include "p2tp.h"
+#include "swift.h"
 #include <time.h>
 
 
-using namespace p2tp;
+using namespace swift;
 
 
 TEST(P2TP,CwndTest) {
@@ -26,35 +26,35 @@ TEST(P2TP,CwndTest) {
     int size = st.st_size;//, sizek = (st.st_size>>10) + (st.st_size%1024?1:0) ;
     Channel::SELF_CONN_OK = true;
 
-    int sock1 = p2tp::Listen(7001);
+    int sock1 = swift::Listen(7001);
        ASSERT_TRUE(sock1>=0);
 
-       int file = p2tp::Open("doc/sofi.jpg");
+       int file = swift::Open("doc/sofi.jpg");
     FileTransfer* fileobj = FileTransfer::file(file);
     //FileTransfer::instance++;
 
-    p2tp::SetTracker(Address("127.0.0.1",7001));
+    swift::SetTracker(Address("127.0.0.1",7001));
 
-       int copy = p2tp::Open("doc/sofi-copy.jpg",fileobj->root_hash());
+       int copy = swift::Open("doc/sofi-copy.jpg",fileobj->root_hash());
 
-       p2tp::Loop(TINT_SEC);
+       swift::Loop(TINT_SEC);
 
     int count = 0;
-    while (p2tp::SeqComplete(copy)!=size && count++<600)
-        p2tp::Loop(TINT_SEC);
-    ASSERT_EQ(size,p2tp::SeqComplete(copy));
+    while (swift::SeqComplete(copy)!=size && count++<600)
+        swift::Loop(TINT_SEC);
+    ASSERT_EQ(size,swift::SeqComplete(copy));
 
-       p2tp::Close(file);
-       p2tp::Close(copy);
+       swift::Close(file);
+       swift::Close(copy);
 
-       p2tp::Shutdown(sock1);
+       swift::Shutdown(sock1);
 
 }
 
 
 int main (int argc, char** argv) {
 
-       p2tp::LibraryInit();
+       swift::LibraryInit();
        testing::InitGoogleTest(&argc, argv);
        int ret = RUN_ALL_TESTS();
        return ret;
index 8ad68bfdc8e26e824c4f11e492661a13bef486fc..eb7443c44b3650d4728a83d1b4406eb87f7b43e4 100644 (file)
@@ -9,9 +9,9 @@
 #include <gtest/gtest.h>
 //#include <glog/logging.h>
 #include "datagram.h"
-#include "p2tp.h" // Arno: for LibraryInit
+#include "swift.h" // Arno: for LibraryInit
 
-using namespace p2tp;
+using namespace swift;
 
 TEST(Datagram, AddressTest) {
     Address addr("127.0.0.1:1000");
@@ -103,7 +103,7 @@ TEST(Datagram,TwoPortTest) {
 
 int main (int argc, char** argv) {
 
-       p2tp::LibraryInit();
+       swift::LibraryInit();
 
        testing::InitGoogleTest(&argc, argv);
        return RUN_ALL_TESTS();
index d988fb1c81acedd69b922cc03246534b1a1ad9ad..db4ac832ad1b00b7fbe306f216ccfcc083a93124 100644 (file)
@@ -11,7 +11,7 @@
 #include <gtest/gtest.h>
 #include "hashtree.h"
 
-using namespace p2tp;
+using namespace swift;
 
 char hash123[] = "a8fdc205a9f19cc1c7507a60c4f01b13d11d7fd0";
 char rooth123[] = "d0bdb8ba28076d84d2b3a0e62521b998e42349a1";
index 55af714a323dc8efbaf8506f84938e334ba97264..29d00ce497aea20945f9e045fe577469bfc7ecef 100644 (file)
@@ -3,10 +3,10 @@
 #include <vector>
 #include <deque>
 #include "datagram.h"
-#include "p2tp.h"
+#include "swift.h"
 #include <gtest/gtest.h>
 
-using namespace p2tp;
+using namespace swift;
 using namespace std;
 
 /**
@@ -169,7 +169,7 @@ TEST(Datagram,LedbatTest) {
 int main (int argc, char** argv) {
     printf("Warning: use the script to set up dummynet!\n");
 
-    p2tp::LibraryInit();
+    swift::LibraryInit();
     testing::InitGoogleTest(&argc, argv);
     return RUN_ALL_TESTS();
 
index fbd0e47070d9c37b7754e70130b9aeb48931d2e3..36a92a235896fd8a761946cbcee917e1fe01543f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  transfertest.cpp
- *  p2tp
+ *  swift
  *
  *  Created by Victor Grishchenko on 10/7/09.
  *  Copyright 2009 Delft University of Technology. All rights reserved.
@@ -8,11 +8,11 @@
  */
 //#include <gtest/gtest.h>
 //#include <glog/logging.h>
-#include "p2tp.h"
+#include "swift.h"
 #include "compat.h"
 #include <gtest/gtest.h>
 
-using namespace p2tp;
+using namespace swift;
 
 const char* BTF = "test_file";
 
index 08205ee0be2bb91beade3e16ebb7294fd072ed28..70c7a0e2bf074cdfd72346441e33b2e9ed0e67e4 100644 (file)
 #include <errno.h>
 #include <string>
 #include <sstream>
-#include "p2tp.h"
+#include "swift.h"
 #include "compat/util.h"
 
 #include "ext/seq_picker.cpp" // FIXME FIXME FIXME FIXME 
 
-using namespace p2tp;
+using namespace swift;
 
 std::vector<FileTransfer*> FileTransfer::files(20);