From d70337a6422eb3e3aade433a0b1d936b663d5d3e Mon Sep 17 00:00:00 2001 From: drbob Date: Sun, 18 Jul 2010 16:28:51 +0000 Subject: [PATCH] First pass for windows compilation: * brought over tou_net / tou_error => bdnet for windoze compatibility. * updated udplayer to inline with rs changes + win compatibility. * removed unix only networking #includes, replaced with "util/bdnet.h" * added subdirectory to #includes. * made udpbitdht_nettest use a random node id. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3302 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libbitdht/src/bitdht/bdhash.cc | 4 +- libbitdht/src/bitdht/bdhash.h | 2 +- libbitdht/src/bitdht/bdiface.h | 4 +- libbitdht/src/bitdht/bdmanager.cc | 14 +- libbitdht/src/bitdht/bdmsgs.cc | 4 +- libbitdht/src/bitdht/bdmsgs.h | 6 +- libbitdht/src/bitdht/bdnode.cc | 12 +- libbitdht/src/bitdht/bdnode.h | 10 +- libbitdht/src/bitdht/bdobj.cc | 2 +- libbitdht/src/bitdht/bdpeer.cc | 7 +- libbitdht/src/bitdht/bdpeer.h | 6 +- libbitdht/src/bitdht/bdquery.cc | 7 +- libbitdht/src/bitdht/bdquery.h | 6 +- libbitdht/src/bitdht/bdstddht.cc | 9 +- libbitdht/src/bitdht/bdstddht.h | 6 +- libbitdht/src/bitdht/bdstore.cc | 7 +- libbitdht/src/bitdht/bdstore.h | 4 +- libbitdht/src/bitdht/bencode.c | 2 +- libbitdht/src/libbitdht.pro | 9 +- libbitdht/src/tests/bdboot.txt | 998 +++++++++++------------ libbitdht/src/tests/udpbitdht_nettest.cc | 6 + libbitdht/src/udp/udpbitdht.cc | 4 +- libbitdht/src/udp/udplayer.cc | 145 +++- libbitdht/src/udp/udplayer.h | 30 +- libbitdht/src/udp/udpstack.cc | 8 +- libbitdht/src/udp/udpstack.h | 7 +- libbitdht/src/util/bdnet.cc | 346 ++++++++ libbitdht/src/util/bdnet.h | 171 ++++ libbitdht/src/util/bdthreads.cc | 4 +- libbitdht/src/util/bdthreads.h | 4 +- 30 files changed, 1209 insertions(+), 635 deletions(-) create mode 100644 libbitdht/src/util/bdnet.cc create mode 100644 libbitdht/src/util/bdnet.h diff --git a/libbitdht/src/bitdht/bdhash.cc b/libbitdht/src/bitdht/bdhash.cc index 27831d4f9..831b8c5e6 100644 --- a/libbitdht/src/bitdht/bdhash.cc +++ b/libbitdht/src/bitdht/bdhash.cc @@ -24,8 +24,8 @@ */ -#include "bdhash.h" -#include "bdstddht.h" +#include "bitdht/bdhash.h" +#include "bitdht/bdstddht.h" #include bdHashEntry::bdHashEntry(std::string value, std::string secret, time_t lifetime, time_t store) diff --git a/libbitdht/src/bitdht/bdhash.h b/libbitdht/src/bitdht/bdhash.h index bc440ad8e..4bf8dcd0c 100644 --- a/libbitdht/src/bitdht/bdhash.h +++ b/libbitdht/src/bitdht/bdhash.h @@ -26,7 +26,7 @@ * */ -#include "bdpeer.h" +#include "bitdht/bdpeer.h" #include #include diff --git a/libbitdht/src/bitdht/bdiface.h b/libbitdht/src/bitdht/bdiface.h index 84f1c5787..7ee34a0b9 100644 --- a/libbitdht/src/bitdht/bdiface.h +++ b/libbitdht/src/bitdht/bdiface.h @@ -31,9 +31,7 @@ #include #include -#include -#include -#include +#include "util/bdnet.h" /* * Functions and Classes required for Interfacing with the BitDht. diff --git a/libbitdht/src/bitdht/bdmanager.cc b/libbitdht/src/bitdht/bdmanager.cc index c5ce454df..abab11e0f 100644 --- a/libbitdht/src/bitdht/bdmanager.cc +++ b/libbitdht/src/bitdht/bdmanager.cc @@ -37,19 +37,17 @@ * This is pretty specific to RS requirements. ****/ -#include "bdiface.h" -#include "bdstddht.h" -#include "bdmanager.h" -#include "bdmsgs.h" -#include "bencode.h" +#include "bitdht/bdiface.h" +#include "bitdht/bdstddht.h" +#include "bitdht/bdmanager.h" +#include "bitdht/bdmsgs.h" +#include "bitdht/bencode.h" #include #include #include -#include -#include -#include +#include "util/bdnet.h" /*** * #define DEBUG_MGR 1 diff --git a/libbitdht/src/bitdht/bdmsgs.cc b/libbitdht/src/bitdht/bdmsgs.cc index 40209b292..41c3d7bbd 100644 --- a/libbitdht/src/bitdht/bdmsgs.cc +++ b/libbitdht/src/bitdht/bdmsgs.cc @@ -25,8 +25,8 @@ #include #include -#include "bencode.h" -#include "bdmsgs.h" +#include "bitdht/bencode.h" +#include "bitdht/bdmsgs.h" int create_ping_message(); diff --git a/libbitdht/src/bitdht/bdmsgs.h b/libbitdht/src/bitdht/bdmsgs.h index c98a48a26..598a9c4a7 100644 --- a/libbitdht/src/bitdht/bdmsgs.h +++ b/libbitdht/src/bitdht/bdmsgs.h @@ -30,9 +30,9 @@ #include #include #include -#include "bencode.h" -#include "bdobj.h" -#include "bdpeer.h" +#include "bitdht/bencode.h" +#include "bitdht/bdobj.h" +#include "bitdht/bdpeer.h" #define BITDHT_MSG_TYPE_UNKNOWN 0 #define BITDHT_MSG_TYPE_PING 1 diff --git a/libbitdht/src/bitdht/bdnode.cc b/libbitdht/src/bitdht/bdnode.cc index 351a0b991..bc1fa0b13 100644 --- a/libbitdht/src/bitdht/bdnode.cc +++ b/libbitdht/src/bitdht/bdnode.cc @@ -23,10 +23,12 @@ * */ -#include "bdnode.h" +#include "bitdht/bdnode.h" -#include "bencode.h" -#include "bdmsgs.h" +#include "bitdht/bencode.h" +#include "bitdht/bdmsgs.h" + +#include "util/bdnet.h" #include #include @@ -35,10 +37,6 @@ #include #include -#include -#include -#include - #define BITDHT_QUERY_START_PEERS 10 #define BITDHT_QUERY_NEIGHBOUR_PEERS 8 diff --git a/libbitdht/src/bitdht/bdnode.h b/libbitdht/src/bitdht/bdnode.h index d241017d9..909c3ff3a 100644 --- a/libbitdht/src/bitdht/bdnode.h +++ b/libbitdht/src/bitdht/bdnode.h @@ -27,11 +27,11 @@ */ -#include "bdpeer.h" -#include "bdquery.h" -#include "bdstore.h" -#include "bdobj.h" -#include "bdhash.h" +#include "bitdht/bdpeer.h" +#include "bitdht/bdquery.h" +#include "bitdht/bdstore.h" +#include "bitdht/bdobj.h" +#include "bitdht/bdhash.h" #define BD_QUERY_NEIGHBOURS 1 diff --git a/libbitdht/src/bitdht/bdobj.cc b/libbitdht/src/bitdht/bdobj.cc index 54029f916..e4f5b51fd 100644 --- a/libbitdht/src/bitdht/bdobj.cc +++ b/libbitdht/src/bitdht/bdobj.cc @@ -1,4 +1,3 @@ -#include "bdobj.h" /* * bitdht/bdobj.cc @@ -25,6 +24,7 @@ * */ +#include "bitdht/bdobj.h" void bdPrintTransId(std::ostream &out, bdToken *transId) diff --git a/libbitdht/src/bitdht/bdpeer.cc b/libbitdht/src/bitdht/bdpeer.cc index 3cb276ee4..c8555d63e 100644 --- a/libbitdht/src/bitdht/bdpeer.cc +++ b/libbitdht/src/bitdht/bdpeer.cc @@ -24,11 +24,8 @@ */ -#include "bdpeer.h" - -#include -#include -#include +#include "bitdht/bdpeer.h" +#include "util/bdnet.h" #include #include diff --git a/libbitdht/src/bitdht/bdpeer.h b/libbitdht/src/bitdht/bdpeer.h index bbbe25260..9b8aea984 100644 --- a/libbitdht/src/bitdht/bdpeer.h +++ b/libbitdht/src/bitdht/bdpeer.h @@ -26,8 +26,7 @@ * */ - -#include "bdiface.h" +#include "bitdht/bdiface.h" /******* * These type of parameters are now DHT Function dependent @@ -52,9 +51,6 @@ #define BITDHT_MAX_SEND_PERIOD 600 // retry every 10 secs. #define BITDHT_MAX_RECV_PERIOD 1500 // out-of-date -#include -#include -#include #include #include diff --git a/libbitdht/src/bitdht/bdquery.cc b/libbitdht/src/bitdht/bdquery.cc index fa9537e2d..515a44c98 100644 --- a/libbitdht/src/bitdht/bdquery.cc +++ b/libbitdht/src/bitdht/bdquery.cc @@ -25,11 +25,8 @@ */ -#include "bdquery.h" - -#include -#include -#include +#include "bitdht/bdquery.h" +#include "util/bdnet.h" #include #include diff --git a/libbitdht/src/bitdht/bdquery.h b/libbitdht/src/bitdht/bdquery.h index c40fc7ee2..2b9a660a8 100644 --- a/libbitdht/src/bitdht/bdquery.h +++ b/libbitdht/src/bitdht/bdquery.h @@ -27,9 +27,9 @@ */ -#include "bdiface.h" -#include "bdpeer.h" -#include "bdobj.h" +#include "bitdht/bdiface.h" +#include "bitdht/bdpeer.h" +#include "bitdht/bdobj.h" /* Query result flags are in bdiface.h */ diff --git a/libbitdht/src/bitdht/bdstddht.cc b/libbitdht/src/bitdht/bdstddht.cc index 91746508a..4d11b1a53 100644 --- a/libbitdht/src/bitdht/bdstddht.cc +++ b/libbitdht/src/bitdht/bdstddht.cc @@ -24,8 +24,8 @@ */ -#include "bdstddht.h" -#include "bdpeer.h" +#include "bitdht/bdstddht.h" +#include "bitdht/bdpeer.h" #include #include @@ -35,11 +35,6 @@ #include #include -#include -#include -#include - - /** * #define BITDHT_DEBUG 1 **/ diff --git a/libbitdht/src/bitdht/bdstddht.h b/libbitdht/src/bitdht/bdstddht.h index 6e50b3a33..9f78252e9 100644 --- a/libbitdht/src/bitdht/bdstddht.h +++ b/libbitdht/src/bitdht/bdstddht.h @@ -27,17 +27,13 @@ */ -#include "bdiface.h" +#include "bitdht/bdiface.h" #define BITDHT_STANDARD_BUCKET_SIZE 20 #define BITDHT_STANDARD_BUCKET_SIZE_BITS 5 #define BITDHT_STANDARD_N_BUCKETS BITDHT_KEY_BITLEN -#include -#include -#include - #include #include #include diff --git a/libbitdht/src/bitdht/bdstore.cc b/libbitdht/src/bitdht/bdstore.cc index 59b9852fd..a073e3986 100644 --- a/libbitdht/src/bitdht/bdstore.cc +++ b/libbitdht/src/bitdht/bdstore.cc @@ -24,11 +24,8 @@ */ -#include "bdstore.h" - -#include -#include -#include +#include "bitdht/bdstore.h" +#include "util/bdnet.h" #include #include diff --git a/libbitdht/src/bitdht/bdstore.h b/libbitdht/src/bitdht/bdstore.h index e1e44ce91..6642d4b65 100644 --- a/libbitdht/src/bitdht/bdstore.h +++ b/libbitdht/src/bitdht/bdstore.h @@ -28,8 +28,8 @@ #include -#include "bdiface.h" -#include "bdpeer.h" +#include "bitdht/bdiface.h" +#include "bitdht/bdpeer.h" class bdStore { diff --git a/libbitdht/src/bitdht/bencode.c b/libbitdht/src/bitdht/bencode.c index 3379867ce..1136d8919 100644 --- a/libbitdht/src/bitdht/bencode.c +++ b/libbitdht/src/bitdht/bencode.c @@ -23,7 +23,7 @@ #include /* malloc() realloc() free() strtoll() */ #include /* memset() */ -#include "bencode.h" +#include "bitdht/bencode.h" /*** * #define BE_DEBUG_DECODE 1 diff --git a/libbitdht/src/libbitdht.pro b/libbitdht/src/libbitdht.pro index 36aba5e7c..03e3d1dd3 100644 --- a/libbitdht/src/libbitdht.pro +++ b/libbitdht/src/libbitdht.pro @@ -38,7 +38,8 @@ linux-g++-64 { win32-x-g++ { OBJECTS_DIR = temp/win32xgcc/obj DESTDIR = lib.win32xgcc - DEFINES *= WINDOWS_SYS WIN32 WIN_CROSS_UBUNTU + # These have been replaced by _WIN32 && __MINGW32__ + # DEFINES *= WINDOWS_SYS WIN32 WIN_CROSS_UBUNTU QMAKE_CXXFLAGS *= -Wmissing-include-dirs QMAKE_CC = i586-mingw32msvc-g++ QMAKE_LIB = i586-mingw32msvc-ar @@ -53,7 +54,9 @@ win32 { QMAKE_CC = g++ OBJECTS_DIR = temp/obj MOC_DIR = temp/moc - DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW + DEFINES *= STATICLIB + # These have been replaced by _WIN32 && __MINGW32__ + #DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW DESTDIR = lib } @@ -84,6 +87,7 @@ HEADERS += \ bitdht/bdnode.h \ bitdht/bdmanager.h \ bitdht/bdstddht.h \ + util/bdnet.h \ util/bdthreads.h \ udp/udplayer.h \ udp/udpstack.h \ @@ -100,6 +104,7 @@ SOURCES += \ bitdht/bdnode.cc \ bitdht/bdmanager.cc \ bitdht/bdstddht.cc \ + util/bdnet.cc \ util/bdthreads.cc \ udp/udplayer.cc \ udp/udpstack.cc \ diff --git a/libbitdht/src/tests/bdboot.txt b/libbitdht/src/tests/bdboot.txt index 47be5d7b6..5c8443cc2 100644 --- a/libbitdht/src/tests/bdboot.txt +++ b/libbitdht/src/tests/bdboot.txt @@ -1,500 +1,500 @@ -114.39.54.100 19554 -212.75.231.215 22610 -69.127.30.29 50183 -66.188.114.2 53151 -70.138.183.75 48661 -220.100.1.253 14082 -66.197.244.166 6821 -95.136.150.96 46681 -188.72.225.245 1813 -95.146.231.68 10170 -81.94.83.228 32849 -109.108.232.91 21728 -80.74.56.221 61869 -77.35.146.103 55775 -24.20.146.173 43026 -220.134.194.129 19001 -211.73.186.8 26740 -178.93.231.136 50157 -93.175.235.237 57299 -94.137.207.104 55397 -98.148.246.87 37972 -118.171.93.129 22217 -95.84.220.206 62618 -86.108.76.120 49286 -204.244.136.117 6881 -77.224.70.157 60804 -60.54.20.16 26340 -220.139.135.154 7827 -78.90.4.249 12502 -124.125.189.199 47134 -173.169.9.86 31084 -24.98.100.175 7126 -183.178.235.26 24758 -123.224.242.209 23761 -210.86.0.15 18759 -75.149.206.205 10536 -67.84.219.79 8560 -217.146.88.181 54300 -95.28.12.63 10875 -79.94.35.127 55121 -68.108.252.55 61440 -67.170.35.46 62063 -194.187.103.36 64663 -118.236.29.134 43844 -93.84.7.221 13447 -61.0.91.139 26803 -84.121.162.83 34320 -173.176.223.172 27127 -190.213.185.85 22310 -95.221.210.178 13505 -95.24.209.129 21111 -218.186.196.16 6881 -68.49.119.198 30105 -81.159.253.28 15000 -24.10.98.94 13059 -80.216.104.121 61510 -59.113.173.166 22856 -24.15.116.80 32204 -109.194.45.170 29912 -98.247.151.248 55687 -189.4.255.139 9146 -98.66.242.148 50625 -66.157.166.106 20047 -110.136.163.246 25069 -109.161.78.135 8137 -203.186.242.222 26032 -212.34.119.226 35691 -207.6.49.138 6969 -86.123.18.246 22086 -89.42.241.172 46164 -24.34.126.186 59769 -91.124.248.113 10225 -218.21.189.108 20429 -93.96.52.81 47122 -115.72.196.228 6800 -89.201.230.7 14088 -86.215.201.103 29514 -201.255.87.156 51911 -79.116.171.109 19234 -82.154.171.183 48173 -88.115.102.176 59293 -93.84.155.137 10595 -219.35.252.10 55555 -113.21.55.243 19667 -95.25.130.58 20852 -89.137.255.14 12902 -85.175.232.139 44380 -109.87.212.222 28223 -69.136.195.185 11309 -178.59.125.193 56063 -91.182.188.108 31652 -82.170.25.112 51413 -142.68.202.253 55180 -218.111.132.5 15692 -86.127.55.234 20334 -74.235.33.51 50386 -82.117.173.32 13650 -71.198.37.142 15074 -95.168.62.171 25150 -111.240.222.249 62864 -87.2.128.179 63991 -62.42.58.91 1042 -122.177.218.73 10077 -91.148.152.134 24340 -72.39.15.159 60345 -84.24.237.169 59921 -213.91.244.173 55555 -121.134.79.153 42014 -99.63.38.61 63517 -86.7.25.152 60091 -85.210.23.49 49872 -89.230.131.253 15436 -78.8.127.175 48223 -78.178.71.110 46537 -118.171.194.81 8345 -85.89.186.67 51413 -93.103.152.232 22078 -76.112.249.61 53669 -85.58.216.88 43948 -82.137.79.155 15408 -125.231.225.33 11981 -112.201.53.14 18868 -207.118.142.210 50813 -220.136.178.235 25977 -78.25.181.98 34880 -89.122.128.252 21459 -82.38.64.66 16953 -82.247.189.194 63478 -85.121.214.176 31281 -62.192.242.154 59464 -98.219.221.234 22770 -124.144.233.178 9335 -85.187.239.176 54709 -178.44.218.32 17214 -109.195.131.45 18169 -80.212.49.109 54868 -99.96.13.11 64030 -190.192.220.145 56656 -190.179.202.60 10262 -110.174.10.181 21799 -82.27.51.70 18073 -99.227.10.5 16662 -196.218.38.146 10055 -206.248.108.5 18130 -87.17.159.228 16215 -76.95.11.16 64463 -86.150.249.181 6881 -115.240.28.226 49148 -76.119.206.114 6881 -89.75.52.83 34055 -78.106.87.78 28988 -74.250.134.46 57848 -95.91.36.34 51413 -213.114.101.46 11620 -75.51.75.216 59972 -68.4.67.238 44832 -84.52.38.204 53065 -142.68.230.32 60968 -96.50.131.133 31684 -180.68.18.184 63792 -91.203.189.100 61391 -123.202.206.64 6881 -82.46.178.191 16363 -81.166.136.228 58006 -188.52.47.54 12698 -118.237.142.69 52729 -201.19.86.9 61355 -113.53.45.135 55555 -121.7.27.67 18758 -89.184.145.241 9009 -213.214.67.34 16800 -93.95.92.35 17248 -203.218.113.128 9462 -95.153.164.4 40023 -109.108.235.75 58371 -123.91.21.58 25076 -95.79.107.69 15354 -85.227.214.101 36351 -83.5.98.228 15091 -111.235.24.67 16934 -84.222.194.71 50190 -221.130.163.200 8905 -92.112.14.249 22745 -84.240.44.175 18416 -174.96.42.63 44013 -98.228.50.5 63440 -115.177.173.204 22786 -123.202.51.220 16001 -118.165.9.141 18751 -61.58.191.140 14490 -83.254.64.144 47994 -89.136.20.253 16522 -99.159.250.32 22656 -187.64.218.242 62685 -89.241.158.147 22998 -84.108.246.142 41947 -98.198.130.145 12954 -93.164.251.146 6883 -77.123.7.165 35691 -85.216.221.115 7232 -189.120.213.124 65465 -175.128.83.60 62216 -175.137.196.28 17342 -85.68.166.6 32167 -80.202.94.20 36945 -94.232.135.97 36031 -77.37.139.99 26973 -81.24.210.253 34483 -212.174.9.10 64969 -96.228.35.250 64059 -98.155.80.108 28265 -82.55.167.127 40581 -141.152.181.4 50012 -92.249.191.37 29347 -24.64.106.176 61579 -89.47.57.117 9054 -114.24.195.51 12066 -110.137.81.98 26201 -188.165.215.148 35775 -78.60.67.126 51134 -188.18.57.55 8447 -121.106.156.218 54444 -124.82.121.128 9795 -76.232.119.73 61243 -83.103.197.225 18706 -88.178.52.25 20468 -88.226.204.1 33434 -114.161.143.54 57930 -115.135.90.242 12279 -78.63.28.212 39398 -188.18.81.154 35691 -193.26.13.73 61527 -116.113.223.63 16068 -212.187.7.68 41823 -66.203.164.20 16210 -79.9.28.109 10254 -112.205.90.145 27962 -187.91.43.234 57803 -109.108.39.178 9000 -95.156.120.77 15619 -124.104.204.201 50524 -122.100.177.233 6889 -95.104.83.111 12834 -99.92.88.171 56058 -112.104.114.13 11403 -79.100.168.120 19561 -78.251.234.239 59735 -77.94.112.102 63431 -68.103.186.81 42197 -24.138.37.4 13731 -60.52.90.192 55636 -83.21.162.109 43604 -95.220.45.221 13078 -61.91.88.16 16880 -78.147.56.155 20648 -114.27.159.37 23908 -86.192.44.125 16157 -98.176.70.110 61064 -41.213.178.126 55764 -86.211.238.186 17824 -89.215.227.16 62105 -94.211.63.116 28779 -95.65.17.160 19311 -94.76.96.226 10611 -212.21.16.76 20408 -76.93.66.53 62327 -81.200.156.184 54547 -80.177.165.168 33754 -69.141.124.24 6799 -212.36.247.230 35691 -200.68.106.148 54251 -141.152.181.4 50918 -119.202.26.40 49386 -95.76.64.20 16346 -83.226.36.50 49999 -71.59.190.63 58638 -83.115.101.72 37548 -98.156.123.148 19802 -69.231.131.149 45006 -78.133.47.148 27896 -88.192.73.144 6881 -74.129.247.212 24829 -88.252.22.216 60670 -58.90.242.71 27384 -160.114.83.2 6688 -118.111.156.226 20508 -111.248.11.238 24604 -86.68.57.167 22151 -76.102.234.104 36310 -124.189.161.94 22414 -58.3.175.243 24796 -112.119.194.44 12712 -94.76.96.95 17117 -24.251.17.180 22938 -222.130.217.206 9044 -203.223.236.141 16001 -188.186.72.203 56340 -203.212.2.152 8982 -112.118.137.166 19859 -193.151.57.169 6881 -174.116.90.192 26802 -89.252.126.108 53004 -77.109.214.112 45948 -178.175.19.112 34868 -120.203.87.67 14023 -91.180.157.2 37962 -94.242.45.152 18240 -92.83.137.232 57066 -24.22.209.82 6882 -114.176.153.241 45881 -202.231.187.234 20646 -88.216.54.253 21972 -95.131.209.139 34023 -81.195.84.6 57264 -87.68.85.133 37039 -108.7.97.26 39276 -93.86.172.207 10041 -208.127.132.128 6881 -212.113.33.131 60003 -190.162.70.21 20999 -95.105.208.130 56202 -87.205.166.98 24856 -108.6.47.164 58590 -96.20.74.14 55672 -121.160.139.9 19617 -203.136.93.97 51990 -116.14.24.5 39662 -76.111.181.68 18631 -84.209.70.180 63869 -78.87.103.116 58478 -99.239.201.60 6881 -78.146.229.96 14375 -112.201.169.5 1392 -109.96.18.50 10030 -84.111.100.139 46217 -115.96.138.3 1221 -187.59.192.235 63108 -88.179.18.142 52750 -78.227.124.217 53330 -71.233.192.92 6881 -92.248.145.10 55997 -67.215.242.139 6881 -99.67.21.185 49519 -114.47.230.206 15652 -79.165.120.179 15864 -94.236.134.60 1091 -188.102.204.146 4002 -74.100.62.203 44664 -89.142.91.205 30386 -109.192.197.172 63998 -96.48.192.134 60551 -95.59.112.215 13582 -220.137.145.200 12850 -115.43.166.132 20420 -89.149.227.130 54467 -89.41.37.185 28013 -89.230.141.151 21513 -109.211.178.182 22698 -67.215.242.138 6881 -92.124.165.75 17048 -114.75.147.245 7240 -114.162.73.133 49152 -202.89.175.193 53376 -60.34.221.40 10951 -109.182.60.132 47452 -69.156.165.233 9094 -193.238.17.174 22261 -137.186.174.20 39467 -143.248.80.185 59366 -195.91.229.83 14505 -90.197.51.122 50637 -59.115.152.183 33551 -65.48.211.12 26153 -75.181.72.53 20364 -209.40.182.139 45227 -69.140.119.105 58919 -94.179.212.27 30333 -94.2.0.107 16939 -84.197.209.196 33124 -90.217.72.188 45412 -90.54.159.118 59967 -88.219.249.196 20205 -222.20.71.219 16001 -72.175.73.30 7319 -90.210.142.155 10422 -86.200.169.78 12883 -122.173.245.223 13962 -119.224.11.41 26665 -24.209.191.94 25586 -58.69.89.206 63561 -27.33.41.87 8639 -81.233.26.219 15364 -59.148.147.13 44455 -95.65.79.139 39249 -67.184.37.251 40737 -81.164.195.168 12540 -213.167.211.172 26007 -82.246.39.59 21556 -86.35.151.68 11288 -125.143.143.196 65111 -123.217.244.89 32800 -24.72.127.230 34591 -114.203.194.211 53395 -89.75.57.36 36247 -83.24.23.151 46539 -114.159.93.185 54510 -76.213.155.173 43698 -123.226.191.13 8736 -112.203.3.154 10590 -89.134.188.245 18599 -98.238.120.234 62122 -66.158.178.121 28442 -87.206.65.37 44475 -84.46.164.73 41271 -183.89.116.230 22205 -85.229.37.211 60855 -89.78.21.208 59245 -24.89.199.99 57494 -98.239.180.156 25261 -82.245.238.156 39545 -85.66.2.212 52302 -207.118.142.210 50835 -122.178.181.12 21442 -95.25.72.65 17269 -90.203.16.81 25500 -69.254.11.60 36804 -71.67.122.116 41952 -98.225.40.208 17490 -122.118.183.195 28001 -125.224.162.118 15101 -62.68.165.208 31711 -68.229.58.24 62067 -125.230.43.127 12149 -82.76.196.53 40261 -62.42.32.46 38077 -66.203.194.117 60010 -142.162.18.65 62980 -85.140.16.61 12073 -180.197.98.20 9784 -85.243.248.245 50666 -82.230.144.1 22666 -85.226.189.216 28265 -80.240.210.17 10222 -90.29.197.128 51353 -76.108.40.67 61682 -70.72.59.37 25660 -211.76.172.111 6888 -98.17.168.53 23527 -123.110.215.145 10630 -84.26.218.9 32793 -79.165.165.155 21639 -93.190.202.49 35770 -68.196.92.231 9641 -178.49.38.208 30259 -82.56.117.63 7147 -195.208.11.214 62437 -124.26.65.15 13274 -118.12.229.246 7750 -98.92.196.112 50672 -109.91.162.68 41454 -109.66.184.96 28769 -174.98.152.253 53363 -217.76.187.121 45486 -77.121.81.130 37339 -58.188.21.105 23630 -71.74.98.133 46791 -190.142.105.159 57687 -82.132.104.150 28511 -68.255.6.217 62211 -93.116.48.180 47676 -75.180.47.47 28483 -116.88.199.8 10231 -115.176.131.150 8030 -94.21.137.106 1056 -84.247.48.43 17566 -84.40.98.86 15947 -76.24.137.148 23773 -77.70.29.89 51379 -173.23.157.97 16994 -212.17.86.122 32012 -95.239.66.249 17033 -62.107.109.171 16832 -79.164.44.100 10453 +92.12.39.6 16244 +89.212.217.239 28436 +78.245.141.29 24062 +205.237.249.60 60753 +62.21.68.140 29607 +61.64.105.113 25526 +91.124.60.138 29433 +218.224.131.30 40758 +83.240.70.102 36020 +85.217.136.19 12987 +117.200.98.12 52766 +78.96.190.94 62088 +178.223.87.21 10014 +80.2.47.245 15552 +90.170.111.137 13192 +188.226.10.2 34216 +90.227.88.106 54053 +85.75.149.20 28827 +69.148.26.74 40190 +95.57.8.245 13623 +77.78.137.242 34136 +88.198.31.48 51413 +114.177.196.25 23313 +112.143.5.152 10035 +201.210.35.114 1089 +114.166.35.238 20748 +89.23.16.155 21007 +82.209.158.227 29892 +71.154.218.34 32471 +66.68.12.56 42237 +77.250.248.129 35359 +86.123.20.27 59763 +88.189.215.153 47003 +212.115.243.128 35331 +68.33.231.30 4041 +174.3.187.193 17999 +61.73.159.158 62930 +202.106.63.129 6881 +121.254.72.205 18068 +94.27.71.190 45882 +76.221.142.55 8106 +118.243.253.168 51810 +83.82.215.49 27067 +99.56.61.56 16881 +93.100.178.63 63982 +89.124.38.17 7719 +94.96.39.71 14533 +85.224.48.124 19157 +83.149.3.111 2212 +165.132.28.29 22553 +210.6.190.167 9258 +183.89.42.239 10211 +76.11.65.212 11952 +173.59.11.238 49662 +85.187.184.104 11066 +82.44.90.159 22344 +188.27.114.217 32171 +89.31.112.26 51780 +124.218.29.192 16642 +78.130.222.130 43658 +74.105.211.205 48819 +114.168.150.173 55910 +96.51.33.140 32329 +190.204.29.202 54450 +80.240.217.180 56605 +72.229.227.66 51413 +81.147.10.199 60224 +60.50.255.65 27500 +82.210.154.254 49074 +95.178.165.85 22073 +173.74.61.121 20296 +189.172.91.63 32862 +83.149.3.87 49422 +221.118.228.240 19062 +113.167.211.162 26491 +82.75.83.7 32231 +184.59.26.110 57394 +75.72.139.138 57619 +187.112.195.219 35326 +59.171.53.80 6885 +89.132.238.128 14064 +79.119.179.173 51847 +94.232.9.137 22515 +93.183.158.243 33177 +190.142.237.235 57012 +81.225.3.15 52735 +87.70.134.32 35691 +125.34.10.134 16881 +72.252.147.147 44561 +81.132.137.167 64163 +188.17.186.176 20143 +122.173.123.126 10059 +84.124.240.134 13910 +76.65.82.185 53620 +92.83.123.164 10312 +115.118.204.63 23820 +118.172.176.216 16326 +81.98.36.18 37915 +111.243.22.108 19934 +94.10.204.178 18391 +213.120.100.133 64504 +95.42.85.28 22290 +75.65.154.63 49384 +93.185.177.162 26017 +71.195.178.231 29656 +83.97.66.17 36084 +88.205.175.143 52773 +78.8.223.23 35068 +195.18.14.209 42232 +175.144.254.70 21025 +96.51.132.228 31985 +211.224.68.157 38486 +84.3.119.43 37819 +64.120.255.60 6860 +64.120.255.40 6840 +88.112.86.60 6881 +85.15.90.39 62239 +203.219.136.214 12386 +24.86.186.73 35444 +98.117.17.53 47127 +71.236.116.230 53266 +79.88.52.95 58810 +70.26.249.175 12712 +84.238.32.93 39000 +142.177.138.67 42608 +193.227.230.38 25998 +159.148.201.3 51279 +81.101.108.205 55319 +92.112.239.251 54423 +89.32.161.80 20534 +92.134.174.244 63288 +76.99.68.51 50009 +82.13.104.126 60394 +190.254.250.39 16039 +95.58.121.74 59312 +174.88.26.132 10167 +109.96.138.146 23894 +186.19.235.217 25339 +109.192.92.151 42637 +87.239.33.5 1907 +95.154.176.23 46887 +94.137.206.211 50526 +210.146.116.72 62780 +218.171.243.202 9133 +61.244.211.243 8756 +91.95.25.150 47353 +174.5.75.103 25772 +118.167.114.241 51001 +75.56.207.235 26166 +92.30.126.173 18921 +114.36.64.2 17738 +78.29.165.84 52760 +173.212.206.213 6813 +187.59.109.115 37484 +85.22.8.175 52857 +126.109.206.4 64327 +82.210.188.127 20329 +95.165.163.114 23448 +83.153.209.5 17211 +76.29.235.184 17801 +66.177.225.54 55952 +59.26.76.120 49911 +70.26.207.239 50591 +87.2.17.117 18586 +81.102.125.77 40848 +109.104.187.38 13937 +95.68.94.144 16302 +85.229.75.44 35060 +76.92.217.64 26272 +125.1.208.157 40393 +92.27.172.45 12303 +140.113.179.143 14232 +81.191.145.10 58334 +70.53.178.100 9472 +126.114.208.43 50784 +183.178.66.202 24910 +79.101.206.136 10361 +90.136.101.48 41749 +188.60.106.125 39889 +217.209.12.220 20544 +90.190.114.159 113 +95.71.127.32 33037 +61.12.222.55 13064 +77.229.176.143 27625 +81.23.166.136 22829 +78.29.119.181 21344 +67.171.29.15 40385 +122.118.176.147 19139 +190.235.210.249 14178 +76.11.109.99 44390 99.253.38.74 19441 -78.84.48.149 8694 -114.43.201.50 9426 -217.25.241.138 19518 -203.158.60.12 25723 -122.161.158.237 15903 -80.235.136.233 17866 -59.148.110.152 7022 -202.225.19.72 23157 -124.11.148.31 4322 -78.60.241.230 23161 -68.13.158.198 45437 -83.251.65.144 59604 -99.69.141.24 23579 -24.109.229.78 40666 -76.225.138.22 56814 -142.59.53.126 54853 +62.169.123.28 35746 +82.132.23.195 52333 +109.111.156.186 17673 +82.239.40.163 16624 +90.213.246.144 9402 +83.227.156.194 26021 +95.79.96.241 15528 +74.192.71.122 48397 +89.204.102.106 15739 +90.191.179.50 16191 +122.128.7.158 13056 +92.112.175.123 57663 +91.126.193.107 47880 +109.213.51.102 29726 +94.242.39.161 52574 +94.242.146.69 12718 +71.162.145.34 29292 +69.124.254.45 22881 +150.241.243.9 11285 +93.186.210.168 10720 +178.162.183.230 6821 +126.129.78.39 12196 +220.104.150.203 14433 +188.231.161.11 15100 +92.37.60.58 36471 +91.200.201.18 30249 +90.224.113.160 14137 +188.168.149.62 32100 +89.85.101.239 49653 +85.137.231.20 27117 +109.173.31.9 35713 +95.93.164.200 30478 +195.134.67.116 47054 +77.204.69.245 20415 +118.166.138.60 20047 +69.226.208.233 58693 +178.162.183.229 6821 +147.102.101.57 31117 +99.155.75.169 27252 +95.95.131.196 53008 +86.135.175.65 22570 +96.248.14.215 54714 +99.114.93.62 6881 +218.101.254.179 20865 +122.29.166.207 20125 +24.138.175.76 54343 +74.59.81.208 52162 +118.237.9.41 26975 +125.27.16.14 24154 +82.42.153.229 6881 +72.83.129.103 13768 +109.121.138.103 16757 +99.49.108.135 61808 +174.16.53.212 10881 +208.96.64.154 8545 +70.233.142.241 10844 +218.250.92.55 24465 +109.185.145.116 46074 +71.233.253.247 52632 +69.199.158.242 1046 +61.237.150.128 16001 +113.167.87.35 23472 +92.80.179.29 46605 +95.174.221.82 13219 +188.51.50.221 45298 +187.58.97.75 29532 +77.31.99.230 12300 +109.254.58.59 16275 +78.56.58.195 20217 +122.167.251.69 10907 +60.51.126.182 10476 +178.128.11.174 61849 +218.212.172.84 15730 +211.2.124.206 21145 +109.228.129.162 21836 +92.81.66.102 14464 +216.59.6.151 49161 +217.9.228.38 52626 +89.102.21.149 59205 +94.236.135.235 14741 +178.95.49.31 35059 +95.222.241.5 20086 +93.12.155.205 13490 +84.189.184.178 27337 +95.37.6.182 80 +77.225.25.74 21516 +123.205.25.101 24874 +211.49.2.134 51699 +84.80.253.42 58301 +95.190.84.211 23514 +77.85.121.195 19864 +80.81.52.236 11588 +114.78.108.245 18763 +87.117.193.75 59052 +93.86.43.29 18717 +76.200.119.40 33598 +202.91.148.53 61417 +117.199.66.185 59509 +83.213.159.14 61673 +78.69.137.44 51413 +94.195.125.8 16194 +74.60.226.19 39582 +118.216.216.189 31485 +61.206.209.175 19759 +85.230.109.209 6885 +85.230.109.209 6882 +70.161.168.143 28026 +186.89.208.31 29977 +76.170.201.149 58022 +188.168.37.213 26920 +220.87.28.165 19422 +90.196.0.115 8793 +95.25.118.39 43292 +89.89.184.28 45594 +2.94.21.224 21167 +94.24.180.164 51413 +69.22.210.60 44108 +99.3.36.205 29624 +87.118.159.137 32214 +78.150.70.194 11605 +118.169.51.195 63655 +109.87.209.181 35691 +88.168.220.170 16515 +83.21.98.78 23532 +84.228.30.163 26271 +71.201.250.18 62141 +75.155.68.157 12004 +98.244.32.255 27000 +187.22.84.8 13362 +67.174.144.251 48131 +59.93.116.98 60592 +219.40.160.200 11266 +188.230.68.133 64234 +93.103.76.133 62482 +82.35.193.163 49367 +82.199.200.214 40635 +79.121.55.130 33416 +97.102.6.239 59824 +69.150.73.121 48195 +99.250.69.227 25017 +178.83.250.159 62178 +75.65.95.130 24792 +77.70.96.235 48474 +76.173.74.239 10826 +98.251.67.38 15801 +123.201.200.33 54012 +213.191.30.253 12135 +125.164.105.45 14264 +188.54.96.108 13874 +98.225.190.156 63350 +70.81.211.190 39510 +117.201.19.29 29960 +69.221.9.204 36204 +82.226.93.109 52049 +94.21.163.155 6881 +173.72.2.69 58839 +173.72.2.69 58838 +174.115.207.53 40067 +24.200.200.102 11693 +81.182.59.31 26133 +212.92.232.102 36439 +78.58.104.112 49574 +79.100.174.203 18249 +91.123.214.17 47577 +70.55.196.137 60603 +83.108.244.62 59851 +61.5.241.219 59550 +220.118.223.179 55487 +80.184.76.198 46930 +95.180.177.64 20749 +190.51.60.70 13430 +178.253.74.146 57795 +221.161.5.96 21381 +95.83.24.44 58220 +61.64.85.57 8871 +115.241.141.104 31440 +41.218.245.100 10064 +95.84.46.158 40663 +83.154.58.197 39055 +67.193.111.176 38941 +84.251.15.143 51413 +78.144.58.92 10112 +120.60.15.173 13419 +78.130.227.226 55407 +184.91.54.179 57218 +213.85.190.254 18216 +85.220.114.208 52900 +142.162.24.166 37627 +77.232.0.135 51921 +69.249.169.177 51691 +76.213.243.148 28855 +203.223.253.214 7770 +78.229.62.160 14415 +67.215.242.138 6881 +82.149.25.41 46820 +116.82.89.250 25571 +60.50.82.192 12787 +187.114.133.241 10549 +109.120.6.96 21469 +92.124.180.230 23079 +24.19.253.77 48092 +58.190.47.190 27512 +219.116.160.55 25208 +94.123.195.173 17434 +125.54.101.116 57138 +85.230.109.209 6884 +92.84.191.232 10293 +174.50.54.21 32019 +99.229.109.124 6888 +87.110.153.41 56759 +178.187.66.20 17438 +89.218.103.57 19107 +114.44.18.94 1529 +109.111.152.211 35691 +77.122.1.218 30237 +82.56.51.220 59015 +82.245.238.156 39545 +68.44.185.187 29888 +83.217.190.31 39457 +81.201.56.15 6881 +188.186.68.15 42452 +109.160.57.143 11947 +151.57.36.222 57980 +95.59.24.64 26897 +78.13.96.106 9091 +194.44.203.120 60457 +86.63.247.225 14760 +24.11.181.218 54587 +68.40.4.78 38131 +70.26.98.163 10009 +187.104.240.6 27396 +41.227.4.6 53989 +69.221.61.72 63861 +86.7.2.171 25589 +70.73.113.97 28081 +188.212.192.150 44909 +82.246.253.38 6900 +66.227.154.68 55316 +210.50.200.115 6881 +89.211.201.1 47214 +71.145.142.137 44293 +109.60.217.204 9000 +94.241.206.69 20091 +88.135.131.100 58407 +98.179.26.65 10197 +180.146.24.30 24733 +94.66.189.31 34843 +125.26.41.6 44723 +77.50.185.98 45240 +193.43.222.175 15977 +24.34.126.186 59769 +115.87.124.125 53022 +67.177.209.198 32814 +93.102.81.243 20634 +62.121.85.134 6881 +67.163.87.22 6881 +173.173.24.204 17165 +189.19.28.184 2042 +84.100.62.233 52448 +88.169.213.101 35608 +109.255.144.87 8080 +217.131.178.155 31638 +193.43.255.89 12451 +173.57.57.106 41416 +94.62.199.171 15566 +71.177.102.167 37973 +59.27.33.209 51801 +89.178.242.209 27670 +86.132.130.195 16438 +76.108.128.141 58775 +67.215.242.139 6881 +84.246.95.179 43652 +88.222.154.187 62265 +111.243.28.27 55276 +122.164.144.53 18463 +210.6.181.220 24282 +91.153.197.239 2104 +77.210.249.40 14915 +109.86.76.157 47312 +82.193.158.49 8807 +115.43.165.207 4713 +94.41.128.202 49440 +83.254.22.62 28881 +62.21.16.139 51172 +147.102.102.94 62957 +62.98.164.48 10950 +117.194.32.225 60090 +187.57.200.195 33839 +190.177.176.192 49799 +88.181.170.74 53822 +97.97.117.10 38628 +97.120.33.227 57680 +61.4.170.187 17790 +78.144.120.92 20965 +70.139.176.169 27008 +92.115.180.186 35691 +174.142.32.120 51413 +97.85.57.37 34092 +84.90.10.205 24820 +83.149.3.23 59982 +98.14.97.232 36193 +98.192.164.25 17489 +210.124.128.139 33819 +195.234.110.226 39347 +99.9.186.124 58889 +115.242.8.83 9388 +88.189.81.247 14965 +87.194.85.120 50941 +84.50.22.179 63089 diff --git a/libbitdht/src/tests/udpbitdht_nettest.cc b/libbitdht/src/tests/udpbitdht_nettest.cc index d1311bc8a..cefef2110 100644 --- a/libbitdht/src/tests/udpbitdht_nettest.cc +++ b/libbitdht/src/tests/udpbitdht_nettest.cc @@ -65,9 +65,15 @@ int main(int argc, char **argv) bdDhtFunctions *fns = new bdStdDht(); bdNodeId id; + +/** memcpy(((char *) id.data), "1234567890abcdefghi", 20); uint32_t *deltaptr = (uint32_t *) (id.data); (*deltaptr) += htonl(delta); +**/ + + bdStdRandomNodeId(&id); + std::cerr << "Using NodeId: "; fns->bdPrintNodeId(std::cerr, &id); diff --git a/libbitdht/src/udp/udpbitdht.cc b/libbitdht/src/udp/udpbitdht.cc index 2b0caa6a4..5f5be167b 100644 --- a/libbitdht/src/udp/udpbitdht.cc +++ b/libbitdht/src/udp/udpbitdht.cc @@ -37,9 +37,7 @@ #include -#include -#include -#include +#include "util/bdnet.h" /* * #define DEBUG_UDP_BITDHT 1 diff --git a/libbitdht/src/udp/udplayer.cc b/libbitdht/src/udp/udplayer.cc index 489091a21..591929ce3 100644 --- a/libbitdht/src/udp/udplayer.cc +++ b/libbitdht/src/udp/udplayer.cc @@ -1,9 +1,9 @@ /* - * bitdht/udplayer.cc + * udp/udplayer.cc * * BitDHT: An Flexible DHT library. * - * Copyright 2010 by Robert Fernie + * Copyright 2004-2010 by Robert Fernie * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,8 +23,7 @@ * */ - -#include "udplayer.h" +#include "udp/udplayer.h" #include #include @@ -32,26 +31,26 @@ #include #include -#include -#include -#include - -/* -#include -#include - - -#include -*/ - /*** - * #define DEBUG_UDP_LAYER 1 + * #define UDP_ENABLE_BROADCAST 1 + * #define UDP_LOOPBACK_TESTING 1 + * #define DEBUG_UDP_LAYER 1 ***/ -#define OPEN_UNIVERSAL_PORT 1 - static const int UDP_DEF_TTL = 64; +/* NB: This #define makes the listener open 0.0.0.0:X port instead + * of a specific port - this helps library communicate on systems + * with multiple interfaces or unique network setups. + * + * - It should always be used! + * + * #define OPEN_UNIVERSAL_PORT 1 + * + */ + +#define OPEN_UNIVERSAL_PORT 1 + class udpPacket { @@ -78,7 +77,6 @@ class udpPacket int len; }; - std::ostream &operator<<(std::ostream &out, const struct sockaddr_in &addr) { out << "[" << inet_ntoa(addr.sin_addr) << ":"; @@ -86,7 +84,6 @@ std::ostream &operator<<(std::ostream &out, const struct sockaddr_in &addr) return out; } - bool operator==(const struct sockaddr_in &addr, const struct sockaddr_in &addr2) { if (addr.sin_family != addr2.sin_family) @@ -181,29 +178,42 @@ int UdpLayer::status(std::ostream &out) int UdpLayer::reset(struct sockaddr_in &local) { +#ifdef DEBUG_UDP_LAYER std::cerr << "UdpLayer::reset()" << std::endl; +#endif /* stop the old thread */ { bdStackMutex stack(sockMtx); /********** LOCK MUTEX *********/ +#ifdef DEBUG_UDP_LAYER std::cerr << "UdpLayer::reset() setting stopThread flag" << std::endl; +#endif stopThread = true; } - +#ifdef DEBUG_UDP_LAYER std::cerr << "UdpLayer::reset() joining" << std::endl; +#endif + join(); +#ifdef DEBUG_UDP_LAYER std::cerr << "UdpLayer::reset() closing socket" << std::endl; +#endif closeSocket(); +#ifdef DEBUG_UDP_LAYER std::cerr << "UdpLayer::reset() resetting variables" << std::endl; +#endif laddr = local; errorState = 0; ttl = UDP_DEF_TTL; +#ifdef DEBUG_UDP_LAYER std::cerr << "UdpLayer::reset() opening socket" << std::endl; +#endif openSocket(); - return 1; + + return 1 ; } @@ -214,7 +224,7 @@ int UdpLayer::closeSocket() if (sockfd > 0) { - close(sockfd); + bdnet_close(sockfd); } sockMtx.unlock(); /******** UNLOCK MUTEX *********/ @@ -237,7 +247,6 @@ void UdpLayer::recv_loop() while(1) { - /* select on the socket TODO */ fd_set rset; for(;;) { @@ -250,7 +259,9 @@ void UdpLayer::recv_loop() if (toStop) { +#ifdef DEBUG_UDP_LAYER std::cerr << "UdpLayer::recv_loop() stopping thread" << std::endl; +#endif stop(); } @@ -265,8 +276,9 @@ void UdpLayer::recv_loop() } else if (status < 0) { - std::cerr << "UdpLayer::recv_loop() "; - std::cerr << "Error: " << errno << std::endl; +#ifdef DEBUG_UDP_LAYER + std::cerr << "UdpLayer::recv_loop() Error: " << bdnet_errno() << std::endl; +#endif } }; @@ -275,8 +287,8 @@ void UdpLayer::recv_loop() if (0 < receiveUdpPacket(inbuf, &nsize, from)) { #ifdef DEBUG_UDP_LAYER - std::cerr << "UdpLayer::readPkt() from : " << from << std::endl; - std::cerr << printPkt(inbuf, nsize); + std::cerr << "UdpLayer::readPkt() from : " << from << std::endl; + std::cerr << printPkt(inbuf, nsize); #endif // send to reciever. recv -> recvPkt(inbuf, nsize, from); @@ -316,7 +328,7 @@ int UdpLayer::openSocket() sockMtx.lock(); /********** LOCK MUTEX *********/ /* make a socket */ - sockfd = socket(PF_INET, SOCK_DGRAM, 0); + sockfd = bdnet_socket(PF_INET, SOCK_DGRAM, 0); #ifdef DEBUG_UDP_LAYER std::cerr << "UpdStreamer::openSocket()" << std::endl; #endif @@ -330,14 +342,14 @@ int UdpLayer::openSocket() #ifdef OPEN_UNIVERSAL_PORT struct sockaddr_in tmpaddr = laddr; tmpaddr.sin_addr.s_addr = 0; - if (0 != bind(sockfd, (struct sockaddr *) (&tmpaddr), sizeof(tmpaddr))) + if (0 != bdnet_bind(sockfd, (struct sockaddr *) (&tmpaddr), sizeof(tmpaddr))) #else - if (0 != bind(sockfd, (struct sockaddr *) (&laddr), sizeof(laddr))) + if (0 != bdnet_bind(sockfd, (struct sockaddr *) (&laddr), sizeof(laddr))) #endif { #ifdef DEBUG_UDP_LAYER std::cerr << "Socket Failed to Bind to : " << laddr << std::endl; - std::cerr << "Error: " << errno << std::endl; + std::cerr << "Error: " << bdnet_errno() << std::endl; #endif errorState = EADDRINUSE; //exit(1); @@ -346,13 +358,14 @@ int UdpLayer::openSocket() return -1; } - if (-1 == fcntl(sockfd, F_SETFL, O_NONBLOCK)) + if (-1 == bdnet_fcntl(sockfd, F_SETFL, O_NONBLOCK)) { #ifdef DEBUG_UDP_LAYER std::cerr << "Failed to Make Non-Blocking" << std::endl; #endif } +#ifdef UDP_ENABLE_BROADCAST /* Setup socket for broadcast. */ int val = 1; if (-1 == setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &val, sizeof(int))) @@ -361,6 +374,7 @@ int UdpLayer::openSocket() std::cerr << "Failed to Make Socket Broadcast" << std::endl; #endif } +#endif errorState = 0; @@ -390,7 +404,7 @@ int UdpLayer::setTTL(int t) { sockMtx.lock(); /********** LOCK MUTEX *********/ - int err = setsockopt(sockfd, IPPROTO_IP, IP_TTL, &t, sizeof(int)); + int err = bdnet_setsockopt(sockfd, IPPROTO_IP, IP_TTL, &t, sizeof(int)); ttl = t; sockMtx.unlock(); /******** UNLOCK MUTEX *********/ @@ -454,7 +468,7 @@ int UdpLayer::receiveUdpPacket(void *data, int *size, struct sockaddr_in &from) sockMtx.lock(); /********** LOCK MUTEX *********/ - insize = recvfrom(sockfd,data,insize,0, + insize = bdnet_recvfrom(sockfd,data,insize,0, (struct sockaddr*)&fromaddr,&fromsize); sockMtx.unlock(); /******** UNLOCK MUTEX *********/ @@ -484,7 +498,7 @@ int UdpLayer::sendUdpPacket(const void *data, int size, struct sockaddr_in &to) sockMtx.lock(); /********** LOCK MUTEX *********/ - sendto(sockfd, data, size, 0, + bdnet_sendto(sockfd, data, size, 0, (struct sockaddr *) &(toaddr), sizeof(toaddr)); @@ -493,5 +507,62 @@ int UdpLayer::sendUdpPacket(const void *data, int size, struct sockaddr_in &to) } +/**************************** LossyUdpLayer - for Testing **************/ +LossyUdpLayer::LossyUdpLayer(UdpReceiver *udpr, + struct sockaddr_in &local, double frac) + :UdpLayer(udpr, local), lossFraction(frac) +{ + return; +} +LossyUdpLayer::~LossyUdpLayer() { return; } + +int LossyUdpLayer::receiveUdpPacket(void *data, int *size, struct sockaddr_in &from) +{ + double prob = (1.0 * (rand() / (RAND_MAX + 1.0))); + + if (prob < lossFraction) + { + /* but discard */ + if (0 < UdpLayer::receiveUdpPacket(data, size, from)) + { + std::cerr << "LossyUdpLayer::receiveUdpPacket() Dropping packet!"; + std::cerr << std::endl; + std::cerr << printPkt(data, *size); + std::cerr << std::endl; + std::cerr << "LossyUdpLayer::receiveUdpPacket() Packet Dropped!"; + std::cerr << std::endl; + } + + size = 0; + return -1; + + } + + // otherwise read normally; + return UdpLayer::receiveUdpPacket(data, size, from); +} + +int LossyUdpLayer::sendUdpPacket(const void *data, int size, struct sockaddr_in &to) +{ + double prob = (1.0 * (rand() / (RAND_MAX + 1.0))); + + if (prob < lossFraction) + { + /* discard */ + + std::cerr << "LossyUdpLayer::sendUdpPacket() Dropping packet!"; + std::cerr << std::endl; + std::cerr << printPkt((void *) data, size); + std::cerr << std::endl; + std::cerr << "LossyUdpLayer::sendUdpPacket() Packet Dropped!"; + std::cerr << std::endl; + + return size; + } + + // otherwise read normally; + return UdpLayer::sendUdpPacket(data, size, to); +} + diff --git a/libbitdht/src/udp/udplayer.h b/libbitdht/src/udp/udplayer.h index cd8c77abe..7de1a16b4 100644 --- a/libbitdht/src/udp/udplayer.h +++ b/libbitdht/src/udp/udplayer.h @@ -2,11 +2,11 @@ #define BITDHT_UDP_LAYER_H /* - * bitdht/udplayer.h + * udp/udplayer.h * * BitDHT: An Flexible DHT library. - * - * Copyright 2010 by Robert Fernie + * + * Copyright 2004-2010 by Robert Fernie * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,21 +27,15 @@ */ - - #include #include "util/bdthreads.h" +#include "util/bdnet.h" #include #include #include -/**** - * #define UDP_LOOPBACK_TESTING 1 - ***/ - - std::ostream &operator<<(std::ostream &out, const struct sockaddr_in &addr); bool operator==(const struct sockaddr_in &addr, const struct sockaddr_in &addr2); bool operator<(const struct sockaddr_in &addr, const struct sockaddr_in &addr2); @@ -125,4 +119,20 @@ virtual int sendUdpPacket(const void *data, int size, struct sockaddr_in &to); }; +/* For Testing - drops packets */ +class LossyUdpLayer: public UdpLayer +{ + public: + LossyUdpLayer(UdpReceiver *udpr, struct sockaddr_in &local, double frac); +virtual ~LossyUdpLayer(); + + protected: + +virtual int receiveUdpPacket(void *data, int *size, struct sockaddr_in &from); +virtual int sendUdpPacket(const void *data, int size, struct sockaddr_in &to); + + double lossFraction; +}; + + #endif diff --git a/libbitdht/src/udp/udpstack.cc b/libbitdht/src/udp/udpstack.cc index d11ac6182..1b4adebe9 100644 --- a/libbitdht/src/udp/udpstack.cc +++ b/libbitdht/src/udp/udpstack.cc @@ -1,5 +1,5 @@ /* - * bitdht/udpstack.cc + * udp/udpstack.cc * * BitDHT: An Flexible DHT library. * @@ -23,7 +23,7 @@ * */ -#include "udpstack.h" +#include "udp/udpstack.h" #include #include @@ -31,10 +31,6 @@ #include #include -#include -#include -#include - #include /*** diff --git a/libbitdht/src/udp/udpstack.h b/libbitdht/src/udp/udpstack.h index 2ad195f2f..0408bcbf7 100644 --- a/libbitdht/src/udp/udpstack.h +++ b/libbitdht/src/udp/udpstack.h @@ -2,7 +2,7 @@ #define BITDHT_UDP_STACK_RECEIVER_H /* - * bitdht/udpstack.h + * udp/udpstack.h * * BitDHT: An Flexible DHT library. * @@ -27,9 +27,8 @@ */ -#include - #include "util/bdthreads.h" +#include "util/bdnet.h" #include #include @@ -38,7 +37,7 @@ #include #include -#include "udplayer.h" +#include "udp/udplayer.h" /* UdpStackReceiver is a Generic Receiver of info from a UdpLayer class. * it provides a UdpReceiver class, and accepts a stack of UdpReceivers, diff --git a/libbitdht/src/util/bdnet.cc b/libbitdht/src/util/bdnet.cc new file mode 100644 index 000000000..515ec7fcb --- /dev/null +++ b/libbitdht/src/util/bdnet.cc @@ -0,0 +1,346 @@ + +/* + * util/bdnet.cc + * + * BitDHT: An Flexible DHT library. + * + * Copyright 2010 by Robert Fernie + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 3 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "bitdht@lunamutt.com". + * + */ + +#include "bdnet.h" + +#include +#include +#include + +/********************************** WINDOWS/UNIX SPECIFIC PART ******************/ +#if defined(_WIN32) || defined(__MINGW32__) + + +/* error handling */ +int bdnet_int_errno; + +int bdnet_errno() +{ + return bdnet_int_errno; +} + +int bdnet_init() +{ + std::cerr << "bdnet_init()" << std::endl; + bdnet_int_errno = 0; + + // Windows Networking Init. + WORD wVerReq = MAKEWORD(2,2); + WSADATA wsaData; + + if (0 != WSAStartup(wVerReq, &wsaData)) + { + std::cerr << "Failed to Startup Windows Networking"; + std::cerr << std::endl; + } + else + { + std::cerr << "Started Windows Networking"; + std::cerr << std::endl; + } + + return 0; +} + +/* check if we can modify the TTL on a UDP packet */ +int bdnet_checkTTL(int fd) +{ + std::cerr << "bdnet_checkTTL()" << std::endl; + int optlen = 4; + char optval[optlen]; + + int ret = getsockopt(fd, IPPROTO_IP, IP_TTL, optval, &optlen); + //int ret = getsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, optval, &optlen); + if (ret == SOCKET_ERROR) + { + ret = -1; + bdnet_int_errno = bdnet_w2u_errno(WSAGetLastError()); + std::cerr << "bdnet_checkTTL() Failed!"; + std::cerr << std::endl; + } + else + { + std::cerr << "bdnet_checkTTL() :"; + std::cerr << (int) optval[0] << ":"; + std::cerr << (int) optval[1] << ":"; + std::cerr << (int) optval[2] << ":"; + std::cerr << (int) optval[3] << ": RET: "; + std::cerr << ret << ":"; + std::cerr << std::endl; + } + return ret; +} + +int bdnet_close(int fd) +{ + std::cerr << "bdnet_close()" << std::endl; + return closesocket(fd); +} + +int bdnet_socket(int domain, int type, int protocol) +{ + int osock = socket(domain, type, protocol); + std::cerr << "bdnet_socket()" << std::endl; + + if ((unsigned) osock == INVALID_SOCKET) + { + // Invalidate socket Unix style. + osock = -1; + bdnet_int_errno = bdnet_w2u_errno(WSAGetLastError()); + } + bdnet_checkTTL(osock); + return osock; +} + +int bdnet_bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen) +{ + std::cerr << "bdnet_bind()" << std::endl; + int ret = bind(sockfd,my_addr,addrlen); + if (ret != 0) + { + /* store unix-style error + */ + + ret = -1; + bdnet_int_errno = bdnet_w2u_errno(WSAGetLastError()); + } + return ret; +} + +int bdnet_fcntl(int fd, int cmd, long arg) +{ + int ret; + + unsigned long int on = 1; + std::cerr << "bdnet_fcntl()" << std::endl; + + /* can only do NONBLOCK at the moment */ + if ((cmd != F_SETFL) || (arg != O_NONBLOCK)) + { + std::cerr << "bdnet_fcntl() limited to fcntl(fd, F_SETFL, O_NONBLOCK)"; + std::cerr << std::endl; + bdnet_int_errno = EOPNOTSUPP; + return -1; + } + + ret = ioctlsocket(fd, FIONBIO, &on); + + if (ret != 0) + { + /* store unix-style error + */ + + ret = -1; + bdnet_int_errno = bdnet_w2u_errno(WSAGetLastError()); + } + return ret; +} + +int bdnet_setsockopt(int s, int level, int optname, + const void *optval, socklen_t optlen) +{ + std::cerr << "bdnet_setsockopt() val:" << *((int *) optval) << std::endl; + std::cerr << "bdnet_setsockopt() len:" << optlen << std::endl; + if ((level != IPPROTO_IP) || (optname != IP_TTL)) + { + std::cerr << "bdnet_setsockopt() limited to "; + std::cerr << "setsockopt(fd, IPPROTO_IP, IP_TTL, ....)"; + std::cerr << std::endl; + bdnet_int_errno = EOPNOTSUPP; + return -1; + } + + int ret = setsockopt(s, level, optname, (const char *) optval, optlen); + //int ret = setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, (const char *) optval, optlen); + if (ret == SOCKET_ERROR) + { + ret = -1; + bdnet_int_errno = bdnet_w2u_errno(WSAGetLastError()); + } + bdnet_checkTTL(s); + return ret; +} + +ssize_t bdnet_recvfrom(int s, void *buf, size_t len, int flags, + struct sockaddr *from, socklen_t *fromlen) +{ + std::cerr << "bdnet_recvfrom()" << std::endl; + int ret = recvfrom(s, (char *) buf, len, flags, from, fromlen); + if (ret == SOCKET_ERROR) + { + ret = -1; + bdnet_int_errno = bdnet_w2u_errno(WSAGetLastError()); + } + return ret; +} + +ssize_t bdnet_sendto(int s, const void *buf, size_t len, int flags, + const struct sockaddr *to, socklen_t tolen) +{ + std::cerr << "bdnet_sendto()" << std::endl; + int ret = sendto(s, (const char *) buf, len, flags, to, tolen); + if (ret == SOCKET_ERROR) + { + ret = -1; + bdnet_int_errno = bdnet_w2u_errno(WSAGetLastError()); + } + return ret; +} + +int bdnet_w2u_errno(int err) +{ + /* switch */ + std::cerr << "tou_net_w2u_errno(" << err << ")" << std::endl; + switch(err) + { + case WSAEINPROGRESS: + return EINPROGRESS; + break; + case WSAEWOULDBLOCK: + return EINPROGRESS; + break; + case WSAENETUNREACH: + return ENETUNREACH; + break; + case WSAETIMEDOUT: + return ETIMEDOUT; + break; + case WSAEHOSTDOWN: + return EHOSTDOWN; + break; + case WSAECONNREFUSED: + return ECONNREFUSED; + break; + case WSAEADDRINUSE: + return EADDRINUSE; + break; + case WSAEUSERS: + return EUSERS; + break; + /* This one is returned for UDP recvfrom, when nothing there + * but not a real error... translate into EINPROGRESS + */ + case WSAECONNRESET: + std::cerr << "tou_net_w2u_errno(" << err << ")"; + std::cerr << " = WSAECONNRESET ---> EINPROGRESS"; + std::cerr << std::endl; + return EINPROGRESS; + break; + /*** + * + case WSAECONNRESET: + return ECONNRESET; + break; + * + ***/ + + default: + std::cerr << "tou_net_w2u_errno(" << err << ") Unknown"; + std::cerr << std::endl; + break; + } + + return ECONNREFUSED; /* sensible default? */ +} + +int bdnet_inet_aton(const char *name, struct in_addr *addr) +{ + return (((*addr).s_addr = inet_addr(name)) != INADDR_NONE); +} + + + +void sleep(int sec) +{ + Sleep(sec * 1000); +} + +void usleep(int usec) +{ + Sleep(usec / 1000); +} + +/********************************** WINDOWS/UNIX SPECIFIC PART ******************/ +#else // UNIX + +/* Unix Version is easy -> just call the unix fn + */ + +#include /* for close definition */ + +/* the universal interface */ +int bdnet_init() { return 0; } +int bdnet_errno() { return errno; } + + +/* check if we can modify the TTL on a UDP packet */ +int bdnet_checkTTL(int fd) { return 1;} + + +int bdnet_inet_aton(const char *name, struct in_addr *addr) +{ + return inet_aton(name, addr); +} + +int bdnet_close(int fd) { return close(fd); } + +int bdnet_socket(int domain, int type, int protocol) +{ + return socket(domain, type, protocol); +} + +int bdnet_bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen) +{ + return bind(sockfd,my_addr,addrlen); +} + +int bdnet_fcntl(int fd, int cmd, long arg) +{ + return fcntl(fd, cmd, arg); +} + +int bdnet_setsockopt(int s, int level, int optname, + const void *optval, socklen_t optlen) +{ + return setsockopt(s, level, optname, optval, optlen); +} + +ssize_t bdnet_recvfrom(int s, void *buf, size_t len, int flags, + struct sockaddr *from, socklen_t *fromlen) +{ + return recvfrom(s, buf, len, flags, from, fromlen); +} + +ssize_t bdnet_sendto(int s, const void *buf, size_t len, int flags, + const struct sockaddr *to, socklen_t tolen) +{ + return sendto(s, buf, len, flags, to, tolen); +} + + +#endif +/********************************** WINDOWS/UNIX SPECIFIC PART ******************/ + diff --git a/libbitdht/src/util/bdnet.h b/libbitdht/src/util/bdnet.h new file mode 100644 index 000000000..1fbf18654 --- /dev/null +++ b/libbitdht/src/util/bdnet.h @@ -0,0 +1,171 @@ +#ifndef BITDHT_UNIVERSAL_NETWORK_HEADER +#define BITDHT_UNIVERSAL_NETWORK_HEADER +/* + * + * util/bdnet.h + * + * BitDHT: An Flexible DHT library. + * + * Copyright 2004-2010 by Robert Fernie + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License Version 3 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA. + * + * Please report all bugs and problems to "bitdht@lunamutt.com". + * + */ + +#include + +/********************************** WINDOWS/UNIX SPECIFIC PART ******************/ +#if defined(_WIN32) || defined(__MINGW32__) + +#include +#include +#include + +#include /* for ssize_t */ +typedef uint32_t in_addr_t; + +#else // UNIX + +#include +#include +#include +#include + +#include +#include + +#endif +/********************************** WINDOWS/UNIX SPECIFIC PART ******************/ + + + +/* C Interface */ +#ifdef __cplusplus +extern "C" { +#endif + +/******* + * This defines a (unix-like) universal networking layer + * that should function on both windows and unix. (C - interface) + * + * This is of course only a subset of the full interface. + * functions required are: + * + * int bdnet_close(int fd); + * int bdnet_socket(int domain, int type, int protocol); + * int bdnet_bind(int sockfd, const struct sockaddr *my_addr, + * socklen_t addrlen); + * int bdnet_fcntl(int fd, int cmd, long arg); + * int bdnet_setsockopt(int s, int level, int optname, + * const void *optval, socklen_t optlen); + * ssize_t bdnet_recvfrom(int s, void *buf, size_t len, int flags, + * struct sockaddr *from, socklen_t *fromlen); + * ssize_t bdnet_sendto(int s, const void *buf, size_t len, int flags, + * const struct sockaddr *to, socklen_t tolen); + * + * There are some non-standard ones as well: + * int bdnet_errno(); for internal networking errors + * int bdnet_init(); required for windows + * int bdnet_checkTTL(); a check if we can modify the ttl + */ + + +/* the universal interface */ +int bdnet_errno(); /* for internal networking errors */ +int bdnet_init(); /* required for windows */ +int bdnet_close(int fd); +int bdnet_socket(int domain, int type, int protocol); +int bdnet_bind(int sockfd, const struct sockaddr *my_addr, socklen_t addrlen); +int bdnet_fcntl(int fd, int cmd, long arg); +int bdnet_setsockopt(int s, int level, int optname, + const void *optval, socklen_t optlen); +ssize_t bdnet_recvfrom(int s, void *buf, size_t len, int flags, + struct sockaddr *from, socklen_t *fromlen); +ssize_t bdnet_sendto(int s, const void *buf, size_t len, int flags, + const struct sockaddr *to, socklen_t tolen); + +/* address filling */ +int bdnet_inet_aton(const char *name, struct in_addr *addr); +/* check if we can modify the TTL on a UDP packet */ +int bdnet_checkTTL(int fd); + + + +/* Extra stuff to declare for windows error handling (mimics unix errno) + */ + +/********************************** WINDOWS/UNIX SPECIFIC PART ******************/ +#if defined(_WIN32) || defined(__MINGW32__) + +// Some Network functions that are missing from windows. +//in_addr_t inet_netof(struct in_addr addr); +//in_addr_t inet_network(char *inet_name); +//int inet_aton(const char *name, struct in_addr *addr); + + +// definitions for fcntl (NON_BLOCK) (random?) +#define F_SETFL 0x1010 +#define O_NONBLOCK 0x0100 + +// definitions for setsockopt (TTL) (random?) +//#define IPPROTO_IP 0x0011 +//#define IP_TTL 0x0110 + +/* define the Unix Error Codes that we use... + * NB. we should make the same, but not necessary + */ + +#define EAGAIN 11 +#define EWOULDBLOCK EAGAIN + +#define EUSERS 87 +#define ENOTSOCK 88 + +#define EOPNOTSUPP 95 + +#define EADDRINUSE 98 +#define EADDRNOTAVAIL 99 +#define ENETDOWN 100 +#define ENETUNREACH 101 + +#define ECONNRESET 104 + +#define ETIMEDOUT 110 +#define ECONNREFUSED 111 +#define EHOSTDOWN 112 +#define EHOSTUNREACH 113 +#define EALREADY 114 +#define EINPROGRESS 115 + +int bdnet_w2u_errno(int error); + +/* also put the sleep commands in here (where else to go) + * ms uses millisecs. + * void Sleep(int ms); + */ +void sleep(int sec); +//void usleep(int usec); + +#endif // END of WINDOWS defines. +/********************************** WINDOWS/UNIX SPECIFIC PART ******************/ + + +#ifdef __cplusplus +} /* C Interface */ +#endif + +#endif /* BITDHT_UNIVERSAL_NETWORK_HEADER */ diff --git a/libbitdht/src/util/bdthreads.cc b/libbitdht/src/util/bdthreads.cc index 5b5846e93..2f008cca4 100644 --- a/libbitdht/src/util/bdthreads.cc +++ b/libbitdht/src/util/bdthreads.cc @@ -1,9 +1,9 @@ /* - * bitdht/bdthreads.cc + * util/bdthreads.cc * * BitDHT: An Flexible DHT library. * - * Copyright 2010 by Robert Fernie + * Copyright 2004-2010 by Robert Fernie * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff --git a/libbitdht/src/util/bdthreads.h b/libbitdht/src/util/bdthreads.h index 0bea68a96..f6be517e4 100644 --- a/libbitdht/src/util/bdthreads.h +++ b/libbitdht/src/util/bdthreads.h @@ -2,11 +2,11 @@ #define BITDHT_THREADS_H /* - * bitdht/bdthreads.h + * util/bdthreads.h * * BitDHT: An Flexible DHT library. * - * Copyright 2010 by Robert Fernie + * Copyright 2004-2010 by Robert Fernie * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public