summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/psc/psc.cpp18
-rw-r--r--src/core/hle/service/ssl/ssl.cpp76
-rw-r--r--src/core/hle/service/usb/usb.cpp70
3 files changed, 102 insertions, 62 deletions
diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp
index 25702703e..cd0cc9287 100644
--- a/src/core/hle/service/psc/psc.cpp
+++ b/src/core/hle/service/psc/psc.cpp
@@ -11,9 +11,9 @@
11 11
12namespace Service::PSC { 12namespace Service::PSC {
13 13
14class PSC_C final : public ServiceFramework<PSC_C> { 14class IPmControl final : public ServiceFramework<IPmControl> {
15public: 15public:
16 explicit PSC_C(Core::System& system_) : ServiceFramework{system_, "psc:c"} { 16 explicit IPmControl(Core::System& system_) : ServiceFramework{system_, "psc:c"} {
17 // clang-format off 17 // clang-format off
18 static const FunctionInfo functions[] = { 18 static const FunctionInfo functions[] = {
19 {0, nullptr, "Initialize"}, 19 {0, nullptr, "Initialize"},
@@ -23,8 +23,8 @@ public:
23 {4, nullptr, "Cancel"}, 23 {4, nullptr, "Cancel"},
24 {5, nullptr, "PrintModuleInformation"}, 24 {5, nullptr, "PrintModuleInformation"},
25 {6, nullptr, "GetModuleInformation"}, 25 {6, nullptr, "GetModuleInformation"},
26 {10, nullptr, "Unknown10"}, 26 {10, nullptr, "AcquireStateLock"},
27 {11, nullptr, "Unknown11"}, 27 {11, nullptr, "HasStateLock"},
28 }; 28 };
29 // clang-format on 29 // clang-format on
30 30
@@ -49,12 +49,12 @@ public:
49 } 49 }
50}; 50};
51 51
52class PSC_M final : public ServiceFramework<PSC_M> { 52class IPmService final : public ServiceFramework<IPmService> {
53public: 53public:
54 explicit PSC_M(Core::System& system_) : ServiceFramework{system_, "psc:m"} { 54 explicit IPmService(Core::System& system_) : ServiceFramework{system_, "psc:m"} {
55 // clang-format off 55 // clang-format off
56 static const FunctionInfo functions[] = { 56 static const FunctionInfo functions[] = {
57 {0, &PSC_M::GetPmModule, "GetPmModule"}, 57 {0, &IPmService::GetPmModule, "GetPmModule"},
58 }; 58 };
59 // clang-format on 59 // clang-format on
60 60
@@ -74,8 +74,8 @@ private:
74void LoopProcess(Core::System& system) { 74void LoopProcess(Core::System& system) {
75 auto server_manager = std::make_unique<ServerManager>(system); 75 auto server_manager = std::make_unique<ServerManager>(system);
76 76
77 server_manager->RegisterNamedService("psc:c", std::make_shared<PSC_C>(system)); 77 server_manager->RegisterNamedService("psc:c", std::make_shared<IPmControl>(system));
78 server_manager->RegisterNamedService("psc:m", std::make_shared<PSC_M>(system)); 78 server_manager->RegisterNamedService("psc:m", std::make_shared<IPmService>(system));
79 ServerManager::RunServer(std::move(server_manager)); 79 ServerManager::RunServer(std::move(server_manager));
80} 80}
81 81
diff --git a/src/core/hle/service/ssl/ssl.cpp b/src/core/hle/service/ssl/ssl.cpp
index b19bc1b3e..2b99dd7ac 100644
--- a/src/core/hle/service/ssl/ssl.cpp
+++ b/src/core/hle/service/ssl/ssl.cpp
@@ -8,14 +8,36 @@
8 8
9namespace Service::SSL { 9namespace Service::SSL {
10 10
11// This is nn::ssl::sf::CertificateFormat
11enum class CertificateFormat : u32 { 12enum class CertificateFormat : u32 {
12 Pem = 1, 13 Pem = 1,
13 Der = 2, 14 Der = 2,
14}; 15};
15 16
17// This is nn::ssl::sf::ContextOption
18enum class ContextOption : u32 {
19 None = 0,
20 CrlImportDateCheckEnable = 1,
21};
22
23// This is nn::ssl::sf::SslVersion
24struct SslVersion {
25 union {
26 u32 raw{};
27
28 BitField<0, 1, u32> tls_auto;
29 BitField<3, 1, u32> tls_v10;
30 BitField<4, 1, u32> tls_v11;
31 BitField<5, 1, u32> tls_v12;
32 BitField<6, 1, u32> tls_v13;
33 BitField<24, 7, u32> api_version;
34 };
35};
36
16class ISslConnection final : public ServiceFramework<ISslConnection> { 37class ISslConnection final : public ServiceFramework<ISslConnection> {
17public: 38public:
18 explicit ISslConnection(Core::System& system_) : ServiceFramework{system_, "ISslConnection"} { 39 explicit ISslConnection(Core::System& system_, SslVersion version)
40 : ServiceFramework{system_, "ISslConnection"}, ssl_version{version} {
19 // clang-format off 41 // clang-format off
20 static const FunctionInfo functions[] = { 42 static const FunctionInfo functions[] = {
21 {0, nullptr, "SetSocketDescriptor"}, 43 {0, nullptr, "SetSocketDescriptor"},
@@ -59,11 +81,15 @@ public:
59 81
60 RegisterHandlers(functions); 82 RegisterHandlers(functions);
61 } 83 }
84
85private:
86 SslVersion ssl_version;
62}; 87};
63 88
64class ISslContext final : public ServiceFramework<ISslContext> { 89class ISslContext final : public ServiceFramework<ISslContext> {
65public: 90public:
66 explicit ISslContext(Core::System& system_) : ServiceFramework{system_, "ISslContext"} { 91 explicit ISslContext(Core::System& system_, SslVersion version)
92 : ServiceFramework{system_, "ISslContext"}, ssl_version{version} {
67 static const FunctionInfo functions[] = { 93 static const FunctionInfo functions[] = {
68 {0, &ISslContext::SetOption, "SetOption"}, 94 {0, &ISslContext::SetOption, "SetOption"},
69 {1, nullptr, "GetOption"}, 95 {1, nullptr, "GetOption"},
@@ -84,17 +110,20 @@ public:
84 } 110 }
85 111
86private: 112private:
113 SslVersion ssl_version;
114
87 void SetOption(HLERequestContext& ctx) { 115 void SetOption(HLERequestContext& ctx) {
88 struct Parameters { 116 struct Parameters {
89 u8 enable; 117 ContextOption option;
90 u32 option; 118 s32 value;
91 }; 119 };
120 static_assert(sizeof(Parameters) == 0x8, "Parameters is an invalid size");
92 121
93 IPC::RequestParser rp{ctx}; 122 IPC::RequestParser rp{ctx};
94 const auto parameters = rp.PopRaw<Parameters>(); 123 const auto parameters = rp.PopRaw<Parameters>();
95 124
96 LOG_WARNING(Service_SSL, "(STUBBED) called. enable={}, option={}", parameters.enable, 125 LOG_WARNING(Service_SSL, "(STUBBED) called. option={}, value={}", parameters.option,
97 parameters.option); 126 parameters.value);
98 127
99 IPC::ResponseBuilder rb{ctx, 2}; 128 IPC::ResponseBuilder rb{ctx, 2};
100 rb.Push(ResultSuccess); 129 rb.Push(ResultSuccess);
@@ -105,7 +134,7 @@ private:
105 134
106 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 135 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
107 rb.Push(ResultSuccess); 136 rb.Push(ResultSuccess);
108 rb.PushIpcInterface<ISslConnection>(system); 137 rb.PushIpcInterface<ISslConnection>(system, ssl_version);
109 } 138 }
110 139
111 void ImportServerPki(HLERequestContext& ctx) { 140 void ImportServerPki(HLERequestContext& ctx) {
@@ -142,20 +171,21 @@ private:
142 } 171 }
143}; 172};
144 173
145class SSL final : public ServiceFramework<SSL> { 174class ISslService final : public ServiceFramework<ISslService> {
146public: 175public:
147 explicit SSL(Core::System& system_) : ServiceFramework{system_, "ssl"} { 176 explicit ISslService(Core::System& system_) : ServiceFramework{system_, "ssl"} {
148 // clang-format off 177 // clang-format off
149 static const FunctionInfo functions[] = { 178 static const FunctionInfo functions[] = {
150 {0, &SSL::CreateContext, "CreateContext"}, 179 {0, &ISslService::CreateContext, "CreateContext"},
151 {1, nullptr, "GetContextCount"}, 180 {1, nullptr, "GetContextCount"},
152 {2, nullptr, "GetCertificates"}, 181 {2, nullptr, "GetCertificates"},
153 {3, nullptr, "GetCertificateBufSize"}, 182 {3, nullptr, "GetCertificateBufSize"},
154 {4, nullptr, "DebugIoctl"}, 183 {4, nullptr, "DebugIoctl"},
155 {5, &SSL::SetInterfaceVersion, "SetInterfaceVersion"}, 184 {5, &ISslService::SetInterfaceVersion, "SetInterfaceVersion"},
156 {6, nullptr, "FlushSessionCache"}, 185 {6, nullptr, "FlushSessionCache"},
157 {7, nullptr, "SetDebugOption"}, 186 {7, nullptr, "SetDebugOption"},
158 {8, nullptr, "GetDebugOption"}, 187 {8, nullptr, "GetDebugOption"},
188 {8, nullptr, "ClearTls12FallbackFlag"},
159 }; 189 };
160 // clang-format on 190 // clang-format on
161 191
@@ -163,20 +193,30 @@ public:
163 } 193 }
164 194
165private: 195private:
166 u32 ssl_version{};
167 void CreateContext(HLERequestContext& ctx) { 196 void CreateContext(HLERequestContext& ctx) {
168 LOG_WARNING(Service_SSL, "(STUBBED) called"); 197 struct Parameters {
198 SslVersion ssl_version;
199 INSERT_PADDING_BYTES(0x4);
200 u64 pid_placeholder;
201 };
202 static_assert(sizeof(Parameters) == 0x10, "Parameters is an invalid size");
203
204 IPC::RequestParser rp{ctx};
205 const auto parameters = rp.PopRaw<Parameters>();
206
207 LOG_WARNING(Service_SSL, "(STUBBED) called, api_version={}, pid_placeholder={}",
208 parameters.ssl_version.api_version, parameters.pid_placeholder);
169 209
170 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 210 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
171 rb.Push(ResultSuccess); 211 rb.Push(ResultSuccess);
172 rb.PushIpcInterface<ISslContext>(system); 212 rb.PushIpcInterface<ISslContext>(system, parameters.ssl_version);
173 } 213 }
174 214
175 void SetInterfaceVersion(HLERequestContext& ctx) { 215 void SetInterfaceVersion(HLERequestContext& ctx) {
176 LOG_DEBUG(Service_SSL, "called");
177
178 IPC::RequestParser rp{ctx}; 216 IPC::RequestParser rp{ctx};
179 ssl_version = rp.Pop<u32>(); 217 u32 ssl_version = rp.Pop<u32>();
218
219 LOG_DEBUG(Service_SSL, "called, ssl_version={}", ssl_version);
180 220
181 IPC::ResponseBuilder rb{ctx, 2}; 221 IPC::ResponseBuilder rb{ctx, 2};
182 rb.Push(ResultSuccess); 222 rb.Push(ResultSuccess);
@@ -186,7 +226,7 @@ private:
186void LoopProcess(Core::System& system) { 226void LoopProcess(Core::System& system) {
187 auto server_manager = std::make_unique<ServerManager>(system); 227 auto server_manager = std::make_unique<ServerManager>(system);
188 228
189 server_manager->RegisterNamedService("ssl", std::make_shared<SSL>(system)); 229 server_manager->RegisterNamedService("ssl", std::make_shared<ISslService>(system));
190 ServerManager::RunServer(std::move(server_manager)); 230 ServerManager::RunServer(std::move(server_manager));
191} 231}
192 232
diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp
index a2855e783..f29fff1dd 100644
--- a/src/core/hle/service/usb/usb.cpp
+++ b/src/core/hle/service/usb/usb.cpp
@@ -16,19 +16,19 @@ public:
16 explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} { 16 explicit IDsInterface(Core::System& system_) : ServiceFramework{system_, "IDsInterface"} {
17 // clang-format off 17 // clang-format off
18 static const FunctionInfo functions[] = { 18 static const FunctionInfo functions[] = {
19 {0, nullptr, "BindDevice"}, 19 {0, nullptr, "AddEndpoint"},
20 {1, nullptr, "BindClientProcess"}, 20 {1, nullptr, "GetSetupEvent"},
21 {2, nullptr, "AddInterface"}, 21 {2, nullptr, "GetSetupPacket"},
22 {3, nullptr, "GetStateChangeEvent"}, 22 {3, nullptr, "Enable"},
23 {4, nullptr, "GetState"}, 23 {4, nullptr, "Disable"},
24 {5, nullptr, "ClearDeviceData"}, 24 {5, nullptr, "CtrlIn"},
25 {6, nullptr, "AddUsbStringDescriptor"}, 25 {6, nullptr, "CtrlOut"},
26 {7, nullptr, "DeleteUsbStringDescriptor"}, 26 {7, nullptr, "GetCtrlInCompletionEvent"},
27 {8, nullptr, "SetUsbDeviceDescriptor"}, 27 {8, nullptr, "GetCtrlInUrbReport"},
28 {9, nullptr, "SetBinaryObjectStore"}, 28 {9, nullptr, "GetCtrlOutCompletionEvent"},
29 {10, nullptr, "Enable"}, 29 {10, nullptr, "GetCtrlOutUrbReport"},
30 {11, nullptr, "Disable"}, 30 {11, nullptr, "CtrlStall"},
31 {12, nullptr, "Unknown12"}, 31 {12, nullptr, "AppendConfigurationData"},
32 }; 32 };
33 // clang-format on 33 // clang-format on
34 34
@@ -36,9 +36,9 @@ public:
36 } 36 }
37}; 37};
38 38
39class USB_DS final : public ServiceFramework<USB_DS> { 39class IDsRootSession final : public ServiceFramework<IDsRootSession> {
40public: 40public:
41 explicit USB_DS(Core::System& system_) : ServiceFramework{system_, "usb:ds"} { 41 explicit IDsRootSession(Core::System& system_) : ServiceFramework{system_, "usb:ds"} {
42 // clang-format off 42 // clang-format off
43 static const FunctionInfo functions[] = { 43 static const FunctionInfo functions[] = {
44 {0, nullptr, "OpenDsService"}, 44 {0, nullptr, "OpenDsService"},
@@ -94,9 +94,9 @@ public:
94 } 94 }
95}; 95};
96 96
97class USB_HS final : public ServiceFramework<USB_HS> { 97class IClientRootSession final : public ServiceFramework<IClientRootSession> {
98public: 98public:
99 explicit USB_HS(Core::System& system_) : ServiceFramework{system_, "usb:hs"} { 99 explicit IClientRootSession(Core::System& system_) : ServiceFramework{system_, "usb:hs"} {
100 // clang-format off 100 // clang-format off
101 static const FunctionInfo functions[] = { 101 static const FunctionInfo functions[] = {
102 {0, nullptr, "BindClientProcess"}, 102 {0, nullptr, "BindClientProcess"},
@@ -107,7 +107,7 @@ public:
107 {5, nullptr, "DestroyInterfaceAvailableEvent"}, 107 {5, nullptr, "DestroyInterfaceAvailableEvent"},
108 {6, nullptr, "GetInterfaceStateChangeEvent"}, 108 {6, nullptr, "GetInterfaceStateChangeEvent"},
109 {7, nullptr, "AcquireUsbIf"}, 109 {7, nullptr, "AcquireUsbIf"},
110 {8, nullptr, "ResetDevice"}, 110 {8, nullptr, "SetTestMode"},
111 }; 111 };
112 // clang-format on 112 // clang-format on
113 113
@@ -134,12 +134,12 @@ public:
134 } 134 }
135}; 135};
136 136
137class USB_PD final : public ServiceFramework<USB_PD> { 137class IPdManager final : public ServiceFramework<IPdManager> {
138public: 138public:
139 explicit USB_PD(Core::System& system_) : ServiceFramework{system_, "usb:pd"} { 139 explicit IPdManager(Core::System& system_) : ServiceFramework{system_, "usb:pd"} {
140 // clang-format off 140 // clang-format off
141 static const FunctionInfo functions[] = { 141 static const FunctionInfo functions[] = {
142 {0, &USB_PD::GetPdSession, "GetPdSession"}, 142 {0, &IPdManager::OpenSession, "OpenSession"},
143 }; 143 };
144 // clang-format on 144 // clang-format on
145 145
@@ -147,7 +147,7 @@ public:
147 } 147 }
148 148
149private: 149private:
150 void GetPdSession(HLERequestContext& ctx) { 150 void OpenSession(HLERequestContext& ctx) {
151 LOG_DEBUG(Service_USB, "called"); 151 LOG_DEBUG(Service_USB, "called");
152 152
153 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 153 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
@@ -178,12 +178,12 @@ public:
178 } 178 }
179}; 179};
180 180
181class USB_PD_C final : public ServiceFramework<USB_PD_C> { 181class IPdCradleManager final : public ServiceFramework<IPdCradleManager> {
182public: 182public:
183 explicit USB_PD_C(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} { 183 explicit IPdCradleManager(Core::System& system_) : ServiceFramework{system_, "usb:pd:c"} {
184 // clang-format off 184 // clang-format off
185 static const FunctionInfo functions[] = { 185 static const FunctionInfo functions[] = {
186 {0, &USB_PD_C::GetPdCradleSession, "GetPdCradleSession"}, 186 {0, &IPdCradleManager::OpenCradleSession, "OpenCradleSession"},
187 }; 187 };
188 // clang-format on 188 // clang-format on
189 189
@@ -191,18 +191,18 @@ public:
191 } 191 }
192 192
193private: 193private:
194 void GetPdCradleSession(HLERequestContext& ctx) { 194 void OpenCradleSession(HLERequestContext& ctx) {
195 LOG_DEBUG(Service_USB, "called");
196
195 IPC::ResponseBuilder rb{ctx, 2, 0, 1}; 197 IPC::ResponseBuilder rb{ctx, 2, 0, 1};
196 rb.Push(ResultSuccess); 198 rb.Push(ResultSuccess);
197 rb.PushIpcInterface<IPdCradleSession>(system); 199 rb.PushIpcInterface<IPdCradleSession>(system);
198
199 LOG_DEBUG(Service_USB, "called");
200 } 200 }
201}; 201};
202 202
203class USB_PM final : public ServiceFramework<USB_PM> { 203class IPmMainService final : public ServiceFramework<IPmMainService> {
204public: 204public:
205 explicit USB_PM(Core::System& system_) : ServiceFramework{system_, "usb:pm"} { 205 explicit IPmMainService(Core::System& system_) : ServiceFramework{system_, "usb:pm"} {
206 // clang-format off 206 // clang-format off
207 static const FunctionInfo functions[] = { 207 static const FunctionInfo functions[] = {
208 {0, nullptr, "GetPowerEvent"}, 208 {0, nullptr, "GetPowerEvent"},
@@ -221,11 +221,11 @@ public:
221void LoopProcess(Core::System& system) { 221void LoopProcess(Core::System& system) {
222 auto server_manager = std::make_unique<ServerManager>(system); 222 auto server_manager = std::make_unique<ServerManager>(system);
223 223
224 server_manager->RegisterNamedService("usb:ds", std::make_shared<USB_DS>(system)); 224 server_manager->RegisterNamedService("usb:ds", std::make_shared<IDsRootSession>(system));
225 server_manager->RegisterNamedService("usb:hs", std::make_shared<USB_HS>(system)); 225 server_manager->RegisterNamedService("usb:hs", std::make_shared<IClientRootSession>(system));
226 server_manager->RegisterNamedService("usb:pd", std::make_shared<USB_PD>(system)); 226 server_manager->RegisterNamedService("usb:pd", std::make_shared<IPdManager>(system));
227 server_manager->RegisterNamedService("usb:pd:c", std::make_shared<USB_PD_C>(system)); 227 server_manager->RegisterNamedService("usb:pd:c", std::make_shared<IPdCradleManager>(system));
228 server_manager->RegisterNamedService("usb:pm", std::make_shared<USB_PM>(system)); 228 server_manager->RegisterNamedService("usb:pm", std::make_shared<IPmMainService>(system));
229 ServerManager::RunServer(std::move(server_manager)); 229 ServerManager::RunServer(std::move(server_manager));
230} 230}
231 231