mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-07-11 01:24:28 +02:00
Lib.NpWebApi: Logging fixups (#4666)
* Properly log service and extended push event filters * Other logging touch ups * Clang
This commit is contained in:
@@ -159,19 +159,19 @@ s32 PS4_SYSV_ABI sceNpWebApiUnregisterServicePushEventCallback(s32 titleUserCtxI
|
|||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiAbortHandle(s32 libCtxId, s32 handleId) {
|
s32 PS4_SYSV_ABI sceNpWebApiAbortHandle(s32 libCtxId, s32 handleId) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called libCtxId = {:#x}, handleId = {:#x}", libCtxId, handleId);
|
LOG_INFO(Lib_NpWebApi, "called, libCtxId = {:#x}, handleId = {:#x}", libCtxId, handleId);
|
||||||
return abortHandle(libCtxId, handleId);
|
return abortHandle(libCtxId, handleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiAbortRequest(s64 requestId) {
|
s32 PS4_SYSV_ABI sceNpWebApiAbortRequest(s64 requestId) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called requestId = {:#x}", requestId);
|
LOG_INFO(Lib_NpWebApi, "called, requestId = {:#x}", requestId);
|
||||||
return abortRequest(requestId);
|
return abortRequest(requestId);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiAddHttpRequestHeader(s64 requestId, const char* pFieldName,
|
s32 PS4_SYSV_ABI sceNpWebApiAddHttpRequestHeader(s64 requestId, const char* pFieldName,
|
||||||
const char* pValue) {
|
const char* pValue) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called : requestId = {:#x}, pFieldName = '{}', pValue = '{}'",
|
LOG_INFO(Lib_NpWebApi, "called, requestId = {:#x}, pFieldName = '{}', pValue = '{}'", requestId,
|
||||||
requestId, (pFieldName ? pFieldName : "null"), (pValue ? pValue : "null"));
|
(pFieldName ? pFieldName : "null"), (pValue ? pValue : "null"));
|
||||||
if (pFieldName == nullptr || pValue == nullptr)
|
if (pFieldName == nullptr || pValue == nullptr)
|
||||||
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
||||||
return addHttpRequestHeaderInternal(requestId, pFieldName, pValue);
|
return addHttpRequestHeaderInternal(requestId, pFieldName, pValue);
|
||||||
@@ -180,7 +180,7 @@ s32 PS4_SYSV_ABI sceNpWebApiAddHttpRequestHeader(s64 requestId, const char* pFie
|
|||||||
s32 PS4_SYSV_ABI sceNpWebApiAddMultipartPart(s64 requestId,
|
s32 PS4_SYSV_ABI sceNpWebApiAddMultipartPart(s64 requestId,
|
||||||
const OrbisNpWebApiMultipartPartParameter* pParam,
|
const OrbisNpWebApiMultipartPartParameter* pParam,
|
||||||
s32* pIndex) {
|
s32* pIndex) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called : requestId = {:#x}, headerNum = {}, contentLength = {}",
|
LOG_INFO(Lib_NpWebApi, "called, requestId = {:#x}, headerNum = {}, contentLength = {}",
|
||||||
requestId, (pParam ? pParam->headerNum : 0), (pParam ? pParam->contentLength : 0));
|
requestId, (pParam ? pParam->headerNum : 0), (pParam ? pParam->contentLength : 0));
|
||||||
return addMultipartPart(requestId, pParam, pIndex);
|
return addMultipartPart(requestId, pParam, pIndex);
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ void PS4_SYSV_ABI sceNpWebApiCheckTimeout() {
|
|||||||
s32 PS4_SYSV_ABI sceNpWebApiClearAllUnusedConnection(s32 userCtxId,
|
s32 PS4_SYSV_ABI sceNpWebApiClearAllUnusedConnection(s32 userCtxId,
|
||||||
bool bRemainKeepAliveConnection) {
|
bool bRemainKeepAliveConnection) {
|
||||||
LOG_ERROR(Lib_NpWebApi,
|
LOG_ERROR(Lib_NpWebApi,
|
||||||
"called (STUBBED) : userCtxId = {:#x}, "
|
"called (STUBBED), userCtxId = {:#x}, "
|
||||||
"bRemainKeepAliveConnection = {}",
|
"bRemainKeepAliveConnection = {}",
|
||||||
userCtxId, bRemainKeepAliveConnection);
|
userCtxId, bRemainKeepAliveConnection);
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
@@ -205,7 +205,7 @@ s32 PS4_SYSV_ABI sceNpWebApiClearAllUnusedConnection(s32 userCtxId,
|
|||||||
s32 PS4_SYSV_ABI sceNpWebApiClearUnusedConnection(s32 userCtxId, const char* pApiGroup,
|
s32 PS4_SYSV_ABI sceNpWebApiClearUnusedConnection(s32 userCtxId, const char* pApiGroup,
|
||||||
bool bRemainKeepAliveConnection) {
|
bool bRemainKeepAliveConnection) {
|
||||||
LOG_ERROR(Lib_NpWebApi,
|
LOG_ERROR(Lib_NpWebApi,
|
||||||
"called (STUBBED) : userCtxId = {:#x}, "
|
"called (STUBBED), userCtxId = {:#x}, "
|
||||||
"pApiGroup = '{}', bRemainKeepAliveConnection = {}",
|
"pApiGroup = '{}', bRemainKeepAliveConnection = {}",
|
||||||
userCtxId, (pApiGroup ? pApiGroup : "null"), bRemainKeepAliveConnection);
|
userCtxId, (pApiGroup ? pApiGroup : "null"), bRemainKeepAliveConnection);
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
@@ -256,7 +256,7 @@ s32 PS4_SYSV_ABI sceNpWebApiCreateMultipartRequest(s32 titleUserCtxId, const cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(Lib_NpWebApi,
|
LOG_INFO(Lib_NpWebApi,
|
||||||
"called titleUserCtxId = {:#x}, pApiGroup = '{}', pPath = '{}', method = {}",
|
"called, titleUserCtxId = {:#x}, pApiGroup = '{}', pPath = '{}', method = {}",
|
||||||
titleUserCtxId, pApiGroup, pPath, magic_enum::enum_name(method));
|
titleUserCtxId, pApiGroup, pPath, magic_enum::enum_name(method));
|
||||||
|
|
||||||
return createRequest(titleUserCtxId, pApiGroup, pPath, method, nullptr, nullptr, pRequestId,
|
return createRequest(titleUserCtxId, pApiGroup, pPath, method, nullptr, nullptr, pRequestId,
|
||||||
@@ -282,7 +282,7 @@ s32 PS4_SYSV_ABI sceNpWebApiCreateRequest(s32 titleUserCtxId, const char* pApiGr
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(Lib_NpWebApi,
|
LOG_INFO(Lib_NpWebApi,
|
||||||
"called titleUserCtxId = {:#x}, pApiGroup = '{}', pPath = '{}', method = {}",
|
"called, titleUserCtxId = {:#x}, pApiGroup = '{}', pPath = '{}', method = {}",
|
||||||
titleUserCtxId, pApiGroup, pPath, magic_enum::enum_name(method));
|
titleUserCtxId, pApiGroup, pPath, magic_enum::enum_name(method));
|
||||||
|
|
||||||
return createRequest(titleUserCtxId, pApiGroup, pPath, method, pContentParameter, nullptr,
|
return createRequest(titleUserCtxId, pApiGroup, pPath, method, pContentParameter, nullptr,
|
||||||
@@ -312,7 +312,7 @@ s32 PS4_SYSV_ABI sceNpWebApiDeleteRequest(s64 requestId) {
|
|||||||
s32 PS4_SYSV_ABI sceNpWebApiGetConnectionStats(s32 userCtxId, const char* pApiGroup,
|
s32 PS4_SYSV_ABI sceNpWebApiGetConnectionStats(s32 userCtxId, const char* pApiGroup,
|
||||||
OrbisNpWebApiConnectionStats* pStats) {
|
OrbisNpWebApiConnectionStats* pStats) {
|
||||||
LOG_ERROR(Lib_NpWebApi,
|
LOG_ERROR(Lib_NpWebApi,
|
||||||
"called (STUBBED) : userCtxId = {:#x}, "
|
"called (STUBBED), userCtxId = {:#x}, "
|
||||||
"pApiGroup = '{}', pStats = {}",
|
"pApiGroup = '{}', pStats = {}",
|
||||||
userCtxId, (pApiGroup ? pApiGroup : "null"), fmt::ptr(pStats));
|
userCtxId, (pApiGroup ? pApiGroup : "null"), fmt::ptr(pStats));
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
@@ -320,13 +320,13 @@ s32 PS4_SYSV_ABI sceNpWebApiGetConnectionStats(s32 userCtxId, const char* pApiGr
|
|||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiGetErrorCode() {
|
s32 PS4_SYSV_ABI sceNpWebApiGetErrorCode() {
|
||||||
const s32 code = getLastWebApiError();
|
const s32 code = getLastWebApiError();
|
||||||
LOG_INFO(Lib_NpWebApi, "called : lastErrorCode = {:#x}", code);
|
LOG_INFO(Lib_NpWebApi, "called, lastErrorCode = {:#x}", code);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiGetHttpResponseHeaderValue(s64 requestId, const char* pFieldName,
|
s32 PS4_SYSV_ABI sceNpWebApiGetHttpResponseHeaderValue(s64 requestId, const char* pFieldName,
|
||||||
char* pValue, u64 valueSize) {
|
char* pValue, u64 valueSize) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called : requestId = {:#x}, pFieldName = '{}', valueSize = {}",
|
LOG_INFO(Lib_NpWebApi, "called, requestId = {:#x}, pFieldName = '{}', valueSize = {}",
|
||||||
requestId, (pFieldName ? pFieldName : "null"), valueSize);
|
requestId, (pFieldName ? pFieldName : "null"), valueSize);
|
||||||
if (pFieldName == nullptr || pValue == nullptr || valueSize == 0)
|
if (pFieldName == nullptr || pValue == nullptr || valueSize == 0)
|
||||||
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
||||||
@@ -335,7 +335,7 @@ s32 PS4_SYSV_ABI sceNpWebApiGetHttpResponseHeaderValue(s64 requestId, const char
|
|||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiGetHttpResponseHeaderValueLength(s64 requestId, const char* pFieldName,
|
s32 PS4_SYSV_ABI sceNpWebApiGetHttpResponseHeaderValueLength(s64 requestId, const char* pFieldName,
|
||||||
u64* pValueLength) {
|
u64* pValueLength) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called : requestId = {:#x}, pFieldName = '{}'", requestId,
|
LOG_INFO(Lib_NpWebApi, "called, requestId = {:#x}, pFieldName = '{}'", requestId,
|
||||||
(pFieldName ? pFieldName : "null"));
|
(pFieldName ? pFieldName : "null"));
|
||||||
if (pFieldName == nullptr || pValueLength == nullptr)
|
if (pFieldName == nullptr || pValueLength == nullptr)
|
||||||
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
||||||
@@ -343,7 +343,7 @@ s32 PS4_SYSV_ABI sceNpWebApiGetHttpResponseHeaderValueLength(s64 requestId, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiGetHttpStatusCode(s64 requestId, s32* out_status_code) {
|
s32 PS4_SYSV_ABI sceNpWebApiGetHttpStatusCode(s64 requestId, s32* out_status_code) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called : requestId = {:#x}", requestId);
|
LOG_INFO(Lib_NpWebApi, "called, requestId = {:#x}", requestId);
|
||||||
// On newer SDKs, NULL output pointer is invalid
|
// On newer SDKs, NULL output pointer is invalid
|
||||||
if (getCompiledSdkVersion() > Common::ElfInfo::FW_100 && out_status_code == nullptr)
|
if (getCompiledSdkVersion() > Common::ElfInfo::FW_100 && out_status_code == nullptr)
|
||||||
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
||||||
@@ -353,13 +353,13 @@ s32 PS4_SYSV_ABI sceNpWebApiGetHttpStatusCode(s64 requestId, s32* out_status_cod
|
|||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiGetMemoryPoolStats(s32 libCtxId,
|
s32 PS4_SYSV_ABI sceNpWebApiGetMemoryPoolStats(s32 libCtxId,
|
||||||
OrbisNpWebApiMemoryPoolStats* pCurrentStat) {
|
OrbisNpWebApiMemoryPoolStats* pCurrentStat) {
|
||||||
LOG_ERROR(Lib_NpWebApi, "called (STUBBED) : libCtxId = {:#x}, pCurrentStat = {}", libCtxId,
|
LOG_ERROR(Lib_NpWebApi, "called (STUBBED), libCtxId = {:#x}, pCurrentStat = {}", libCtxId,
|
||||||
fmt::ptr(pCurrentStat));
|
fmt::ptr(pCurrentStat));
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiInitialize(s32 libHttpCtxId, u64 poolSize) {
|
s32 PS4_SYSV_ABI sceNpWebApiInitialize(s32 libHttpCtxId, u64 poolSize) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called libHttpCtxId = {:#x}, poolSize = {:#x} bytes", libHttpCtxId,
|
LOG_INFO(Lib_NpWebApi, "called, libHttpCtxId = {:#x}, poolSize = {:#x} bytes", libHttpCtxId,
|
||||||
poolSize);
|
poolSize);
|
||||||
if (!g_is_initialized) {
|
if (!g_is_initialized) {
|
||||||
g_is_initialized = true;
|
g_is_initialized = true;
|
||||||
@@ -377,7 +377,7 @@ s32 PS4_SYSV_ABI sceNpWebApiInitialize(s32 libHttpCtxId, u64 poolSize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiInitializeForPresence(s32 libHttpCtxId, u64 poolSize) {
|
s32 PS4_SYSV_ABI sceNpWebApiInitializeForPresence(s32 libHttpCtxId, u64 poolSize) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called libHttpCtxId = {:#x}, poolSize = {:#x} bytes", libHttpCtxId,
|
LOG_INFO(Lib_NpWebApi, "called, libHttpCtxId = {:#x}, poolSize = {:#x} bytes", libHttpCtxId,
|
||||||
poolSize);
|
poolSize);
|
||||||
if (!g_is_initialized) {
|
if (!g_is_initialized) {
|
||||||
g_is_initialized = true;
|
g_is_initialized = true;
|
||||||
@@ -423,7 +423,7 @@ s32 PS4_SYSV_ABI sceNpWebApiIntCreateRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(Lib_NpWebApi,
|
LOG_INFO(Lib_NpWebApi,
|
||||||
"called titleUserCtxId = {:#x}, pApiGroup = '{}', pPath = '{}', method = {}",
|
"called, titleUserCtxId = {:#x}, pApiGroup = '{}', pPath = '{}', method = {}",
|
||||||
titleUserCtxId, pApiGroup, pPath, magic_enum::enum_name(method));
|
titleUserCtxId, pApiGroup, pPath, magic_enum::enum_name(method));
|
||||||
|
|
||||||
return createRequest(titleUserCtxId, pApiGroup, pPath, method, pContentParameter, pInternalArgs,
|
return createRequest(titleUserCtxId, pApiGroup, pPath, method, pContentParameter, pInternalArgs,
|
||||||
@@ -490,7 +490,7 @@ s32 PS4_SYSV_ABI sceNpWebApiIntRegisterServicePushEventCallbackA(
|
|||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiReadData(s64 requestId, void* pData, u64 size) {
|
s32 PS4_SYSV_ABI sceNpWebApiReadData(s64 requestId, void* pData, u64 size) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called : requestId = {:#x}, pData = {}, size = {:#x}", requestId,
|
LOG_INFO(Lib_NpWebApi, "called, requestId = {:#x}, pData = {}, size = {:#x}", requestId,
|
||||||
fmt::ptr(pData), size);
|
fmt::ptr(pData), size);
|
||||||
if (pData == nullptr || size == 0)
|
if (pData == nullptr || size == 0)
|
||||||
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
return ORBIS_NP_WEBAPI_ERROR_INVALID_ARGUMENT;
|
||||||
@@ -557,25 +557,25 @@ s32 PS4_SYSV_ABI sceNpWebApiSetHandleTimeout(s32 libCtxId, s32 handleId, u32 tim
|
|||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiSetMaxConnection(s32 libCtxId, s32 maxConnection) {
|
s32 PS4_SYSV_ABI sceNpWebApiSetMaxConnection(s32 libCtxId, s32 maxConnection) {
|
||||||
LOG_ERROR(Lib_NpWebApi, "called (STUBBED) : libCtxId = {:#x}, maxConnection = {}", libCtxId,
|
LOG_ERROR(Lib_NpWebApi, "called (STUBBED), libCtxId = {:#x}, maxConnection = {}", libCtxId,
|
||||||
maxConnection);
|
maxConnection);
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiSetMultipartContentType(s64 requestId, const char* pTypeName,
|
s32 PS4_SYSV_ABI sceNpWebApiSetMultipartContentType(s64 requestId, const char* pTypeName,
|
||||||
const char* pBoundary) {
|
const char* pBoundary) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called : requestId = {:#x}, pTypeName = '{}', pBoundary = '{}'",
|
LOG_INFO(Lib_NpWebApi, "called, requestId = {:#x}, pTypeName = '{}', pBoundary = '{}'",
|
||||||
requestId, (pTypeName ? pTypeName : "null"), (pBoundary ? pBoundary : "null"));
|
requestId, (pTypeName ? pTypeName : "null"), (pBoundary ? pBoundary : "null"));
|
||||||
return setMultipartContentType(requestId, pTypeName, pBoundary);
|
return setMultipartContentType(requestId, pTypeName, pBoundary);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiSetRequestTimeout(s64 requestId, u32 timeout) {
|
s32 PS4_SYSV_ABI sceNpWebApiSetRequestTimeout(s64 requestId, u32 timeout) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called requestId = {:#x}, timeout = {} ms", requestId, timeout);
|
LOG_INFO(Lib_NpWebApi, "called, requestId = {:#x}, timeout = {} ms", requestId, timeout);
|
||||||
return setRequestTimeout(requestId, timeout);
|
return setRequestTimeout(requestId, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiTerminate(s32 libCtxId) {
|
s32 PS4_SYSV_ABI sceNpWebApiTerminate(s32 libCtxId) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called libCtxId = {:#x}", libCtxId);
|
LOG_INFO(Lib_NpWebApi, "called, libCtxId = {:#x}", libCtxId);
|
||||||
s32 result = terminateContext(libCtxId);
|
s32 result = terminateContext(libCtxId);
|
||||||
if (result != ORBIS_OK) {
|
if (result != ORBIS_OK) {
|
||||||
return result;
|
return result;
|
||||||
@@ -629,7 +629,7 @@ s32 PS4_SYSV_ABI sceNpWebApiUtilityParseNpId(const char* pJsonNpId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
s32 PS4_SYSV_ABI sceNpWebApiVshInitialize(s32 libHttpCtxId, u64 poolSize) {
|
s32 PS4_SYSV_ABI sceNpWebApiVshInitialize(s32 libHttpCtxId, u64 poolSize) {
|
||||||
LOG_INFO(Lib_NpWebApi, "called libHttpCtxId = {:#x}, poolSize = {:#x} bytes", libHttpCtxId,
|
LOG_INFO(Lib_NpWebApi, "called, libHttpCtxId = {:#x}, poolSize = {:#x} bytes", libHttpCtxId,
|
||||||
poolSize);
|
poolSize);
|
||||||
if (!g_is_initialized) {
|
if (!g_is_initialized) {
|
||||||
g_is_initialized = true;
|
g_is_initialized = true;
|
||||||
|
|||||||
@@ -784,7 +784,7 @@ s32 sendRequest(s64 requestId, s32 partIndex, const void* pData, u64 dataSize, s
|
|||||||
const s32 tmpl_id = Libraries::Http::sceHttpCreateTemplate(
|
const s32 tmpl_id = Libraries::Http::sceHttpCreateTemplate(
|
||||||
context->libHttpCtxId, "libhttp", /*httpVer=*/2, /*isAutoProxyConf=*/0);
|
context->libHttpCtxId, "libhttp", /*httpVer=*/2, /*isAutoProxyConf=*/0);
|
||||||
if (tmpl_id < 0) {
|
if (tmpl_id < 0) {
|
||||||
LOG_ERROR(Lib_NpWebApi, "sendRequest: sceHttpCreateTemplate failed: {:#x}", tmpl_id);
|
LOG_ERROR(Lib_NpWebApi, "sceHttpCreateTemplate failed: {:#x}", tmpl_id);
|
||||||
releaseRequest(request);
|
releaseRequest(request);
|
||||||
releaseUserContext(user_context);
|
releaseUserContext(user_context);
|
||||||
releaseContext(context);
|
releaseContext(context);
|
||||||
@@ -794,8 +794,7 @@ s32 sendRequest(s64 requestId, s32 partIndex, const void* pData, u64 dataSize, s
|
|||||||
const int conn_id = Libraries::Http::sceHttpCreateConnectionWithURL(
|
const int conn_id = Libraries::Http::sceHttpCreateConnectionWithURL(
|
||||||
tmpl_id, base_url.c_str(), /*enableKeepalive=*/true);
|
tmpl_id, base_url.c_str(), /*enableKeepalive=*/true);
|
||||||
if (conn_id < 0) {
|
if (conn_id < 0) {
|
||||||
LOG_ERROR(Lib_NpWebApi, "sendRequest: sceHttpCreateConnectionWithURL failed: {:#x}",
|
LOG_ERROR(Lib_NpWebApi, "sceHttpCreateConnectionWithURL failed: {:#x}", conn_id);
|
||||||
conn_id);
|
|
||||||
Libraries::Http::sceHttpDeleteTemplate(tmpl_id);
|
Libraries::Http::sceHttpDeleteTemplate(tmpl_id);
|
||||||
request->http_template_id = 0;
|
request->http_template_id = 0;
|
||||||
releaseRequest(request);
|
releaseRequest(request);
|
||||||
@@ -829,7 +828,7 @@ s32 sendRequest(s64 requestId, s32 partIndex, const void* pData, u64 dataSize, s
|
|||||||
sceMethod = 8; // out-of-band PATCH marker recognised by libhttp
|
sceMethod = 8; // out-of-band PATCH marker recognised by libhttp
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Lib_NpWebApi, "sendRequest: unknown method enum value {}",
|
LOG_ERROR(Lib_NpWebApi, "unknown method enum value {}",
|
||||||
static_cast<int>(request->userMethod));
|
static_cast<int>(request->userMethod));
|
||||||
releaseRequest(request);
|
releaseRequest(request);
|
||||||
releaseUserContext(user_context);
|
releaseUserContext(user_context);
|
||||||
@@ -840,8 +839,7 @@ s32 sendRequest(s64 requestId, s32 partIndex, const void* pData, u64 dataSize, s
|
|||||||
const int req_id = Libraries::Http::sceHttpCreateRequestWithURL(
|
const int req_id = Libraries::Http::sceHttpCreateRequestWithURL(
|
||||||
conn_id, sceMethod, full_url.c_str(), request->userContentLength);
|
conn_id, sceMethod, full_url.c_str(), request->userContentLength);
|
||||||
if (req_id < 0) {
|
if (req_id < 0) {
|
||||||
LOG_ERROR(Lib_NpWebApi, "sendRequest: sceHttpCreateRequestWithURL failed: {:#x}",
|
LOG_ERROR(Lib_NpWebApi, "sceHttpCreateRequestWithURL failed: {:#x}", req_id);
|
||||||
req_id);
|
|
||||||
Libraries::Http::sceHttpDeleteConnection(conn_id);
|
Libraries::Http::sceHttpDeleteConnection(conn_id);
|
||||||
request->http_connection_id = 0;
|
request->http_connection_id = 0;
|
||||||
Libraries::Http::sceHttpDeleteTemplate(tmpl_id);
|
Libraries::Http::sceHttpDeleteTemplate(tmpl_id);
|
||||||
@@ -868,7 +866,7 @@ s32 sendRequest(s64 requestId, s32 partIndex, const void* pData, u64 dataSize, s
|
|||||||
/*mode=*/0);
|
/*mode=*/0);
|
||||||
} else {
|
} else {
|
||||||
LOG_WARNING(Lib_NpWebApi,
|
LOG_WARNING(Lib_NpWebApi,
|
||||||
"sendRequest: no bearer token for user_id={}; request to '{}' will "
|
"no bearer token for user_id={}; request to '{}' will "
|
||||||
"be unauthenticated (expect 401 from server)",
|
"be unauthenticated (expect 401 from server)",
|
||||||
user_context->userId, request->userPath);
|
user_context->userId, request->userPath);
|
||||||
}
|
}
|
||||||
@@ -907,15 +905,14 @@ s32 sendRequest(s64 requestId, s32 partIndex, const void* pData, u64 dataSize, s
|
|||||||
const s32 send_err =
|
const s32 send_err =
|
||||||
Libraries::Http::sceHttpSendRequest(request->http_request_id, sendData, sendSize);
|
Libraries::Http::sceHttpSendRequest(request->http_request_id, sendData, sendSize);
|
||||||
if (send_err < 0) {
|
if (send_err < 0) {
|
||||||
LOG_ERROR(Lib_NpWebApi, "sendRequest: sceHttpSendRequest failed: {:#x}", send_err);
|
LOG_ERROR(Lib_NpWebApi, "sceHttpSendRequest failed: {:#x}", send_err);
|
||||||
releaseRequest(request);
|
releaseRequest(request);
|
||||||
releaseUserContext(user_context);
|
releaseUserContext(user_context);
|
||||||
releaseContext(context);
|
releaseContext(context);
|
||||||
return send_err;
|
return send_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO(Lib_NpWebApi,
|
LOG_INFO(Lib_NpWebApi, "requestId={:#x} apiGroup='{}' path='{}' method={} httpReqId={}",
|
||||||
"sendRequest OK requestId={:#x} apiGroup='{}' path='{}' method={} httpReqId={}",
|
|
||||||
requestId, request->userApiGroup, request->userPath,
|
requestId, request->userApiGroup, request->userPath,
|
||||||
magic_enum::enum_name(request->userMethod), request->http_request_id);
|
magic_enum::enum_name(request->userMethod), request->http_request_id);
|
||||||
|
|
||||||
@@ -1254,8 +1251,7 @@ s32 createPushEventFilterInternal(OrbisNpWebApiContext* context,
|
|||||||
filter->parentContext = context;
|
filter->parentContext = context;
|
||||||
filter->filterId = filterId;
|
filter->filterId = filterId;
|
||||||
|
|
||||||
LOG_INFO(Lib_NpWebApi, "createPushEventFilter: filterId={} dataTypeParams={}", filterId,
|
LOG_INFO(Lib_NpWebApi, "filterId={} dataTypeParams={}", filterId, filterParamNum);
|
||||||
filterParamNum);
|
|
||||||
if (pFilterParam != nullptr && filterParamNum != 0) {
|
if (pFilterParam != nullptr && filterParamNum != 0) {
|
||||||
for (u64 param_idx = 0; param_idx < filterParamNum; param_idx++) {
|
for (u64 param_idx = 0; param_idx < filterParamNum; param_idx++) {
|
||||||
OrbisNpWebApiPushEventFilterParameter copy = OrbisNpWebApiPushEventFilterParameter{};
|
OrbisNpWebApiPushEventFilterParameter copy = OrbisNpWebApiPushEventFilterParameter{};
|
||||||
@@ -1384,7 +1380,7 @@ s32 createServicePushEventFilterInternal(
|
|||||||
|
|
||||||
if (pNpServiceName != nullptr && !EmulatorSettings.IsShadNetEnabled()) {
|
if (pNpServiceName != nullptr && !EmulatorSettings.IsShadNetEnabled()) {
|
||||||
// Seems sceNpManagerIntGetUserList fails?
|
// Seems sceNpManagerIntGetUserList fails?
|
||||||
LOG_DEBUG(Lib_NpWebApi, "Cannot create service push event while PSN is disabled");
|
LOG_DEBUG(Lib_NpWebApi, "Cannot create service push event while shadNet is disabled");
|
||||||
handle->userCount--;
|
handle->userCount--;
|
||||||
return ORBIS_NP_WEBAPI_ERROR_SIGNED_IN_USER_NOT_FOUND;
|
return ORBIS_NP_WEBAPI_ERROR_SIGNED_IN_USER_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@@ -1403,19 +1399,19 @@ s32 createServicePushEventFilterInternal(
|
|||||||
if (pNpServiceName == nullptr) {
|
if (pNpServiceName == nullptr) {
|
||||||
filter->internal = true;
|
filter->internal = true;
|
||||||
} else {
|
} else {
|
||||||
// TODO: if pNpServiceName is non-null, create an np request for this filter.
|
|
||||||
LOG_ERROR(Lib_NpWebApi, "Np behavior not handled");
|
|
||||||
filter->npServiceName = std::string(pNpServiceName);
|
filter->npServiceName = std::string(pNpServiceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
filter->npServiceLabel = npServiceLabel;
|
filter->npServiceLabel = npServiceLabel;
|
||||||
|
LOG_INFO(Lib_NpWebApi, "filterId={} dataTypeParams={}", filterId, filterParamNum);
|
||||||
if (pFilterParam != nullptr && filterParamNum != 0) {
|
if (pFilterParam != nullptr && filterParamNum != 0) {
|
||||||
for (u64 param_idx = 0; param_idx < filterParamNum; param_idx++) {
|
for (u64 param_idx = 0; param_idx < filterParamNum; param_idx++) {
|
||||||
OrbisNpWebApiServicePushEventFilterParameter copy =
|
OrbisNpWebApiServicePushEventFilterParameter copy =
|
||||||
OrbisNpWebApiServicePushEventFilterParameter{};
|
OrbisNpWebApiServicePushEventFilterParameter{};
|
||||||
memcpy(©, &pFilterParam[param_idx],
|
memcpy(©, &pFilterParam[param_idx],
|
||||||
sizeof(OrbisNpWebApiServicePushEventFilterParameter));
|
sizeof(OrbisNpWebApiServicePushEventFilterParameter));
|
||||||
|
LOG_INFO(Lib_NpWebApi, " filterParam[{}] data_type='{}'", param_idx,
|
||||||
|
copy.dataType.val);
|
||||||
filter->filterParams.emplace_back(copy);
|
filter->filterParams.emplace_back(copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1561,7 +1557,7 @@ s32 createExtendedPushEventFilterInternal(
|
|||||||
|
|
||||||
if (pNpServiceName != nullptr && !EmulatorSettings.IsShadNetEnabled()) {
|
if (pNpServiceName != nullptr && !EmulatorSettings.IsShadNetEnabled()) {
|
||||||
// Seems sceNpManagerIntGetUserList fails?
|
// Seems sceNpManagerIntGetUserList fails?
|
||||||
LOG_DEBUG(Lib_NpWebApi, "Cannot create extended push event while PSN is disabled");
|
LOG_DEBUG(Lib_NpWebApi, "Cannot create extended push event while shadNet is disabled");
|
||||||
handle->userCount--;
|
handle->userCount--;
|
||||||
return ORBIS_NP_WEBAPI_ERROR_SIGNED_IN_USER_NOT_FOUND;
|
return ORBIS_NP_WEBAPI_ERROR_SIGNED_IN_USER_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@@ -1581,16 +1577,13 @@ s32 createExtendedPushEventFilterInternal(
|
|||||||
if (pNpServiceName == nullptr) {
|
if (pNpServiceName == nullptr) {
|
||||||
npServiceLabel = ORBIS_NP_INVALID_SERVICE_LABEL;
|
npServiceLabel = ORBIS_NP_INVALID_SERVICE_LABEL;
|
||||||
} else {
|
} else {
|
||||||
// TODO: if pNpServiceName is non-null, create an np request for this filter.
|
|
||||||
LOG_ERROR(Lib_NpWebApi, "Np behavior not handled");
|
|
||||||
filter->npServiceName = std::string(pNpServiceName);
|
filter->npServiceName = std::string(pNpServiceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
filter->npServiceLabel = npServiceLabel;
|
filter->npServiceLabel = npServiceLabel;
|
||||||
|
|
||||||
LOG_INFO(Lib_NpWebApi,
|
LOG_INFO(Lib_NpWebApi, "filterId={} service='{}' label={:#x} dataTypeParams={}", filterId,
|
||||||
"createExtdPushEventFilter: filterId={} service='{}' label={:#x} dataTypeParams={}",
|
pNpServiceName ? pNpServiceName : "null", npServiceLabel, filterParamNum);
|
||||||
filterId, pNpServiceName ? pNpServiceName : "null", npServiceLabel, filterParamNum);
|
|
||||||
if (pFilterParam != nullptr && filterParamNum != 0) {
|
if (pFilterParam != nullptr && filterParamNum != 0) {
|
||||||
for (u64 param_idx = 0; param_idx < filterParamNum; param_idx++) {
|
for (u64 param_idx = 0; param_idx < filterParamNum; param_idx++) {
|
||||||
OrbisNpWebApiExtdPushEventFilterParameter copy =
|
OrbisNpWebApiExtdPushEventFilterParameter copy =
|
||||||
@@ -2049,7 +2042,7 @@ s32 PS4_SYSV_ABI readDataInternal(s64 requestId, void* pData, u64 size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
LOG_INFO(Lib_NpWebApi, "readData reqId={:#x} -> {} bytes: {:.256s}", requestId, result,
|
LOG_INFO(Lib_NpWebApi, "reqId={:#x} -> {} bytes: {:.256s}", requestId, result,
|
||||||
std::string(reinterpret_cast<const char*>(pData),
|
std::string(reinterpret_cast<const char*>(pData),
|
||||||
std::min<u64>(result, 256))); // debug to be removed
|
std::min<u64>(result, 256))); // debug to be removed
|
||||||
}
|
}
|
||||||
@@ -2186,8 +2179,7 @@ void DrainPushEvents() {
|
|||||||
exarr.empty() ? nullptr : exarr.data();
|
exarr.empty() ? nullptr : exarr.data();
|
||||||
|
|
||||||
LOG_INFO(
|
LOG_INFO(
|
||||||
Lib_NpWebApi,
|
Lib_NpWebApi, "invoking extd cb ctx={:#x} cbId={} dataType='{}'",
|
||||||
"DrainPushEvents: invoking extd cb ctx={:#x} cbId={} dataType='{}'",
|
|
||||||
title_user_ctx_id, cbId,
|
title_user_ctx_id, cbId,
|
||||||
ev.dataType); // debug confirm the listener callback fires. to be removed
|
ev.dataType); // debug confirm the listener callback fires. to be removed
|
||||||
reinterpret_cast<ExtdCbA>(raw)(
|
reinterpret_cast<ExtdCbA>(raw)(
|
||||||
@@ -2238,7 +2230,7 @@ void DrainPushEvents() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOG_INFO(Lib_NpWebApi,
|
LOG_INFO(Lib_NpWebApi,
|
||||||
"DrainPushEvents: invoking basic cb ctx={:#x} cbId={} "
|
"invoking basic cb ctx={:#x} cbId={} "
|
||||||
"dataType='{}'",
|
"dataType='{}'",
|
||||||
title_user_ctx_id, cbId,
|
title_user_ctx_id, cbId,
|
||||||
ev.dataType); // debug confirm the listener callback fires. to be
|
ev.dataType); // debug confirm the listener callback fires. to be
|
||||||
|
|||||||
Reference in New Issue
Block a user