NpManager ABI

This commit is contained in:
nmzik committed 2026-07-29 21:05:24 +02:00
1 parent b9ae2537ef
commit 65a0f0baa7
3 files changed
+22 -7

No files matched your search

+2 -1
View File
@@ -34,7 +34,7 @@ namespace LibNet {
LIB_VERSION("Net", 1, "Net", 1, 1); LIB_VERSION("Net", 1, "Net", 1, 1);
static thread_local int g_net_errno = 0; static thread_local int g_net_errno = 0;
static constexpr uint32_t g_in6addr_any[4] {}; static constexpr uint32_t g_in6addr_any[4] {};
namespace Net = Network::Net; namespace Net = Network::Net;
@@ -1398,6 +1398,7 @@ LIB_DEFINE(InitNet_1_NpManager) {
LIB_FUNC("O80NrhUOPGY", NpManager::NpCheckPremium); LIB_FUNC("O80NrhUOPGY", NpManager::NpCheckPremium);
LIB_FUNC("eQH7nWPcAgc", NpManager::NpGetState); LIB_FUNC("eQH7nWPcAgc", NpManager::NpGetState);
LIB_FUNC("e-ZuhGEoeC4", NpManager::NpGetNpReachabilityState); LIB_FUNC("e-ZuhGEoeC4", NpManager::NpGetNpReachabilityState);
LIB_FUNC("Oad3rvY-NJQ", NpManager::NpHasSignedUp);
} }
} // namespace LibNpManager } // namespace LibNpManager
+19 -6
View File
@@ -19,7 +19,7 @@
// POSIX uses plain int file descriptors for sockets; provide the Winsock spellings // POSIX uses plain int file descriptors for sockets; provide the Winsock spellings
// the shared (non-guarded) code paths reference. // the shared (non-guarded) code paths reference.
using SOCKET = int; using SOCKET = int;
static constexpr SOCKET INVALID_SOCKET = -1; static constexpr SOCKET INVALID_SOCKET = -1;
#endif #endif
@@ -820,10 +820,10 @@ struct NetEtherAddr {
}; };
#if defined(_WIN32) #if defined(_WIN32)
using NativeSocket = SOCKET; using NativeSocket = SOCKET;
static constexpr NativeSocket INVALID_NATIVE_SOCKET = INVALID_SOCKET; static constexpr NativeSocket INVALID_NATIVE_SOCKET = INVALID_SOCKET;
#else #else
using NativeSocket = int; using NativeSocket = int;
static constexpr NativeSocket INVALID_NATIVE_SOCKET = -1; static constexpr NativeSocket INVALID_NATIVE_SOCKET = -1;
#endif #endif
@@ -1738,7 +1738,8 @@ int KYTY_SYSV_ABI Accept(int s, void* addr, uint32_t* addrlen) {
#if defined(_WIN32) #if defined(_WIN32)
sockaddr_storage host_addr {}; sockaddr_storage host_addr {};
int host_addrlen = sizeof(host_addr); int host_addrlen = sizeof(host_addr);
NativeSocket accepted = ::accept(socket, reinterpret_cast<sockaddr*>(&host_addr), &host_addrlen); NativeSocket accepted =
::accept(socket, reinterpret_cast<sockaddr*>(&host_addr), &host_addrlen);
if (accepted == INVALID_NATIVE_SOCKET) { if (accepted == INVALID_NATIVE_SOCKET) {
return SetPosixSocketError(); return SetPosixSocketError();
} }
@@ -3753,8 +3754,6 @@ int KYTY_SYSV_ABI NpGetState(int user_id, uint32_t* state) {
int KYTY_SYSV_ABI NpGetNpReachabilityState(int user_id, uint32_t* state) { int KYTY_SYSV_ABI NpGetNpReachabilityState(int user_id, uint32_t* state) {
PRINT_NAME(); PRINT_NAME();
constexpr int np_error_invalid_argument = -2141913085; /* 0x80550003 */
if (state == nullptr) { if (state == nullptr) {
return np_error_invalid_argument; return np_error_invalid_argument;
} }
@@ -3767,6 +3766,20 @@ int KYTY_SYSV_ABI NpGetNpReachabilityState(int user_id, uint32_t* state) {
return OK; return OK;
} }
int KYTY_SYSV_ABI NpHasSignedUp(int user_id, bool* has_signed_up) {
PRINT_NAME();
if (has_signed_up == nullptr) {
return np_error_invalid_argument;
}
LOGF("\t user_id = %d\n", user_id);
*has_signed_up = false;
return OK;
}
} // namespace NpManager } // namespace NpManager
} // namespace Libs::Network } // namespace Libs::Network
+1
View File
@@ -184,6 +184,7 @@ int KYTY_SYSV_ABI NpCheckPremium(int req_id, const NpCheckPremiumParameter* par
NpCheckPremiumResult* result); NpCheckPremiumResult* result);
int KYTY_SYSV_ABI NpGetState(int user_id, uint32_t* state); int KYTY_SYSV_ABI NpGetState(int user_id, uint32_t* state);
int KYTY_SYSV_ABI NpGetNpReachabilityState(int user_id, uint32_t* state); int KYTY_SYSV_ABI NpGetNpReachabilityState(int user_id, uint32_t* state);
int KYTY_SYSV_ABI NpHasSignedUp(int user_id, bool* has_signed_up);
} // namespace NpManager } // namespace NpManager