blob: 26f5f14effd75a855348de151a9b4159674d32b8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <string>
#include "common/common_types.h"
#include "core/hle/kernel/k_client_port.h"
#include "core/hle/kernel/k_server_port.h"
#include "core/hle/kernel/slab_helpers.h"
#include "core/hle/result.h"
namespace Kernel {
class KLightServerSession;
class KServerSession;
class KPort final : public KAutoObjectWithSlabHeapAndContainer<KPort, KAutoObjectWithList> {
KERNEL_AUTOOBJECT_TRAITS(KPort, KAutoObject);
public:
explicit KPort(KernelCore& kernel);
~KPort() override;
static void PostDestroy(uintptr_t arg) {}
void Initialize(s32 max_sessions, bool is_light, uintptr_t name);
void OnClientClosed();
void OnServerClosed();
uintptr_t GetName() const {
return m_name;
}
bool IsLight() const {
return m_is_light;
}
bool IsServerClosed() const;
Result EnqueueSession(KServerSession* session);
Result EnqueueSession(KLightServerSession* session);
KClientPort& GetClientPort() {
return m_client;
}
KServerPort& GetServerPort() {
return m_server;
}
const KClientPort& GetClientPort() const {
return m_client;
}
const KServerPort& GetServerPort() const {
return m_server;
}
private:
enum class State : u8 {
Invalid = 0,
Normal = 1,
ClientClosed = 2,
ServerClosed = 3,
};
KServerPort m_server;
KClientPort m_client;
uintptr_t m_name;
State m_state{State::Invalid};
bool m_is_light{};
};
} // namespace Kernel
|