From f0baf977fa55aedc8549b4fe24cbfe28f9eb4db2 Mon Sep 17 00:00:00 2001 From: Cthulhu-throwaway <96153783+Cthulhu-throwaway@users.noreply.github.com> Date: Wed, 18 May 2022 23:23:40 -0300 Subject: [PATCH] (Network) Move natt files to "network" --- Makefile.common | 2 +- griffin/griffin.c | 2 +- .../net/net_natt.c => network/natt.c | 31 ++++++-------- .../include/net/net_natt.h => network/natt.h | 42 +++++++------------ network/netplay/netplay.h | 3 +- .../project.pbxproj | 2 - .../RetroArch_iOS13.xcodeproj/project.pbxproj | 2 - tasks/task_netplay_nat_traversal.c | 2 +- 8 files changed, 33 insertions(+), 53 deletions(-) rename libretro-common/net/net_natt.c => network/natt.c (93%) rename libretro-common/include/net/net_natt.h => network/natt.h (73%) diff --git a/Makefile.common b/Makefile.common index 908d9b1688..e36ac0f151 100644 --- a/Makefile.common +++ b/Makefile.common @@ -2108,8 +2108,8 @@ ifeq ($(HAVE_NETWORKING), 1) $(LIBRETRO_COMM_DIR)/net/net_http.o \ $(LIBRETRO_COMM_DIR)/net/net_http_parse.o \ $(LIBRETRO_COMM_DIR)/net/net_socket.o \ - $(LIBRETRO_COMM_DIR)/net/net_natt.o \ core_updater_list.o \ + network/natt.o \ network/net_http_special.o \ tasks/task_http.o \ tasks/task_netplay_lan_scan.o \ diff --git a/griffin/griffin.c b/griffin/griffin.c index 3a8c36fa2a..832ad3ee37 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -1330,12 +1330,12 @@ THREAD NETPLAY ============================================================ */ #ifdef HAVE_NETWORKING +#include "../network/natt.c" #include "../network/netplay/netplay_frontend.c" #include "../network/netplay/netplay_room_parse.c" #include "../libretro-common/net/net_compat.c" #include "../libretro-common/net/net_socket.c" #include "../libretro-common/net/net_http.c" -#include "../libretro-common/net/net_natt.c" #if !defined(HAVE_SOCKET_LEGACY) #include "../libretro-common/net/net_ifinfo.c" #endif diff --git a/libretro-common/net/net_natt.c b/network/natt.c similarity index 93% rename from libretro-common/net/net_natt.c rename to network/natt.c index 236074dfb4..cf5be9ebfd 100644 --- a/libretro-common/net/net_natt.c +++ b/network/natt.c @@ -1,23 +1,16 @@ -/* Copyright (C) 2016-2022 The RetroArch team +/* RetroArch - A frontend for libretro. + * Copyright (C) 2021-2022 - Roberto V. Rampim * - * --------------------------------------------------------------------------------------- - * The following license statement only applies to this file (net_natt.c). - * --------------------------------------------------------------------------------------- + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. * - * Permission is hereby granted, free of charge, - * to any person obtaining a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * RetroArch 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 General Public License for more details. * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . */ #include @@ -33,9 +26,9 @@ #include #endif -#include "../../tasks/tasks_internal.h" +#include "../tasks/tasks_internal.h" -#include +#include "natt.h" static bool translate_addr(struct sockaddr_in *addr, char *host, size_t hostlen, char *port, size_t portlen) diff --git a/libretro-common/include/net/net_natt.h b/network/natt.h similarity index 73% rename from libretro-common/include/net/net_natt.h rename to network/natt.h index 2de5d4b114..c839154279 100644 --- a/libretro-common/include/net/net_natt.h +++ b/network/natt.h @@ -1,35 +1,27 @@ -/* Copyright (C) 2010-2022 The RetroArch team +/* RetroArch - A frontend for libretro. + * Copyright (C) 2021-2022 - Roberto V. Rampim * - * --------------------------------------------------------------------------------------- - * The following license statement only applies to this file (net_natt.h). - * --------------------------------------------------------------------------------------- + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. * - * Permission is hereby granted, free of charge, - * to any person obtaining a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * RetroArch 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 General Public License for more details. * - * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . */ -#ifndef _LIBRETRO_SDK_NET_NATT_H -#define _LIBRETRO_SDK_NET_NATT_H +#ifndef __RARCH_NATT_H +#define __RARCH_NATT_H + +#include +#include #include #include -#include - -RETRO_BEGIN_DECLS - enum natt_forward_type { NATT_FORWARD_TYPE_NONE, @@ -182,6 +174,4 @@ bool natt_open_port(struct natt_device *device, bool natt_close_port(struct natt_device *device, struct natt_request *request, bool block); -RETRO_END_DECLS - -#endif +#endif /* __RARCH_NATT_H */ diff --git a/network/netplay/netplay.h b/network/netplay/netplay.h index 93cc3888fd..130fe0373f 100644 --- a/network/netplay/netplay.h +++ b/network/netplay/netplay.h @@ -31,11 +31,12 @@ #include #include -#include #include #include "../../core.h" +#include "../natt.h" + #include "netplay_protocol.h" #define NETPLAY_NICK_LEN 32 diff --git a/pkg/apple/RetroArch_iOS11_Metal.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS11_Metal.xcodeproj/project.pbxproj index cfecb6cb11..9d234f84a0 100644 --- a/pkg/apple/RetroArch_iOS11_Metal.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS11_Metal.xcodeproj/project.pbxproj @@ -142,7 +142,6 @@ 92B9EB7A24E0518700E6CFB2 /* net_ifinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_ifinfo.h; sourceTree = ""; }; 92B9EB7B24E0518700E6CFB2 /* net_compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_compat.h; sourceTree = ""; }; 92B9EB7C24E0518700E6CFB2 /* net_socket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_socket.h; sourceTree = ""; }; - 92B9EB7D24E0518700E6CFB2 /* net_natt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_natt.h; sourceTree = ""; }; 92B9EB7E24E0518700E6CFB2 /* net_socket_ssl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_socket_ssl.h; sourceTree = ""; }; 92B9EB7F24E0518700E6CFB2 /* net_http.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_http.h; sourceTree = ""; }; 92B9EB8024E0518700E6CFB2 /* net_http_parse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_http_parse.h; sourceTree = ""; }; @@ -571,7 +570,6 @@ 92B9EB7A24E0518700E6CFB2 /* net_ifinfo.h */, 92B9EB7B24E0518700E6CFB2 /* net_compat.h */, 92B9EB7C24E0518700E6CFB2 /* net_socket.h */, - 92B9EB7D24E0518700E6CFB2 /* net_natt.h */, 92B9EB7E24E0518700E6CFB2 /* net_socket_ssl.h */, 92B9EB7F24E0518700E6CFB2 /* net_http.h */, 92B9EB8024E0518700E6CFB2 /* net_http_parse.h */, diff --git a/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj index 6946e3c450..25cb58961a 100644 --- a/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_iOS13.xcodeproj/project.pbxproj @@ -170,7 +170,6 @@ 92B9EB7A24E0518700E6CFB2 /* net_ifinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_ifinfo.h; sourceTree = ""; }; 92B9EB7B24E0518700E6CFB2 /* net_compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_compat.h; sourceTree = ""; }; 92B9EB7C24E0518700E6CFB2 /* net_socket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_socket.h; sourceTree = ""; }; - 92B9EB7D24E0518700E6CFB2 /* net_natt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_natt.h; sourceTree = ""; }; 92B9EB7E24E0518700E6CFB2 /* net_socket_ssl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_socket_ssl.h; sourceTree = ""; }; 92B9EB7F24E0518700E6CFB2 /* net_http.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_http.h; sourceTree = ""; }; 92B9EB8024E0518700E6CFB2 /* net_http_parse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = net_http_parse.h; sourceTree = ""; }; @@ -637,7 +636,6 @@ 92B9EB7A24E0518700E6CFB2 /* net_ifinfo.h */, 92B9EB7B24E0518700E6CFB2 /* net_compat.h */, 92B9EB7C24E0518700E6CFB2 /* net_socket.h */, - 92B9EB7D24E0518700E6CFB2 /* net_natt.h */, 92B9EB7E24E0518700E6CFB2 /* net_socket_ssl.h */, 92B9EB7F24E0518700E6CFB2 /* net_http.h */, 92B9EB8024E0518700E6CFB2 /* net_http_parse.h */, diff --git a/tasks/task_netplay_nat_traversal.c b/tasks/task_netplay_nat_traversal.c index 1aebbb2815..c7af1dcf92 100644 --- a/tasks/task_netplay_nat_traversal.c +++ b/tasks/task_netplay_nat_traversal.c @@ -30,7 +30,7 @@ #include #endif -#include +#include "../network/natt.h" #include "../network/netplay/netplay.h" /* Find the most suitable address within the device's network. */