mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-26 08:04:19 +01:00
Add a base socket (bsd) services implementation
This stubs enough to pass SMO's socket init.
This commit is contained in:
parent
2aefb4ae84
commit
a2c6a2a4ff
@ -122,6 +122,7 @@ add_library(skyline SHARED
|
||||
${source_DIR}/skyline/services/nifm/IStaticService.cpp
|
||||
${source_DIR}/skyline/services/nifm/IGeneralService.cpp
|
||||
${source_DIR}/skyline/services/nifm/IRequest.cpp
|
||||
${source_DIR}/skyline/services/socket/bsd/IClient.cpp
|
||||
${source_DIR}/skyline/vfs/partition_filesystem.cpp
|
||||
${source_DIR}/skyline/vfs/rom_filesystem.cpp
|
||||
${source_DIR}/skyline/vfs/os_backing.cpp
|
||||
|
@ -78,6 +78,7 @@ namespace skyline::service {
|
||||
nifm_IStaticService,
|
||||
nifm_IGeneralService,
|
||||
nifm_IRequest,
|
||||
socket_IClient,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -115,6 +116,7 @@ namespace skyline::service {
|
||||
{"friend:u", Service::friends_IServiceCreator},
|
||||
{"nfp:user", Service::nfp_IUserManager},
|
||||
{"nifm:u", Service::nifm_IStaticService},
|
||||
{"bsd:u", Service::socket_IClient},
|
||||
};
|
||||
|
||||
class ServiceManager;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "friends/IServiceCreator.h"
|
||||
#include "nfp/IUserManager.h"
|
||||
#include "nifm/IStaticService.h"
|
||||
#include "socket/bsd/IClient.h"
|
||||
#include "serviceman.h"
|
||||
|
||||
namespace skyline::service {
|
||||
@ -102,6 +103,9 @@ namespace skyline::service {
|
||||
case Service::nifm_IStaticService:
|
||||
serviceObj = std::make_shared<nifm::IStaticService>(state, *this);
|
||||
break;
|
||||
case Service::socket_IClient:
|
||||
serviceObj = std::make_shared<socket::IClient>(state, *this);
|
||||
break;
|
||||
default:
|
||||
throw exception("CreateService called on missing object, type: {}", serviceType);
|
||||
}
|
||||
|
17
app/src/main/cpp/skyline/services/socket/bsd/IClient.cpp
Normal file
17
app/src/main/cpp/skyline/services/socket/bsd/IClient.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "IClient.h"
|
||||
|
||||
namespace skyline::service::socket {
|
||||
IClient::IClient(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::socket_IClient, "socket:IClient", {
|
||||
{0x0, SFUNC(IClient::RegisterClient)},
|
||||
{0x1, SFUNC(IClient::StartMonitoring)},
|
||||
}) {}
|
||||
|
||||
void IClient::RegisterClient(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<u32>(0);
|
||||
}
|
||||
|
||||
void IClient::StartMonitoring(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
||||
}
|
27
app/src/main/cpp/skyline/services/socket/bsd/IClient.h
Normal file
27
app/src/main/cpp/skyline/services/socket/bsd/IClient.h
Normal file
@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <services/base_service.h>
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::socket {
|
||||
/**
|
||||
* @brief IClient or bsd:u is used by applications create network sockets (https://switchbrew.org/wiki/Sockets_services#bsd:u.2C_bsd:s)
|
||||
*/
|
||||
class IClient : public BaseService {
|
||||
public:
|
||||
IClient(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @brief This initializes a socket client with the given parameters (https://switchbrew.org/wiki/Sockets_services#Initialize)
|
||||
*/
|
||||
void RegisterClient(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This starts the monitoring of the socket
|
||||
*/
|
||||
void StartMonitoring(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user