From 5d3052712305d80db8eb0979371d348ba4c05763 Mon Sep 17 00:00:00 2001 From: Victor Grishchenko Date: Wed, 27 Jan 2010 19:51:20 +0100 Subject: [PATCH] The rest of the renaming. --- compat.h | 4 ++-- datagram.cpp | 2 +- exec/leecher.cpp | 2 +- exec/seeder.cpp | 2 +- exec/trial.cpp | 2 +- hashtree.h | 4 ++-- sendrecv.cpp | 38 +++++++++++++++++++------------------- swift.cpp | 2 +- swift.h | 30 ++++++++++++++++-------------- tests/connecttest.cpp | 2 +- 10 files changed, 45 insertions(+), 43 deletions(-) diff --git a/compat.h b/compat.h index ffd1378..67a0125 100644 --- a/compat.h +++ b/compat.h @@ -6,8 +6,8 @@ * Copyright 2009 Delft University of Technology. All rights reserved. * */ -#ifndef P2TP_COMPAT_H -#define P2TP_COMPAT_H +#ifndef SWIFT_COMPAT_H +#define SWIFT_COMPAT_H #ifdef _MSC_VER #include "compat/stdint.h" diff --git a/datagram.cpp b/datagram.cpp index 93124e0..116b495 100644 --- a/datagram.cpp +++ b/datagram.cpp @@ -215,7 +215,7 @@ std::string sock2str (struct sockaddr_in addr) { } /* -std::string Datagram::to_string () const { // TODO: pretty-print P2TP +std::string Datagram::to_string () const { // TODO: pretty-print swift std::string addrs = sock2str(addr); char hex[MAXDGRAMSZ*2]; for(int i=offset; i diff --git a/sendrecv.cpp b/sendrecv.cpp index 1533ce5..5312869 100644 --- a/sendrecv.cpp +++ b/sendrecv.cpp @@ -22,7 +22,7 @@ using namespace std; void Channel::AddPeakHashes (Datagram& dgram) { for(int i=0; ipeer(); - dgram.Push8(P2TP_PEX_ADD); + dgram.Push8(SWIFT_PEX_ADD); dgram.Push32(a.ipv4()); dgram.Push16(a.port()); dprintf("%s #%u +pex %s\n",tintstr(),id_,a.str()); @@ -495,7 +495,7 @@ Channel* Channel::RecvDatagram (int socket) { if (data.size()<1+4+1+4+Sha1Hash::SIZE) return_log ("incorrect size %i initial handshake packet %s\n",data.size(),addr.str()); uint8_t hashid = data.Pull8(); - if (hashid!=P2TP_HASH) + if (hashid!=SWIFT_HASH) return_log ("no hash in the initial handshake %s\n",addr.str()); bin64_t pos = data.Pull32(); if (pos!=bin64_t::ALL) diff --git a/swift.cpp b/swift.cpp index 350a1fd..6d432c5 100644 --- a/swift.cpp +++ b/swift.cpp @@ -178,7 +178,7 @@ const Sha1Hash& swift::RootMerkleHash (int file) { } -/**

P2TP handshake

+/**

swift handshake

Basic rules:
  • to send a datagram, a channel must be created diff --git a/swift.h b/swift.h index 0dc3240..d6d14ae 100644 --- a/swift.h +++ b/swift.h @@ -8,7 +8,7 @@ */ /* -The P2TP protocol +The swift protocol Messages @@ -46,8 +46,8 @@ Messages in the case with swarm supervisors). */ -#ifndef P2TP_H -#define P2TP_H +#ifndef SWIFT_H +#define SWIFT_H #ifdef _MSC_VER #include "compat/stdint.h" @@ -112,16 +112,18 @@ namespace swift { /** swift protocol message types; these are used on the wire. */ typedef enum { - P2TP_HANDSHAKE = 0, - P2TP_DATA = 1, - P2TP_ACK = 2, - P2TP_TS = 8, - P2TP_HINT = 3, - P2TP_HASH = 4, - P2TP_PEX_ADD = 5, - P2TP_PEX_RM = 6, - P2TP_SIGNED_HASH = 7, - P2TP_MESSAGE_COUNT = 8 + SWIFT_HANDSHAKE = 0, + SWIFT_DATA = 1, + SWIFT_ACK = 2, + SWIFT_TS = 8, + SWIFT_HINT = 3, + SWIFT_HASH = 4, + SWIFT_PEX_ADD = 5, + SWIFT_PEX_RM = 6, + SWIFT_SIGNED_HASH = 7, + SWIFT_MSGTYPE_SENT = 8, + SWIFT_MSGTYPE_RCVD = 9, + SWIFT_MESSAGE_COUNT = 10 } messageid_t; class PiecePicker; @@ -235,7 +237,7 @@ namespace swift { }; - /** P2TP channel's "control block"; channels loosely correspond to TCP + /** swift channel's "control block"; channels loosely correspond to TCP connections or FTP sessions; one channel is created for one file being transferred between two peers. As we don't need buffers and lots of other TCP stuff, sizeof(Channel+members) must be below 1K. diff --git a/tests/connecttest.cpp b/tests/connecttest.cpp index 40a7ae5..e49c6c7 100644 --- a/tests/connecttest.cpp +++ b/tests/connecttest.cpp @@ -16,7 +16,7 @@ using namespace swift; -TEST(P2TP,CwndTest) { +TEST(SWIFT,CwndTest) { srand ( time(NULL) ); -- 2.20.1