mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-01 07:18:22 -04:00
dns: implement GetHostByName redirection (backend TODO)
This commit is contained in:
parent
8bf8df43e2
commit
400f5142ee
20 changed files with 1251 additions and 5 deletions
|
@ -74,6 +74,7 @@
|
|||
#include <stratosphere/settings.hpp>
|
||||
#include <stratosphere/sf.hpp>
|
||||
#include <stratosphere/sm.hpp>
|
||||
#include <stratosphere/socket.hpp>
|
||||
#include <stratosphere/spl.hpp>
|
||||
#include <stratosphere/time.hpp>
|
||||
#include <stratosphere/updater.hpp>
|
||||
|
|
|
@ -14,4 +14,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stratosphere/socket/socket_types.hpp>
|
||||
#include <stratosphere/socket/socket_api.hpp>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <stratosphere/socket/socket_types.hpp>
|
||||
|
||||
namespace ams::socket {
|
||||
|
||||
u32 InetHtonl(u32 host);
|
||||
u16 InetHtons(u16 host);
|
||||
u32 InetNtohl(u32 net);
|
||||
u16 InetNtohs(u16 net);
|
||||
|
||||
}
|
|
@ -27,7 +27,7 @@ namespace ams::socket {
|
|||
constexpr inline unsigned int FdSetSize = 0x400;
|
||||
|
||||
template<u32 A, u32 B, u32 C, u32 D>
|
||||
constexpr inline InAddrT EncodeInAddr = (A << 24) | (B << 16) | (C << 8) | (D << 0);
|
||||
constexpr inline InAddrT EncodeInAddr = util::ConvertToBigEndian(InAddrT{(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>;
|
||||
|
@ -62,4 +62,8 @@ namespace ams::socket {
|
|||
char **h_addr_list;
|
||||
};
|
||||
|
||||
struct InAddr {
|
||||
InAddrT s_addr;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue