Commit Graph

32 Commits

Author SHA1 Message Date
Sepalani
cbb76c1d4f Common/Network: Use StrErrorWrapper 2023-07-12 20:52:35 +04:00
Lioncash
cdd3e636e1 Common/Network: Resolve -Wexpansion-to-defined warning
Macros that expand to include the standard define macro are undefined.
This is pretty trivial to fix. We can just do the test and then define
the name itself if it's true, rather than making the set of definition
checks the macro itself.
2023-01-30 14:20:56 -05:00
Sepalani
e783a7f409 Common/Network: Add StrNetworkError helper function 2022-08-24 21:05:18 +04:00
Sepalani
597fb9ff6d Move SocketManager's DecodeError to Common
Fix thread safety issue
2022-08-22 14:02:26 +04:00
Sepalani
b950d038b9 Common/Network: Update IP checksum since total_len might have changed 2022-07-10 20:56:07 +04:00
Sepalani
5fdf255a2d Common/Network: Make Build() methods const 2022-07-10 20:12:07 +04:00
Sepalani
d902b04ae0 Common/Network: Remove unused offset variables 2022-07-10 14:11:50 +04:00
Sepalani
b206f98261 Common/Network: Remove unnecessary size checks 2022-07-10 14:04:03 +04:00
Sepalani
6238834c05 Common/Network: Add InsertObj helper 2022-07-10 13:56:33 +04:00
Sepalani
b7bd2a4001 Common/Network: Use member initializer list 2022-07-10 12:31:59 +04:00
Sepalani
13957a627c Common/Network: Remove unused constructors 2022-07-10 11:42:58 +04:00
schthack
087020b23a Refactoring of the code to match dolphin style
Changed access for offsetof + some clean up
2022-07-09 17:01:22 -04:00
schthack
01ada3850f BBA: Added BuiltIn device that allow BBA emulation without the need of a TapDevice Configuration include a dns server setting 2022-07-02 18:02:50 -04:00
Sepalani
cbadc6e81a NetworkCaptureLogger: Move ErrorState struct to Common/Network 2022-06-08 19:06:42 +04:00
Admiral H. Curtiss
f68c3b758e
Common/Network: Use std::array in IPv4Header. 2022-05-23 02:01:59 +02:00
Pokechu22
6e5f4125e3 Use Common::ToLower and Common::ToUpper 2022-01-16 17:00:12 -08:00
Pierre Bourdon
e149ad4f0a
treewide: convert GPLv2+ license info to SPDX tags
SPDX standardizes how source code conveys its copyright and licensing
information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX
tags are adopted in many large projects, including things like the Linux
kernel.
2021-07-05 04:35:56 +02:00
Sepalani
82bb5d9915 NetworkCaptureLogger: PCAP support added
Log TCP/UDP read/write with fake packet.
2021-01-30 19:35:09 +04:00
Lioncash
81edcca8db Common/Network: Use std::nullopt in StringToMacAddress
Prevents unnecessary zeroing out of std::optional's internal buffer in
some implementations.
2019-12-06 09:59:11 -05:00
Lioncash
cbfacc41ba Common/Network: Remove unused header inclusions
Removes unused header dependencies.
2019-12-06 09:51:28 -05:00
Lioncash
f06461d208 Common/Network: Make StringToMacAddress use a string_view
This function only ever reads the contents of the string in a non-owning
manner, so we can change the parameter over to being a string view.
2019-12-06 09:45:25 -05:00
Lioncash
5b92d5076a
Common: Use fmt where applicable
Begins the transition to using fmt for string formatting where
applicable. Given fmt supports formatting std::string instances out of
the box, we can remove now-unnecessary calls to .c_str() and .data().

Note that this change does not touch the actual logging subsystem aside
from converting the final StringFromFormat call in the process over to
fmt::format. Given our logging system is heavily used throughout the
entire codebase, and converting that over will be quite a large change
by itself, this will be tackled near the end of the conversion process.
2019-06-14 15:04:09 -04:00
Lioncash
ce69201f33 Common/Network: Get rid of out parameters for MAC address utilities
Given we have std::array and std::optional, we can use these in
conjunction with one another to avoid the need for out parameters.
2018-06-10 15:43:26 -04:00
Léo Lam
fff1db9730 Common: Add Random utilities
This makes it easier to generate random numbers or fill a buffer with
random data in a cryptographically secure way.

This also replaces existing usages of RNG functions in the codebase:

* <random> is pretty hard to use correctly, and std::random_device does
  not give enough guarantees about its results (it's
  implementation-defined, non cryptographically secure and could be
  deterministic on some platforms).
  Doing things correctly is error prone and verbose.

* rand() is terrible and should not be used especially in crypto code.
2018-05-31 17:54:43 +02:00
Lioncash
f1542c8e5a Common: Namespace Network.h/.cpp
Necessary to avoid namespace clashes with IOS HLE's namespace name.
2017-01-17 20:46:48 -05:00
Pierre Bourdon
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Stenzek
a870253cd6 Common: Use C++ random generator for generating MAC addresses 2016-01-31 23:52:47 +10:00
Ryan Houdek
eb2d4935cd Including missing headers required for non-pch builds and other architectures 2015-12-22 18:20:48 -06:00
Rohit Nirmal
3b75f45cf6 Fix building with PCH disabled. 2015-09-28 11:51:08 -05:00
Tillmann Karras
30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras
cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Matthew Parlane
57f2eda130 Fix MAC address reading on Windows. 2014-03-07 21:40:59 +13:00