Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit 532d7fc3eb861e756691b4850601fb62216a3f98 @allisonheath allisonheath committed Oct 2, 2012
Showing with 22,653 additions and 0 deletions.
  1. +20 −0 .gitignore
  2. +13 −0 LICENSE.txt
  3. +7 −0 Makefile
  4. +40 −0 README.txt
  5. +65 −0 src/Makefile
  6. +118 −0 src/cc.h
  7. +80 −0 src/crypto.h
  8. +461 −0 src/udr.cpp
  9. +24 −0 src/udr.h
  10. +473 −0 src/udr_threads.cpp
  11. +41 −0 src/udr_threads.h
  12. +32 −0 udt/LICENSE.txt
  13. +7 −0 udt/Makefile
  14. +42 −0 udt/README.txt
  15. +32 −0 udt/RELEASE_NOTES.txt
  16. +63 −0 udt/app/Makefile
  17. BIN udt/app/appclient
  18. +174 −0 udt/app/appclient.cpp
  19. BIN udt/app/appserver
  20. +155 −0 udt/app/appserver.cpp
  21. +100 −0 udt/app/cc.h
  22. BIN udt/app/recvfile
  23. +101 −0 udt/app/recvfile.cpp
  24. BIN udt/app/sendfile
  25. +170 −0 udt/app/sendfile.cpp
  26. BIN udt/app/test
  27. +738 −0 udt/app/test.cpp
  28. +79 −0 udt/doc/doc/accept.htm
  29. +88 −0 udt/doc/doc/bind.htm
  30. +122 −0 udt/doc/doc/ccc.htm
  31. +34 −0 udt/doc/doc/cleanup.htm
  32. +55 −0 udt/doc/doc/close.htm
  33. +86 −0 udt/doc/doc/connect.htm
  34. +38 −0 udt/doc/doc/copy.htm
  35. +195 −0 udt/doc/doc/ecode.htm
  36. +106 −0 udt/doc/doc/epoll.htm
  37. +35 −0 udt/doc/doc/error.htm
  38. +14 −0 udt/doc/doc/footer.htm
  39. +117 −0 udt/doc/doc/function.htm
  40. +11 −0 udt/doc/doc/header.htm
  41. +36 −0 udt/doc/doc/intro.htm
  42. +69 −0 udt/doc/doc/listen.htm
  43. +53 −0 udt/doc/doc/make.htm
  44. +224 −0 udt/doc/doc/opt.htm
  45. +67 −0 udt/doc/doc/peername.htm
  46. +84 −0 udt/doc/doc/recv.htm
  47. +81 −0 udt/doc/doc/recvfile.htm
  48. +83 −0 udt/doc/doc/recvmsg.htm
  49. +21 −0 udt/doc/doc/reference.htm
  50. +111 −0 udt/doc/doc/select.htm
  51. +73 −0 udt/doc/doc/selectex.htm
  52. +89 −0 udt/doc/doc/send.htm
  53. +89 −0 udt/doc/doc/sendfile.htm
  54. +101 −0 udt/doc/doc/sendmsg.htm
  55. +59 −0 udt/doc/doc/socket.htm
  56. +69 −0 udt/doc/doc/sockname.htm
  57. +34 −0 udt/doc/doc/startup.htm
  58. +239 −0 udt/doc/doc/structure.htm
  59. +91 −0 udt/doc/doc/t-cc.htm
  60. +65 −0 udt/doc/doc/t-config.htm
  61. +59 −0 udt/doc/doc/t-data.htm
  62. +48 −0 udt/doc/doc/t-error.htm
  63. +55 −0 udt/doc/doc/t-file.htm
  64. +37 −0 udt/doc/doc/t-firewall.htm
  65. +122 −0 udt/doc/doc/t-hello.htm
  66. +57 −0 udt/doc/doc/t-intro.htm
  67. +41 −0 udt/doc/doc/t-msg.htm
  68. +34 −0 udt/doc/doc/t-udt3.htm
  69. +63 −0 udt/doc/doc/trace.htm
  70. +8 −0 udt/doc/doc/treeview.css
  71. +31 −0 udt/doc/doc/tutorial.htm
  72. +51 −0 udt/doc/doc/udtdoc.css
  73. BIN udt/doc/hlp/ix_book.gif
  74. BIN udt/doc/hlp/ix_down.gif
  75. BIN udt/doc/hlp/ix_end.gif
  76. BIN udt/doc/hlp/ix_endm.gif
  77. BIN udt/doc/hlp/ix_endp.gif
  78. BIN udt/doc/hlp/ix_leaf.gif
  79. BIN udt/doc/hlp/ix_line.gif
  80. BIN udt/doc/hlp/ix_link.gif
  81. BIN udt/doc/hlp/ix_list.gif
  82. BIN udt/doc/hlp/ix_listm.gif
  83. BIN udt/doc/hlp/ix_listp.gif
  84. BIN udt/doc/hlp/ix_open.gif
  85. BIN udt/doc/hlp/ix_space.gif
  86. BIN udt/doc/hlp/ix_up.gif
  87. +72 −0 udt/doc/index.htm
  88. +416 −0 udt/doc/main.htm
  89. +58 −0 udt/src/Makefile
  90. +2,313 −0 udt/src/api.cpp
  91. +265 −0 udt/src/api.h
  92. +652 −0 udt/src/buffer.cpp
  93. +275 −0 udt/src/buffer.h
  94. +123 −0 udt/src/cache.cpp
  95. +293 −0 udt/src/cache.h
  96. +320 −0 udt/src/ccc.cpp
  97. +278 −0 udt/src/ccc.h
  98. +346 −0 udt/src/channel.cpp
  99. +171 −0 udt/src/channel.h
  100. +749 −0 udt/src/common.cpp
  101. +316 −0 udt/src/common.h
  102. +2,672 −0 udt/src/core.cpp
  103. +456 −0 udt/src/core.h
  104. +421 −0 udt/src/epoll.cpp
  105. +199 −0 udt/src/epoll.h
  106. +703 −0 udt/src/list.cpp
  107. +202 −0 udt/src/list.h
  108. +381 −0 udt/src/md5.cpp
  109. +91 −0 udt/src/md5.h
  110. +411 −0 udt/src/packet.cpp
  111. +223 −0 udt/src/packet.h
  112. +1,253 −0 udt/src/queue.cpp
  113. +527 −0 udt/src/queue.h
  114. +338 −0 udt/src/udt
  115. +338 −0 udt/src/udt.h
  116. +286 −0 udt/src/window.cpp
  117. +187 −0 udt/src/window.h
  118. +154 −0 udt/win/appclient.vcproj
  119. +154 −0 udt/win/appserver.vcproj
  120. +147 −0 udt/win/recvfile.vcproj
  121. +148 −0 udt/win/sendfile.vcproj
  122. +145 −0 udt/win/test.vcproj
  123. +65 −0 udt/win/udt.sln
  124. +225 −0 udt/win/udt.vcproj
@@ -0,0 +1,20 @@
+# Compiled Object files
+*.slo
+*.lo
+*.o
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+
+# The UDR binary and other files
+src/udr
+src/.udr_key
+
+# Emacs files
+*~
@@ -0,0 +1,13 @@
+Copyright 2012 Laboratory for Advanced Computing at the University of Chicago
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
@@ -0,0 +1,7 @@
+DIRS = udt src
+TARGETS = all clean
+
+$(TARGETS): %: $(patsubst %, %.%, $(DIRS))
+
+$(foreach TGT, $(TARGETS), $(patsubst %, %.$(TGT), $(DIRS))):
+ $(MAKE) -C $(subst ., , $@)
@@ -0,0 +1,40 @@
+UDR - trial beta version 0.1b - please do not distribute.
+
+UDR is a wrapper around UDT that can be used with rsync.
+
+CONTENT:
+./src: UDR source code
+./udt: UDT source code, documentation and license
+
+DEPENDENCIES:
+OpenSSL (libssl and libcrypto)
+
+TO MAKE:
+ make -e os=XXX arch=YYY
+
+XXX: [LINUX(default), BSD, OSX]
+YYY: [IA32(default), POWERPC, IA64, AMD64]
+
+TO USE:
+UDR must be on the client and server machines that data will be transferred between. UDR uses ssh to do authentication and automatically start the server-side UDR process. Encryption is on by default, using the OpenSSL implementation of blowfish. Currently, encryption appears to reduce the speed by about half, this should be improved in future versions.
+
+Basic usage:
+udr [udr options] rsync [rsync options] src dest
+
+UDR options:
+[-v] verbose mode, typically for debugging purposes
+[-p starting port number] default is 9000
+[-q ending port number] default is 9100
+[-n] turns off encryption
+[-c remote udr location] by default udr assumes that udr is in your path on the remote system, here you can specify the location explicitly
+
+The rsync [rsync options] should take any of the standard rsync options.
+
+An example command:
+ ./udr -c /home/aheath/projects/udr/src/udr rsync -av --stats --progress /home/aheath/tmp/ 192.168.1.102:/home/aheath/tmp2
+
+Notes:
+After the rsync data transfer is complete, the local udr thread is shutdown by a signal. Rsync thinks this is abnormal and prints out the error "rsync error: sibling process terminated abnormally", which can be ignored. However, the transfer should be complete, if other rsync errors appear these are true errors.
+
+
+
@@ -0,0 +1,65 @@
+C++ = g++
+
+ifndef os
+ os = LINUX
+endif
+
+ifndef arch
+ arch = IA32
+endif
+
+CCFLAGS = -Wall -D$(os) -I../udt/src -finline-functions -g
+
+ifeq ($(arch), IA32)
+ CCFLAGS += -DIA32 #-mcpu=pentiumpro -march=pentiumpro -mmmx -msse
+endif
+
+ifeq ($(arch), POWERPC)
+ CCFLAGS += -mcpu=powerpc
+endif
+
+ifeq ($(arch), IA64)
+ CCFLAGS += -DIA64
+endif
+
+ifeq ($(arch), SPARC)
+ CCFLAGS += -DSPARC
+endif
+
+LDFLAGS = -L../src ../udt/src/libudt.a -lstdc++ -lpthread -lm -lssl -lcrypto
+
+ifeq ($(os), UNIX)
+ LDFLAGS += -lsocket
+endif
+
+ifeq ($(os), SUNOS)
+ LDFLAGS += -lrt -lsocket
+endif
+
+DIR = $(shell pwd)
+
+APP = udr #test
+
+all: $(APP)
+
+%.o: %.cpp
+ $(C++) $(CCFLAGS) $< -c
+udr: udr.o udr_threads.o
+ $(C++) $^ -o $@ $(LDFLAGS)
+
+threads_test: threads_test.o
+ $(C++) $^ -o $@ $(LDFLAGS)
+
+sig_test: sig_test.o
+ $(C++) $^ -o $@ $(LDFLAGS)
+
+sig_test2: sig_test2.o
+ $(C++) $^ -o $@ $(LDFLAGS)
+#test: test.o
+# $(C++) $^ -o $@ $(LDFLAGS)
+
+clean:
+ rm -f *.o $(APP)
+
+install:
+ export PATH=$(DIR):$$PATH
118 src/cc.h
@@ -0,0 +1,118 @@
+/*****************************************************************************
+Copyright 2012 Laboratory for Advanced Computing at the University of Chicago
+
+This file is part of UDR.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions
+and limitations under the License.
+*****************************************************************************/
+
+#include <udt.h>
+#include <ccc.h>
+
+class CTCP: public CCC
+{
+public:
+ void init()
+ {
+ m_bSlowStart = true;
+ m_issthresh = 83333;
+
+ m_dPktSndPeriod = 0.0;
+ m_dCWndSize = 2.0;
+
+ setACKInterval(2);
+ setRTO(1000000);
+ }
+
+ virtual void onACK(const int& ack)
+ {
+ if (ack == m_iLastACK)
+ {
+ if (3 == ++ m_iDupACKCount)
+ DupACKAction();
+ else if (m_iDupACKCount > 3)
+ m_dCWndSize += 1.0;
+ else
+ ACKAction();
+ }
+ else
+ {
+ if (m_iDupACKCount >= 3)
+ m_dCWndSize = m_issthresh;
+
+ m_iLastACK = ack;
+ m_iDupACKCount = 1;
+
+ ACKAction();
+ }
+ }
+
+ virtual void onTimeout()
+ {
+ m_issthresh = getPerfInfo()->pktFlightSize / 2;
+ if (m_issthresh < 2)
+ m_issthresh = 2;
+
+ m_bSlowStart = true;
+ m_dCWndSize = 2.0;
+ }
+
+protected:
+ virtual void ACKAction()
+ {
+ if (m_bSlowStart)
+ {
+ m_dCWndSize += 1.0;
+
+ if (m_dCWndSize >= m_issthresh)
+ m_bSlowStart = false;
+ }
+ else
+ m_dCWndSize += 1.0/m_dCWndSize;
+ }
+
+ virtual void DupACKAction()
+ {
+ m_bSlowStart = false;
+
+ m_issthresh = getPerfInfo()->pktFlightSize / 2;
+ if (m_issthresh < 2)
+ m_issthresh = 2;
+
+ m_dCWndSize = m_issthresh + 3;
+ }
+
+protected:
+ int m_issthresh;
+ bool m_bSlowStart;
+
+ int m_iDupACKCount;
+ int m_iLastACK;
+};
+
+
+class CUDPBlast: public CCC
+{
+public:
+ CUDPBlast()
+ {
+ m_dPktSndPeriod = 1000000;
+ m_dCWndSize = 83333.0;
+ }
+
+public:
+ void setRate(double mbps)
+ {
+ m_dPktSndPeriod = (m_iMSS * 8.0) / mbps;
+ }
+};
@@ -0,0 +1,80 @@
+/*****************************************************************************
+Copyright 2012 Laboratory for Advanced Computing at the University of Chicago
+
+This file is part of UDR.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions
+and limitations under the License.
+*****************************************************************************/
+#ifndef CRYPTO_H
+#define CRYPTO_H
+
+#define PASSPHRASE_SIZE 32
+#define HEX_PASSPHRASE_SIZE 64
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <openssl/blowfish.h>
+#include <openssl/rand.h>
+#include <limits.h>
+#include <iostream>
+
+using namespace std;
+
+class crypto
+{
+private:
+ BF_KEY key;
+ unsigned char ivec[ 1024 ];
+ int direction;
+ int num;
+
+char *getPassphrase(char *filename)
+{
+ char *pp = new char[ HEX_PASSPHRASE_SIZE ];
+ FILE *in = fopen( filename , "r" );
+ if ( in == NULL )
+ {
+ //should do something here
+ }
+ fgets( pp , HEX_PASSPHRASE_SIZE , in );
+ return pp;
+}
+
+void free_key( char *key )
+{
+ memset( key , 0 , HEX_PASSPHRASE_SIZE );
+ delete [] key;
+}
+
+public:
+
+ crypto( int direc, int len, unsigned char* password)
+ {
+ BF_set_key( &key , len , (unsigned char *) password );
+ //free_key( password );
+
+ memset( ivec , 0 , 1024 );
+ num = 0;
+ direction = direc;
+ }
+
+ void encrypt( char *in , char *out , int len )
+ {
+ //memcpy( out , in , len );
+ BF_cfb64_encrypt( (unsigned char *) in, (unsigned char *) out, len , &key , ivec , &num , direction );
+ }
+
+};
+
+#endif
Oops, something went wrong.

0 comments on commit 532d7fc

Please sign in to comment.