summaryrefslogtreecommitdiffstats
path: root/src/core/network (follow)
Commit message (Collapse)AuthorAgeFilesLines
* common: Move error handling to error.cpp/hMorph2021-09-111-2/+3
| | | | This allows us to avoid implicitly including <string> every time common_funcs.h is included.
* network_interface: Cleanup codeMorph2021-08-271-76/+83
|
* network_interface: Replace default return value with std::nulloptMorph2021-08-271-6/+6
|
* network_interface: correct formattingSönke Holz2021-08-161-1/+1
|
* network_interface: fix mingw-w64 buildspholz2021-08-161-1/+1
|
* network: retrieve subnet mask and gateway infoSönke Holz2021-08-164-16/+121
|
* network: don't use reinterpret_cast in GetAvailableNetworkInterfacesspholz2021-08-131-7/+4
|
* network: fix mingw-w64 buildSönke Holz2021-08-131-4/+4
| | | | The header "combaseapi.h" of mingw-w64 defines "interface" as "struct".
* network: don't use assert to check if no network interfaces are returnedSönke Holz2021-08-131-2/+4
|
* network: use Common::BitCast instead of std::bit_castSönke Holz2021-08-131-2/+3
|
* network: narrow down scope of "result" in win32 code forSönke Holz2021-08-131-4/+5
| | | | GetAvailableNetworkInterfaces
* network: use explicit bool conversions in GetAvailableNetworkInterfacesSönke Holz2021-08-131-1/+1
|
* network: initialize ip_addr in GetHostIPv4Address()Sönke Holz2021-08-131-1/+1
|
* network: correct formatting in network.cpp and network_interface.cppSönke Holz2021-08-122-8/+6
|
* configuration: add option to select network interfacespholz2021-08-124-22/+164
| | | | This commit renames the "Services" tab to "Network" and adds a combobox that allows the user to select the network interface that yuzu should use. This new setting is now used to get the local IP address in Network::GetHostIPv4Address. This prevents yuzu from selecting the wrong network interface and thus using the wrong IP address. The return type of Network::GetHostIPv4Adress has also been changed.
* network: GetAndLogLastError: ignore Errno::AGAINSönke Holz2021-08-071-1/+5
| | | | If non-blocking sockets are used, they generate a lot of Errno::AGAIN errors when they didn't receive any data. These errors shouldn't be logged.
* network: fix fcntl cmdsSönke Holz2021-08-061-2/+2
| | | | F_SETFL/F_GETFL are the correct commands to set a socket to be non-blocking
* network: fix ternary operator in Socket::SendTospholz2021-08-021-1/+1
|
* [network] Error handling reformcomex2021-02-282-95/+84
| | | | | | | | | | | | | | | | | | | | | `network.cpp` has several error paths which either: - report "Unhandled host socket error=n" and return `SUCCESS`, or - switch on a few possible errors, log them, and translate them to Errno; the same switch statement is copied and pasted in multiple places in the code Convert these paths to use a helper function `GetAndLogLastError`, which is roughly the equivalent of one of the switch statements, but: - handling more cases (both ones that were already in `Errno`, and a few more I added), and - using OS functions to convert the error to a string when logging, so it'll describe the error even if it's not one of the ones in the switch statement. - To handle this, refactor the logic in `GetLastErrorMsg` to expose a new function `NativeErrorToString` which takes the error number explicitly as an argument. And improve the Windows version a bit. Also, add a test which exercises two random error paths.
* Merge pull request #5142 from comex/xx-poll-eventsRodrigo Locatti2020-12-092-31/+37
|\ | | | | network, sockets: Replace `POLL_IN`, `POLL_OUT`, etc. constants with an `enum class PollEvents`
| * network, sockets: Replace `POLL_IN`, `POLL_OUT`, etc. constants with an `enum class PollEvents`comex2020-12-072-31/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Actually, two enum classes, since for some reason there are two separate yet identical `PollFD` types used in the codebase. I get that one is ABI-compatible with the Switch while the other is an abstract type used for the host, but why not use `WSAPOLLFD` directly for the latter? Anyway, why make this change? Because on Apple platforms, `POLL_IN`, `POLL_OUT`, etc. (with an underscore) are defined as macros in <sys/signal.h>. (This is inherited from FreeBSD.) So defining a variable with the same name causes a compile error. I could just rename the variables, but while I was at it I thought I might as well switch to an enum for stronger typing. Also, change the type used for values copied directly to/from the `events` and `revents` fields of the host *native* `pollfd`/`WSASPOLLFD`, from `u32` to `short`, as `short` is the correct canonical type on both Unix and Windows.
* | core: Remove unnecessary enum casts in log callsLioncash2020-12-081-6/+6
| | | | | | | | | | Follows the video core PR. fmt doesn't require casts for enum classes anymore, so we can remove quite a few casts.
* | CMakeLists,network: Create YUZU_UNIX macro to replace __unix__comex2020-12-072-5/+5
|/ | | | __unix__ is not predefined on Apple platforms even though they are Unix.
* core: Fix clang build pt.3Lioncash2020-10-221-1/+1
| | | | Should finally resolve building with clang.
* Revert "core: Fix clang build"bunnei2020-10-213-26/+23
|
* core: Fix clang buildLioncash2020-10-183-23/+26
| | | | | | | Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795
* core/CMakeLists: Make some warnings errorsLioncash2020-10-131-24/+24
| | | | | | | | | Makes our error coverage a little more consistent across the board by applying it to Linux side of things as well. This also makes it more consistent with the warning settings in other libraries in the project. This also updates httplib to 0.7.9, as there are several warning cleanups made that allow us to enable several warnings as errors.
* network: add missing include for BSDsJan Beich2020-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/core/network/network.cpp:112:28: error: use of undeclared identifier 'SHUT_RD' constexpr int SD_RECEIVE = SHUT_RD; ^ src/core/network/network.cpp:113:25: error: use of undeclared identifier 'SHUT_WR' constexpr int SD_SEND = SHUT_WR; ^ src/core/network/network.cpp:114:25: error: use of undeclared identifier 'SHUT_RDWR' constexpr int SD_BOTH = SHUT_RDWR; ^ src/core/network/network.cpp:120:37: error: unknown type name 'in_addr'; did you mean 'in_addr_t'? constexpr IPv4Address TranslateIPv4(in_addr addr) { ^~~~~~~ in_addr_t /usr/include/netdb.h:66:20: note: 'in_addr_t' declared here typedef __uint32_t in_addr_t; ^ src/core/network/network.cpp:121:27: error: member reference base type 'in_addr_t' (aka 'unsigned int') is not a structure or union const u32 bytes = addr.s_addr; ~~~~^~~~~~~ src/core/network/network.cpp:121:15: error: variables defined in a constexpr function must be initialized const u32 bytes = addr.s_addr; ^ src/core/network/network.cpp:126:10: error: incomplete result type 'sockaddr' in function definition sockaddr TranslateFromSockAddrIn(SockAddrIn input) { ^ /usr/include/netdb.h:142:9: note: forward declaration of 'sockaddr' struct sockaddr *ai_addr; /* binary address */ ^ src/core/network/network.cpp:127:5: error: unknown type name 'sockaddr_in'; did you mean 'sockaddr'? sockaddr_in result; ^~~~~~~~~~~ sockaddr /usr/include/netdb.h:142:9: note: 'sockaddr' declared here struct sockaddr *ai_addr; /* binary address */ ^ src/core/network/network.cpp:127:17: error: variable has incomplete type 'sockaddr' sockaddr_in result; ^ /usr/include/netdb.h:142:9: note: forward declaration of 'sockaddr' struct sockaddr *ai_addr; /* binary address */ ^ src/core/network/network.cpp:131:29: error: use of undeclared identifier 'AF_INET' result.sin_family = AF_INET; ^ src/core/network/network.cpp:135:29: error: use of undeclared identifier 'AF_INET' result.sin_family = AF_INET; ^ src/core/network/network.cpp:139:23: error: use of undeclared identifier 'htons' result.sin_port = htons(input.portno); ^ src/core/network/network.cpp:143:14: error: variable has incomplete type 'sockaddr' sockaddr addr; ^ /usr/include/netdb.h:142:9: note: forward declaration of 'sockaddr' struct sockaddr *ai_addr; /* binary address */ ^ src/core/network/network.cpp:156:1: error: unknown type name 'linger' linger MakeLinger(bool enable, u32 linger_value) { ^ src/core/network/network.cpp:157:5: error: unknown type name 'linger' linger value; ^ src/core/network/network.cpp:185:16: error: use of undeclared identifier 'AF_INET' return AF_INET; ^ src/core/network/network.cpp:195:16: error: use of undeclared identifier 'SOCK_STREAM' return SOCK_STREAM; ^ src/core/network/network.cpp:197:16: error: use of undeclared identifier 'SOCK_DGRAM' return SOCK_DGRAM; ^ src/core/network/network.cpp:207:16: error: use of undeclared identifier 'IPPROTO_TCP' return IPPROTO_TCP; ^ fatal error: too many errors emitted, stopping now [-ferror-limit=]
* core/network: Add network abstractionReinUsesLisp2020-07-193-0/+833
This commit adds a network abstraction designed to implement bsd:s but at the same time work as a generic abstraction to implement any networking code we have to use from core. This is implemented on top of BSD sockets on Unix systems and winsock on Windows. The code is designed around winsocks having compatibility definitions to support both BSD and Windows sockets.