Skip to content
Permalink
Browse files

Merge pull request #1995 from Ziek/master

Added Enet and move traversal code from old netplay branch
  • Loading branch information...
skidau committed Feb 26, 2015
2 parents f71f376 + 779f275 commit b1830edaff04360550644d0de2382ff39f561b3c
Showing with 12,832 additions and 595 deletions.
  1. +7 −0 CMakeLists.txt
  2. +57 −0 Externals/enet/CMakeLists.txt
  3. +171 −0 Externals/enet/ChangeLog
  4. +2,303 −0 Externals/enet/Doxyfile
  5. +191 −0 Externals/enet/DoxygenLayout.xml
  6. +7 −0 Externals/enet/LICENSE
  7. +22 −0 Externals/enet/Makefile.am
  8. +15 −0 Externals/enet/README
  9. +53 −0 Externals/enet/callbacks.c
  10. +654 −0 Externals/enet/compress.c
  11. +26 −0 Externals/enet/configure.ac
  12. +24 −0 Externals/enet/docs/FAQ.dox
  13. +126 −0 Externals/enet/docs/design.dox
  14. +63 −0 Externals/enet/docs/install.dox
  15. +26 −0 Externals/enet/docs/license.dox
  16. +59 −0 Externals/enet/docs/mainpage.dox
  17. +366 −0 Externals/enet/docs/tutorial.dox
  18. +168 −0 Externals/enet/enet.dsp
  19. +87 −0 Externals/enet/enet.vcxproj
  20. +55 −0 Externals/enet/enet.vcxproj.filters
  21. +86 −0 Externals/enet/enet_dll.cbp
  22. +492 −0 Externals/enet/host.c
  23. +27 −0 Externals/enet/include/enet/callbacks.h
  24. +592 −0 Externals/enet/include/enet/enet.h
  25. +43 −0 Externals/enet/include/enet/list.h
  26. +198 −0 Externals/enet/include/enet/protocol.h
  27. +18 −0 Externals/enet/include/enet/time.h
  28. +13 −0 Externals/enet/include/enet/types.h
  29. +47 −0 Externals/enet/include/enet/unix.h
  30. +12 −0 Externals/enet/include/enet/utility.h
  31. +57 −0 Externals/enet/include/enet/win32.h
  32. +10 −0 Externals/enet/libenet.pc.in
  33. +75 −0 Externals/enet/list.c
  34. 0 Externals/enet/m4/.keep
  35. +165 −0 Externals/enet/packet.c
  36. +1,004 −0 Externals/enet/peer.c
  37. +59 −0 Externals/enet/premake4.lua
  38. +1,909 −0 Externals/enet/protocol.c
  39. +557 −0 Externals/enet/unix.c
  40. +422 −0 Externals/enet/win32.c
  41. +3 −1 Source/Core/Common/CMakeLists.txt
  42. +4 −1 Source/Core/Common/Common.vcxproj
  43. +6 −1 Source/Core/Common/Common.vcxproj.filters
  44. +356 −0 Source/Core/Common/TraversalClient.cpp
  45. +81 −0 Source/Core/Common/TraversalClient.h
  46. +96 −0 Source/Core/Common/TraversalProto.h
  47. +458 −0 Source/Core/Common/TraversalServer.cpp
  48. +1 −0 Source/Core/Core/CMakeLists.txt
  49. +3 −0 Source/Core/Core/Core.vcxproj
  50. +1 −1 Source/Core/Core/Movie.cpp
  51. +454 −231 Source/Core/Core/NetPlayClient.cpp
  52. +34 −12 Source/Core/Core/NetPlayClient.h
  53. +19 −20 Source/Core/Core/NetPlayProto.h
  54. +377 −190 Source/Core/Core/NetPlayServer.cpp
  55. +26 −25 Source/Core/Core/NetPlayServer.h
  56. +388 −98 Source/Core/DolphinWX/NetWindow.cpp
  57. +33 −14 Source/Core/DolphinWX/NetWindow.h
  58. +226 −1 Source/dolphin-emu.sln
@@ -535,6 +535,13 @@ include_directories(Source/Core)
add_subdirectory(Externals/Bochs_disasm)
include_directories(Externals/Bochs_disasm)

if(NOT ENET_FOUND)
message("Using static enet from Externals")
include_directories(Externals)
add_subdirectory(Externals/enet)
endif()
LIST(APPEND LIBS enet)

if(NOT XXHASH_FOUND)
message("Using static xxhash from Externals")
add_subdirectory(Externals/xxhash)
@@ -0,0 +1,57 @@
cmake_minimum_required(VERSION 2.6)

project(enet)

# The "configure" step.
include(CheckFunctionExists)
include(CheckStructHasMember)
include(CheckTypeSize)
check_function_exists("fcntl" HAS_FCNTL)
check_function_exists("poll" HAS_POLL)
check_function_exists("gethostbyname_r" HAS_GETHOSTBYNAME_R)
check_function_exists("gethostbyaddr_r" HAS_GETHOSTBYADDR_R)
check_function_exists("inet_pton" HAS_INET_PTON)
check_function_exists("inet_ntop" HAS_INET_NTOP)
check_struct_has_member("struct msghdr" "msg_flags" "sys/types.h;sys/socket.h" HAS_MSGHDR_FLAGS)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h" "sys/socket.h")
check_type_size("socklen_t" HAS_SOCKLEN_T BUILTIN_TYPES_ONLY)
unset(CMAKE_EXTRA_INCLUDE_FILES)

if(HAS_FCNTL)
add_definitions(-DHAS_FCNTL=1)
endif()
if(HAS_POLL)
add_definitions(-DHAS_POLL=1)
endif()
if(HAS_GETHOSTBYNAME_R)
add_definitions(-DHAS_GETHOSTBYNAME_R=1)
endif()
if(HAS_GETHOSTBYADDR_R)
add_definitions(-DHAS_GETHOSTBYADDR_R=1)
endif()
if(HAS_INET_PTON)
add_definitions(-DHAS_INET_PTON=1)
endif()
if(HAS_INET_NTOP)
add_definitions(-DHAS_INET_NTOP=1)
endif()
if(HAS_MSGHDR_FLAGS)
add_definitions(-DHAS_MSGHDR_FLAGS=1)
endif()
if(HAS_SOCKLEN_T)
add_definitions(-DHAS_SOCKLEN_T=1)
endif()

include_directories(${PROJECT_SOURCE_DIR}/include)

add_library(enet STATIC
callbacks.c
compress.c
host.c
list.c
packet.c
peer.c
protocol.c
unix.c
win32.c
)
@@ -0,0 +1,171 @@
ENet 1.3.12 (April 24, 2014):

* added maximumPacketSize and maximumWaitingData fields to ENetHost to limit the amount of
data waiting to be delivered on a peer (beware that the default maximumPacketSize is
32MB and should be set higher if desired as should maximumWaitingData)

ENet 1.3.11 (December 26, 2013):

* allow an ENetHost to connect to itself
* fixed possible bug with disconnect notifications during connect attempts
* fixed some preprocessor definition bugs

ENet 1.3.10 (October 23, 2013);

* doubled maximum reliable window size
* fixed RCVTIMEO/SNDTIMEO socket options and also added NODELAY

ENet 1.3.9 (August 19, 2013):

* added duplicatePeers option to ENetHost which can limit the number of peers from duplicate IPs
* added enet_socket_get_option() and ENET_SOCKOPT_ERROR
* added enet_host_random_seed() platform stub

ENet 1.3.8 (June 2, 2013):

* added enet_linked_version() for checking the linked version
* added enet_socket_get_address() for querying the local address of a socket
* silenced some debugging prints unless ENET_DEBUG is defined during compilation
* handle EINTR in enet_socket_wait() so that enet_host_service() doesn't propagate errors from signals
* optimized enet_host_bandwidth_throttle() to be less expensive for large numbers of peers

ENet 1.3.7 (March 6, 2013):

* added ENET_PACKET_FLAG_SENT to indicate that a packet is being freed because it has been sent
* added userData field to ENetPacket
* changed how random seed is generated on Windows to avoid import warnings
* fixed case where disconnects could be generated with no preceding connect event

ENet 1.3.6 (December 11, 2012):

* added support for intercept callback in ENetHost that can be used to process raw packets before ENet
* added enet_socket_shutdown() for issuing shutdown on a socket
* fixed enet_socket_connect() to not error on non-blocking connects
* fixed bug in MTU negotiation during connections

ENet 1.3.5 (July 31, 2012):

* fixed bug in unreliable packet fragment queuing

ENet 1.3.4 (May 29, 2012):

* added enet_peer_ping_interval() for configuring per-peer ping intervals
* added enet_peer_timeout() for configuring per-peer timeouts
* added protocol packet size limits

ENet 1.3.3 (June 28, 2011):

* fixed bug with simultaneous disconnects not dispatching events

ENet 1.3.2 (May 31, 2011):

* added support for unreliable packet fragmenting via the packet flag
ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT
* fixed regression in unreliable packet queuing
* added check against received port to limit some forms of IP-spoofing

ENet 1.3.1 (February 10, 2011):

* fixed bug in tracking of reliable data in transit
* reliable data window size now scales with the throttle
* fixed bug in fragment length calculation when checksums are used

ENet 1.3.0 (June 5, 2010):

* enet_host_create() now requires the channel limit to be specified as
a parameter
* enet_host_connect() now accepts a data parameter which is supplied
to the receiving receiving host in the event data field for a connect event
* added an adaptive order-2 PPM range coder as a built-in compressor option
which can be set with enet_host_compress_with_range_coder()
* added support for packet compression configurable with a callback
* improved session number handling to not rely on the packet checksum
field, saving 4 bytes per packet unless the checksum option is used
* removed the dependence on the rand callback for session number handling

Caveats: This version is not protocol compatible with the 1.2 series or
earlier. The enet_host_connect and enet_host_create API functions require
supplying additional parameters.

ENet 1.2.5 (June 28, 2011):

* fixed bug with simultaneous disconnects not dispatching events

ENet 1.2.4 (May 31, 2011):

* fixed regression in unreliable packet queuing
* added check against received port to limit some forms of IP-spoofing

ENet 1.2.3 (February 10, 2011):

* fixed bug in tracking reliable data in transit

ENet 1.2.2 (June 5, 2010):

* checksum functionality is now enabled by setting a checksum callback
inside ENetHost instead of being a configure script option
* added totalSentData, totalSentPackets, totalReceivedData, and
totalReceivedPackets counters inside ENetHost for getting usage
statistics
* added enet_host_channel_limit() for limiting the maximum number of
channels allowed by connected peers
* now uses dispatch queues for event dispatch rather than potentially
unscalable array walking
* added no_memory callback that is called when a malloc attempt fails,
such that if no_memory returns rather than aborts (the default behavior),
then the error is propagated to the return value of the API calls
* now uses packed attribute for protocol structures on platforms with
strange alignment rules
* improved autoconf build system contributed by Nathan Brink allowing
for easier building as a shared library

Caveats: If you were using the compile-time option that enabled checksums,
make sure to set the checksum callback inside ENetHost to enet_crc32 to
regain the old behavior. The ENetCallbacks structure has added new fields,
so make sure to clear the structure to zero before use if
using enet_initialize_with_callbacks().

ENet 1.2.1 (November 12, 2009):

* fixed bug that could cause disconnect events to be dropped
* added thin wrapper around select() for portable usage
* added ENET_SOCKOPT_REUSEADDR socket option
* factored enet_socket_bind()/enet_socket_listen() out of enet_socket_create()
* added contributed Code::Blocks build file

ENet 1.2 (February 12, 2008):

* fixed bug in VERIFY_CONNECT acknowledgement that could cause connect
attempts to occasionally timeout
* fixed acknowledgements to check both the outgoing and sent queues
when removing acknowledged packets
* fixed accidental bit rot in the MSVC project file
* revised sequence number overflow handling to address some possible
disconnect bugs
* added enet_host_check_events() for getting only local queued events
* factored out socket option setting into enet_socket_set_option() so
that socket options are now set separately from enet_socket_create()

Caveats: While this release is superficially protocol compatible with 1.1,
differences in the sequence number overflow handling can potentially cause
random disconnects.

ENet 1.1 (June 6, 2007):

* optional CRC32 just in case someone needs a stronger checksum than UDP
provides (--enable-crc32 configure option)
* the size of packet headers are half the size they used to be (so less
overhead when sending small packets)
* enet_peer_disconnect_later() that waits till all queued outgoing
packets get sent before issuing an actual disconnect
* freeCallback field in individual packets for notification of when a
packet is about to be freed
* ENET_PACKET_FLAG_NO_ALLOCATE for supplying pre-allocated data to a
packet (can be used in concert with freeCallback to support some custom
allocation schemes that the normal memory allocation callbacks would
normally not allow)
* enet_address_get_host_ip() for printing address numbers
* promoted the enet_socket_*() functions to be part of the API now
* a few stability/crash fixes


1 comment on commit b1830ed

Please sign in to comment.
You can’t perform that action at this time.