fs.mitm: Get Title ID on fsp-srv init, Add worker to handle subinterfaces.

This commit is contained in:
Michael Scire 2018-06-10 03:06:50 -06:00
parent 76b1f49766
commit 581d3de04f
2 changed files with 77 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include "stratosphere/serviceserver.hpp" #include "stratosphere/serviceserver.hpp"
#include "stratosphere/managedportserver.hpp" #include "stratosphere/managedportserver.hpp"
#include "stratosphere/existingportserver.hpp" #include "stratosphere/existingportserver.hpp"
#include "stratosphere/childholder.hpp"
#include "stratosphere/ievent.hpp" #include "stratosphere/ievent.hpp"
#include "stratosphere/systemevent.hpp" #include "stratosphere/systemevent.hpp"

View File

@ -0,0 +1,76 @@
#pragma once
#include <switch.h>
#include <vector>
#include "iwaitable.hpp"
class ChildWaitableHolder : public IWaitable {
protected:
std::vector<IWaitable *> children;
public:
/* Implicit constructor. */
void add_child(IWaitable *child) {
this->children.push_back(child);
}
virtual ~ChildWaitableHolder() {
for (unsigned int i = 0; i < this->children.size(); i++) {
delete this->children[i];
}
this->children.clear();
}
/* IWaitable */
virtual unsigned int get_num_waitables() {
unsigned int n = 0;
for (unsigned int i = 0; i < this->children.size(); i++) {
if (this->children[i]) {
n += this->children[i]->get_num_waitables();
}
}
return n;
}
virtual void get_waitables(IWaitable **dst) {
unsigned int n = 0;
for (unsigned int i = 0; i < this->children.size(); i++) {
if (this->children[i]) {
this->children[i]->get_waitables(&dst[n]);
n += this->children[i]->get_num_waitables();
}
}
}
virtual void delete_child(IWaitable *child) {
unsigned int i;
for (i = 0; i < this->children.size(); i++) {
if (this->children[i] == child) {
break;
}
}
if (i == this->children.size()) {
/* TODO: Panic, because this isn't our child. */
} else {
delete this->children[i];
this->children.erase(this->children.begin() + i);
}
}
virtual Handle get_handle() {
/* We don't have a handle. */
return 0;
}
virtual void handle_deferred() {
/* TODO: Panic, because we can never defer a server. */
}
virtual Result handle_signaled(u64 timeout) {
/* TODO: Panic, because we can never be signalled. */
return 0;
}
};