Services/HLE: Convert the http:C service to the new service framework.

This commit is contained in:
B3n30 2018-07-21 18:48:57 -05:00 committed by Subv
parent 78685065cf
commit 28124c053a
3 changed files with 69 additions and 65 deletions

View File

@ -2,71 +2,77 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/ipc.h"
#include "core/hle/service/http_c.h"
namespace Service {
namespace HTTP {
const Interface::FunctionInfo FunctionTable[] = {
{0x00010044, nullptr, "Initialize"},
{0x00020082, nullptr, "CreateContext"},
{0x00030040, nullptr, "CloseContext"},
{0x00040040, nullptr, "CancelConnection"},
{0x00050040, nullptr, "GetRequestState"},
{0x00060040, nullptr, "GetDownloadSizeState"},
{0x00070040, nullptr, "GetRequestError"},
{0x00080042, nullptr, "InitializeConnectionSession"},
{0x00090040, nullptr, "BeginRequest"},
{0x000A0040, nullptr, "BeginRequestAsync"},
{0x000B0082, nullptr, "ReceiveData"},
{0x000C0102, nullptr, "ReceiveDataTimeout"},
{0x000D0146, nullptr, "SetProxy"},
{0x000E0040, nullptr, "SetProxyDefault"},
{0x000F00C4, nullptr, "SetBasicAuthorization"},
{0x00100080, nullptr, "SetSocketBufferSize"},
{0x001100C4, nullptr, "AddRequestHeader"},
{0x001200C4, nullptr, "AddPostDataAscii"},
{0x001300C4, nullptr, "AddPostDataBinary"},
{0x00140082, nullptr, "AddPostDataRaw"},
{0x00150080, nullptr, "SetPostDataType"},
{0x001600C4, nullptr, "SendPostDataAscii"},
{0x00170144, nullptr, "SendPostDataAsciiTimeout"},
{0x001800C4, nullptr, "SendPostDataBinary"},
{0x00190144, nullptr, "SendPostDataBinaryTimeout"},
{0x001A0082, nullptr, "SendPostDataRaw"},
{0x001B0102, nullptr, "SendPOSTDataRawTimeout"},
{0x001C0080, nullptr, "SetPostDataEncoding"},
{0x001D0040, nullptr, "NotifyFinishSendPostData"},
{0x001E00C4, nullptr, "GetResponseHeader"},
{0x001F0144, nullptr, "GetResponseHeaderTimeout"},
{0x00200082, nullptr, "GetResponseData"},
{0x00210102, nullptr, "GetResponseDataTimeout"},
{0x00220040, nullptr, "GetResponseStatusCode"},
{0x002300C0, nullptr, "GetResponseStatusCodeTimeout"},
{0x00240082, nullptr, "AddTrustedRootCA"},
{0x00250080, nullptr, "AddDefaultCert"},
{0x00260080, nullptr, "SelectRootCertChain"},
{0x002700C4, nullptr, "SetClientCert"},
{0x002B0080, nullptr, "SetSSLOpt"},
{0x002C0080, nullptr, "SetSSLClearOpt"},
{0x002D0000, nullptr, "CreateRootCertChain"},
{0x002E0040, nullptr, "DestroyRootCertChain"},
{0x002F0082, nullptr, "RootCertChainAddCert"},
{0x00300080, nullptr, "RootCertChainAddDefaultCert"},
{0x00310080, nullptr, "RootCertChainRemoveCert"},
{0x00320084, nullptr, "OpenClientCertContext"},
{0x00330040, nullptr, "OpenDefaultClientCertContext"},
{0x00340040, nullptr, "CloseClientCertContext"},
{0x00350186, nullptr, "SetDefaultProxy"},
{0x00360000, nullptr, "ClearDNSCache"},
{0x00370080, nullptr, "SetKeepAlive"},
{0x003800C0, nullptr, "SetPostDataTypeSize"},
{0x00390000, nullptr, "Finalize"},
};
HTTP_C::HTTP_C() {
Register(FunctionTable);
HTTP_C::HTTP_C() : ServiceFramework("http:C", 32) {
static const FunctionInfo functions[] = {
{0x00010044, nullptr, "Initialize"},
{0x00020082, nullptr, "CreateContext"},
{0x00030040, nullptr, "CloseContext"},
{0x00040040, nullptr, "CancelConnection"},
{0x00050040, nullptr, "GetRequestState"},
{0x00060040, nullptr, "GetDownloadSizeState"},
{0x00070040, nullptr, "GetRequestError"},
{0x00080042, nullptr, "InitializeConnectionSession"},
{0x00090040, nullptr, "BeginRequest"},
{0x000A0040, nullptr, "BeginRequestAsync"},
{0x000B0082, nullptr, "ReceiveData"},
{0x000C0102, nullptr, "ReceiveDataTimeout"},
{0x000D0146, nullptr, "SetProxy"},
{0x000E0040, nullptr, "SetProxyDefault"},
{0x000F00C4, nullptr, "SetBasicAuthorization"},
{0x00100080, nullptr, "SetSocketBufferSize"},
{0x001100C4, nullptr, "AddRequestHeader"},
{0x001200C4, nullptr, "AddPostDataAscii"},
{0x001300C4, nullptr, "AddPostDataBinary"},
{0x00140082, nullptr, "AddPostDataRaw"},
{0x00150080, nullptr, "SetPostDataType"},
{0x001600C4, nullptr, "SendPostDataAscii"},
{0x00170144, nullptr, "SendPostDataAsciiTimeout"},
{0x001800C4, nullptr, "SendPostDataBinary"},
{0x00190144, nullptr, "SendPostDataBinaryTimeout"},
{0x001A0082, nullptr, "SendPostDataRaw"},
{0x001B0102, nullptr, "SendPOSTDataRawTimeout"},
{0x001C0080, nullptr, "SetPostDataEncoding"},
{0x001D0040, nullptr, "NotifyFinishSendPostData"},
{0x001E00C4, nullptr, "GetResponseHeader"},
{0x001F0144, nullptr, "GetResponseHeaderTimeout"},
{0x00200082, nullptr, "GetResponseData"},
{0x00210102, nullptr, "GetResponseDataTimeout"},
{0x00220040, nullptr, "GetResponseStatusCode"},
{0x002300C0, nullptr, "GetResponseStatusCodeTimeout"},
{0x00240082, nullptr, "AddTrustedRootCA"},
{0x00250080, nullptr, "AddDefaultCert"},
{0x00260080, nullptr, "SelectRootCertChain"},
{0x002700C4, nullptr, "SetClientCert"},
{0x00290080, nullptr, "SetClientCertContext"},
{0x002A0040, nullptr, "GetSSLError"},
{0x002B0080, nullptr, "SetSSLOpt"},
{0x002C0080, nullptr, "SetSSLClearOpt"},
{0x002D0000, nullptr, "CreateRootCertChain"},
{0x002E0040, nullptr, "DestroyRootCertChain"},
{0x002F0082, nullptr, "RootCertChainAddCert"},
{0x00300080, nullptr, "RootCertChainAddDefaultCert"},
{0x00310080, nullptr, "RootCertChainRemoveCert"},
{0x00320084, nullptr, "OpenClientCertContext"},
{0x00330040, nullptr, "OpenDefaultClientCertContext"},
{0x00340040, nullptr, "CloseClientCertContext"},
{0x00350186, nullptr, "SetDefaultProxy"},
{0x00360000, nullptr, "ClearDNSCache"},
{0x00370080, nullptr, "SetKeepAlive"},
{0x003800C0, nullptr, "SetPostDataTypeSize"},
{0x00390000, nullptr, "Finalize"},
};
RegisterHandlers(functions);
}
void InstallInterfaces(SM::ServiceManager& service_manager) {
std::make_shared<HTTP_C>()->InstallAsService(service_manager);
}
} // namespace HTTP
} // namespace Service

View File

@ -9,14 +9,12 @@
namespace Service {
namespace HTTP {
class HTTP_C final : public Interface {
class HTTP_C final : public ServiceFramework<HTTP_C> {
public:
HTTP_C();
std::string GetPortName() const override {
return "http:C";
}
};
void InstallInterfaces(SM::ServiceManager& service_manager);
} // namespace HTTP
} // namespace Service

View File

@ -256,7 +256,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm) {
QTM::InstallInterfaces(*sm);
CSND::InstallInterfaces(*sm);
AddService(new HTTP::HTTP_C);
HTTP::InstallInterfaces(*sm);
PM::InstallInterfaces(*sm);
AddService(new SOC::SOC_U);
SSL::InstallInterfaces(*sm);