diff --git a/libstratosphere/include/stratosphere/ams/impl/ams_system_thread_definitions.hpp b/libstratosphere/include/stratosphere/ams/impl/ams_system_thread_definitions.hpp index 06a1e026..ff789a78 100644 --- a/libstratosphere/include/stratosphere/ams/impl/ams_system_thread_definitions.hpp +++ b/libstratosphere/include/stratosphere/ams/impl/ams_system_thread_definitions.hpp @@ -113,6 +113,9 @@ namespace ams::impl { AMS_DEFINE_SYSTEM_THREAD(21, erpt, Main); AMS_DEFINE_SYSTEM_THREAD(21, erpt, IpcServer); + /* socket. */ + AMS_DEFINE_SYSTEM_THREAD(29, socket, ResolverIpcServer); + /* jpegdec. */ AMS_DEFINE_SYSTEM_THREAD(21, jpegdec, Main); diff --git a/libstratosphere/include/stratosphere/socket.hpp b/libstratosphere/include/stratosphere/socket.hpp new file mode 100644 index 00000000..d43f9238 --- /dev/null +++ b/libstratosphere/include/stratosphere/socket.hpp @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once +#include diff --git a/libstratosphere/include/stratosphere/socket/socket_types.hpp b/libstratosphere/include/stratosphere/socket/socket_types.hpp new file mode 100644 index 00000000..bac58080 --- /dev/null +++ b/libstratosphere/include/stratosphere/socket/socket_types.hpp @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018-2020 Atmosphère-NX + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once +#include + +namespace ams::socket { + + using InAddrT = u32; + using InPortT = u16; + using SockLenT = u32; + using NfdsT = u64; + using FdMask = u64; + + constexpr inline unsigned int FdSetSize = 0x400; + + template + constexpr inline InAddrT EncodeInAddr = (A << 24) | (B << 16) | (C << 8) | (D << 0); + + constexpr inline InAddrT InAddr_Any = EncodeInAddr< 0, 0, 0, 0>; + constexpr inline InAddrT InAddr_Broadcast = EncodeInAddr<255, 255, 255, 255>; + constexpr inline InAddrT InAddr_None = EncodeInAddr<255, 255, 255, 255>; + constexpr inline InAddrT InAddr_Loopback = EncodeInAddr<127, 0, 0, 1>; + + enum class Family : u8 { + Af_Unspec = 0, + Pf_Unspec = Af_Unspec, + + Af_Inet = 2, + Pf_Inet = Af_Inet, + + Af_Route = 17, + Pf_Route = Af_Route, + + Af_Link = 18, + Pf_Link = Af_Link, + + Af_Inet6 = 28, + Pf_Inet6 = Af_Inet6, + + Af_Max = 42, + Pf_Max = Af_Max + }; + + struct HostEnt { + char *h_name; + char **h_aliases; + Family h_addrtype; + int h_length; + char **h_addr_list; + }; + +}