Native USB networking for Quest
Requires Horizon OS >= 2.6
This commit is contained in:
@@ -85,24 +85,14 @@ void wivrn::UDP::bind(sockaddr_in6 address)
|
||||
throw std::system_error{errno, std::generic_category()};
|
||||
}
|
||||
|
||||
void wivrn::UDP::connect(in6_addr address, int port)
|
||||
void wivrn::UDP::connect(sockaddr_in6 sa)
|
||||
{
|
||||
sockaddr_in6 sa;
|
||||
sa.sin6_family = AF_INET6;
|
||||
sa.sin6_addr = address;
|
||||
sa.sin6_port = htons(port);
|
||||
|
||||
if (::connect(fd, (sockaddr *)&sa, sizeof(sa)) < 0)
|
||||
throw std::system_error{errno, std::generic_category()};
|
||||
}
|
||||
|
||||
void wivrn::UDP::connect(in_addr address, int port)
|
||||
void wivrn::UDP::connect(sockaddr_in sa)
|
||||
{
|
||||
sockaddr_in sa;
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_addr = address;
|
||||
sa.sin_port = htons(port);
|
||||
|
||||
if (::connect(fd, (sockaddr *)&sa, sizeof(sa)) < 0)
|
||||
throw std::system_error{errno, std::generic_category()};
|
||||
}
|
||||
@@ -173,18 +163,13 @@ wivrn::TCP::TCP(int fd)
|
||||
init();
|
||||
}
|
||||
|
||||
wivrn::TCP::TCP(in6_addr address, int port)
|
||||
wivrn::TCP::TCP(sockaddr_in6 sa)
|
||||
{
|
||||
fd = socket(AF_INET6, SOCK_STREAM, 0);
|
||||
if (fd < 0)
|
||||
throw std::system_error{errno, std::generic_category()};
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
sockaddr_in6 sa;
|
||||
sa.sin6_family = AF_INET6;
|
||||
sa.sin6_addr = address;
|
||||
sa.sin6_port = htons(port);
|
||||
|
||||
if (connect(fd, (sockaddr *)&sa, sizeof(sa)) < 0)
|
||||
{
|
||||
::close(fd);
|
||||
@@ -194,18 +179,13 @@ wivrn::TCP::TCP(in6_addr address, int port)
|
||||
init();
|
||||
}
|
||||
|
||||
wivrn::TCP::TCP(in_addr address, int port)
|
||||
wivrn::TCP::TCP(sockaddr_in sa)
|
||||
{
|
||||
fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (fd < 0)
|
||||
throw std::system_error{errno, std::generic_category()};
|
||||
fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
sockaddr_in sa;
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_addr = address;
|
||||
sa.sin_port = htons(port);
|
||||
|
||||
if (connect(fd, (sockaddr *)&sa, sizeof(sa)) < 0)
|
||||
{
|
||||
::close(fd);
|
||||
|
||||
@@ -118,8 +118,8 @@ public:
|
||||
size_t send_raw(serialization_packet && packet);
|
||||
size_t send_many_raw(std::span<serialization_packet> packets);
|
||||
|
||||
void connect(in6_addr address, int port);
|
||||
void connect(in_addr address, int port);
|
||||
void connect(sockaddr_in6 address);
|
||||
void connect(sockaddr_in address);
|
||||
void bind(sockaddr_in6 address);
|
||||
void subscribe_multicast(in6_addr address);
|
||||
void unsubscribe_multicast(in6_addr address);
|
||||
@@ -144,8 +144,8 @@ class TCP : public fd_base
|
||||
|
||||
public:
|
||||
TCP() = default;
|
||||
TCP(in6_addr address, int port);
|
||||
TCP(in_addr address, int port);
|
||||
TCP(sockaddr_in6 address);
|
||||
TCP(sockaddr_in address);
|
||||
explicit TCP(int fd);
|
||||
|
||||
deserialization_packet receive_raw();
|
||||
|
||||
Reference in New Issue
Block a user