Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add port mapping for Slippi via UPnP or NAT-PMP #5

Open
wants to merge 5 commits into
base: slippi
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ add_subdirectory(Externals/semver)
include_directories(Externals/semver/include)
add_subdirectory(Externals/open-vcdiff)
add_subdirectory(Externals/spirv_cross)
add_subdirectory(Externals/libnatpmp)
include_directories(Externals)

if(ENABLE_VULKAN)
Expand Down
27 changes: 27 additions & 0 deletions Externals/libnatpmp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 2.8.12)

if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()

project(natpmp)

set (NATPMP_SOURCES
natpmp.c
getgateway.c
)

if (WIN32)
set (NATPMP_SOURCES ${NATPMP_SOURCES} wingettimeofday.c)
endif (WIN32)

# Library itself
add_library(natpmp STATIC ${NATPMP_SOURCES})
target_include_directories(natpmp PUBLIC ${CMAKE_CURRENT_LIST_DIR})
target_compile_definitions(natpmp PRIVATE -DENABLE_STRNATPMPERR)

if (WIN32)
target_link_libraries(natpmp PUBLIC ws2_32 Iphlpapi)
target_compile_definitions(natpmp PUBLIC -DNATPMP_STATICLIB)
endif (WIN32)
dolphin_disable_warnings_msvc(natpmp)
98 changes: 98 additions & 0 deletions Externals/libnatpmp/Changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
$Id: Changelog.txt,v 1.34 2023/04/23 10:46:11 nanard Exp $

2013/11/26:
enforce strict aliasing rules.

2013/09/10:
small patch for MSVC >= 16
rename win32 implementation of gettimeofday() to natpmp_gettimeofday()

2012/08/21:
Little change in Makefile
removed warnings in testgetgateway.c
Fixed bugs in command line argumentparsing in natpmpc.c

2011/08/07:
Patch to build on debian/kFreeBSD.

2011/07/15:
Put 3 clauses BSD licence at the top of source files.

2011/06/18:
--no-undefined => -Wl,--no-undefined
adding a natpmpc.1 man page

2011/05/19:
Small fix in libnatpmpmodule.c thanks to Manuel Mausz

2011/01/03:
Added an argument to initnatpmp() in order to force the gateway to be used

2011/01/01:
fix in make install

2010/05/21:
make install now working under MacOSX (and BSD)

2010/04/12:
cplusplus stuff in natpmp.h

2010/02/02:
Fixed compilation under Mac OS X

2009/12/19:
improve and fix building under Windows.
Project files for MS Visual Studio 2008
More simple (and working) code for Win32.
More checks in the /proc/net/route parsing. Add some comments.

2009/08/04:
improving getgateway.c for windows

2009/07/13:
Adding Haiku code in getgateway.c

2009/06/04:
Adding Python module thanks to David Wu

2009/03/10:
Trying to have windows get gateway working if not using DHCP

2009/02/27:
don't include declspec.h if not under WIN32.

2009/01/23:
Prefixed the libraries name with lib

2008/10/06:
Fixed a memory leak in getdefaultgateway() (USE_SYSCTL_NET_ROUTE)

2008/07/03:
Adding WIN32 code from Robbie Hanson

2008/06/30:
added a Solaris implementation for getgateway().
added a LICENCE file to the distribution

2008/05/29:
Anonymous unions are forbidden in ANSI C. That was causing problems with
non-GCC compilers.

2008/04/28:
introduced strnatpmperr()
improved natpmpc.c sample
make install now install the binary

2007/12/13:
Fixed getgateway.c for working under OS X ;)
Fixed values for NATPMP_PROTOCOL_TCP and NATPMP_PROTOCOL_UDP

2007/12/11:
Fixed getgateway.c for compilation under Mac OS X

2007/12/01:
added some comments in .h

2007/11/30:
implemented almost everything

29 changes: 29 additions & 0 deletions Externals/libnatpmp/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2007-2022, Thomas BERNARD
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 changes: 8 additions & 0 deletions Externals/libnatpmp/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
libnatpmp (c) 2007-2023 Thomas Bernard
contact : [email protected]

see http://miniupnp.free.fr/libnatpmp.html
or http://miniupnp.tuxfamily.org/libnatpmp.html
for some documentation and code samples.

github : https://github.com/miniupnp/libnatpmp
Loading
Loading