wut  v1.7.0
Wii U Toolchain
Cafe.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <wut.h>
4 #include <nn/result.h>
5 #include <nn/cfg/CTR.h>
7 
15 #ifdef __cplusplus
16 
17 namespace nn {
18 
19 namespace dlp {
20 
21 namespace Cafe {
22  enum PollStateChangeFlags : uint8_t {
25  };
26  WUT_CHECK_SIZE(PollStateChangeFlags, 0x1);
27 
29  enum class ClientState : uint32_t {
31  Accepted = 5,
33  Receiving = 6,
35  Ready = 7,
37  Connecting = 64
38  };
39  WUT_CHECK_SIZE(ClientState, 0x4);
40 
42  enum class ServerState : uint32_t {
44  Uninitialized = 0,
46  Idle = 1,
48  Open = 2,
52  Distributed = 8,
54  Finished = 9,
56  Failed = 10,
58  Distributing = 11
59  };
60  WUT_CHECK_SIZE(ServerState, 0x4);
61 
62  class Server {
63  public:
70  static nn::Result
71  AcceptClient(uint16_t nodeId) asm("AcceptClient__Q4_2nn3dlp4Cafe6ServerSFUs");
72 
76  static nn::Result
77  CloseSessions() asm("CloseSessions__Q4_2nn3dlp4Cafe6ServerSFv");
78 
85  static nn::Result
86  DisconnectClient(uint16_t nodeId) asm("DisconnectClient__Q4_2nn3dlp4Cafe6ServerSFUs");
87 
91  static nn::Result
92  Finalize() asm("Finalize__Q4_2nn3dlp4Cafe6ServerSFv");
93 
103  static nn::Result
104  GetClientInfo(nn::uds::Cafe::NodeInformation *clientInfo, uint16_t nodeId) asm("GetClientInfo__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3uds4Cafe15NodeInformationUs");
105 
115  static nn::Result
116  GetClientState(ClientState *state, uint16_t nodeId) asm("GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStateUs");
117 
135  static nn::Result
137  uint32_t *unitsTotal,
138  uint32_t *unitsReceived,
139  uint16_t nodeId) asm("GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStatePUiT2Us");
140 
153  static nn::Result
154  GetConnectingClients(uint16_t *receivedLength,
155  uint16_t *connectingClients,
156  uint16_t length) asm("GetConnectingClients__Q4_2nn3dlp4Cafe6ServerSFPUsT1Us");
157 
164  static nn::Result
165  GetState(ServerState *state) asm("GetState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ServerState");
166 
182  static nn::Result
183  Initialize(uint8_t maxClientNum,
184  uint32_t uniqueId,
185  uint8_t childIndex,
186  nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe6ServerSFUcUiT1PQ4_2nn3cfg3CTR8UserName");
187 
206  static nn::Result
207  Initialize(bool *dupNoticeNeed,
208  uint8_t maxClientNum,
209  uint32_t uniqueId,
210  uint8_t childIndex,
211  nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe6ServerSFPbUcUiT2PQ4_2nn3cfg3CTR8UserName");
212 
223  static nn::Result
224  OpenSessions(bool isManualAccept, uint8_t channel) asm("OpenSessions__Q4_2nn3dlp4Cafe6ServerSFbUc");
225 
232  static nn::Result
233  PollStateChange(uint8_t flags) asm("PollStateChange__Q4_2nn3dlp4Cafe6ServerSFUc");
234 
242  static nn::Result
243  RebootAllClients(const char *passPhrase) asm("RebootAllClients__Q4_2nn3dlp4Cafe6ServerSFPCc");
244 
248  static nn::Result
249  StartDistribution() asm("StartDistribute__Q4_2nn3dlp4Cafe6ServerSFv");
250  };
251 
253  public:
260  static nn::Result
261  GetInternalState(ServerState *state) asm("GetInternalState__Q4_2nn3dlp4Cafe13ServerPrivateSFPQ4_2nn3dlp4Cafe11ServerState");
262 
284  static nn::Result
285  Initialize(uint8_t maxClientNum,
286  uint32_t uniqueId,
287  uint8_t childIndex,
288  uint32_t blockBufferSize,
289  uint32_t blockBufferNum,
290  nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFUcUiT1N22PQ4_2nn3cfg3CTR8UserName");
291 
316  static nn::Result
317  Initialize(bool *dupNoticeNeed,
318  uint8_t maxClientNum,
319  uint32_t uniqueId,
320  uint8_t childIndex,
321  uint32_t blockBufferSize,
322  uint32_t blockBufferNum,
323  nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFPbUcUiT2N23PQ4_2nn3cfg3CTR8UserName");
324  };
325 } // namespace Cafe
326 
327 } // namespace dlp
328 
329 } // namespace nn
330 
333 #endif
Result value type used by nn libraries.
Definition: result.h:68
static nn::Result GetInternalState(ServerState *state) asm("GetInternalState__Q4_2nn3dlp4Cafe13ServerPrivateSFPQ4_2nn3dlp4Cafe11ServerState")
Gets the server state.
static nn::Result Initialize(uint8_t maxClientNum, uint32_t uniqueId, uint8_t childIndex, uint32_t blockBufferSize, uint32_t blockBufferNum, nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFUcUiT1N22PQ4_2nn3cfg3CTR8UserName")
Initializes DLP.
static nn::Result Initialize(bool *dupNoticeNeed, uint8_t maxClientNum, uint32_t uniqueId, uint8_t childIndex, uint32_t blockBufferSize, uint32_t blockBufferNum, nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe13ServerPrivateSFPbUcUiT2N23PQ4_2nn3cfg3CTR8UserName")
Initializes DLP.
static nn::Result RebootAllClients(const char *passPhrase) asm("RebootAllClients__Q4_2nn3dlp4Cafe6ServerSFPCc")
Reboots all clients into the Download Play child.
static nn::Result Finalize() asm("Finalize__Q4_2nn3dlp4Cafe6ServerSFv")
Finalizes DLP.
static nn::Result CloseSessions() asm("CloseSessions__Q4_2nn3dlp4Cafe6ServerSFv")
Closes the DLP session.
static nn::Result GetState(ServerState *state) asm("GetState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ServerState")
Gets the server state.
static nn::Result OpenSessions(bool isManualAccept, uint8_t channel) asm("OpenSessions__Q4_2nn3dlp4Cafe6ServerSFbUc")
Opens the DLP session.
static nn::Result StartDistribution() asm("StartDistribute__Q4_2nn3dlp4Cafe6ServerSFv")
Starts distribution of the Download Play child.
static nn::Result AcceptClient(uint16_t nodeId) asm("AcceptClient__Q4_2nn3dlp4Cafe6ServerSFUs")
Accepts a client into the DLP child distribution.
static nn::Result GetClientState(ClientState *state, uint16_t nodeId) asm("GetClientState__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3dlp4Cafe11ClientStateUs")
Gets a client state.
static nn::Result GetClientInfo(nn::uds::Cafe::NodeInformation *clientInfo, uint16_t nodeId) asm("GetClientInfo__Q4_2nn3dlp4Cafe6ServerSFPQ4_2nn3uds4Cafe15NodeInformationUs")
Gets information about a client.
static nn::Result DisconnectClient(uint16_t nodeId) asm("DisconnectClient__Q4_2nn3dlp4Cafe6ServerSFUs")
Disconnects a client from the DLP session.
static nn::Result PollStateChange(uint8_t flags) asm("PollStateChange__Q4_2nn3dlp4Cafe6ServerSFUc")
Checks if the server state chas changed, and waits until it changes if specified.
static nn::Result GetConnectingClients(uint16_t *receivedLength, uint16_t *connectingClients, uint16_t length) asm("GetConnectingClients__Q4_2nn3dlp4Cafe6ServerSFPUsT1Us")
Gets the clients that are connected to the DLP session.
static nn::Result Initialize(uint8_t maxClientNum, uint32_t uniqueId, uint8_t childIndex, nn::cfg::CTR::UserName *userName) asm("Initialize__Q4_2nn3dlp4Cafe6ServerSFUcUiT1PQ4_2nn3cfg3CTR8UserName")
Initializes DLP.
Represents a console username, used in UDS and DLP.
Definition: CTR.h:14
ClientState
Represents the client state.
Definition: Cafe.h:29
@ Receiving
The client is receiving the distributed DLP child.
@ Accepted
The client is accepted for the DLP child distribution.
@ Connecting
The client is connected to the session and pending to be accepted.
@ Ready
The client has received the distribution and is ready to boot the DLP child.
ServerState
Represents the server state. All values between 3 and 7 are considered internal state.
Definition: Cafe.h:42
@ Distributed
The server has distributed the DLP child.
@ DistributingInternal
The server is distributing the DLP child to the clients.
@ Finished
The server has finished distribution and clients are booted into the DLP child.
@ Open
The server is open to new connections.
@ Failed
The server failed to distribute the DLP child to the clients.
@ Idle
The server is initialized but there is no active network.
@ Distributing
Public value for internal states.
@ Uninitialized
The server is not initialized.
PollStateChangeFlags
Definition: Cafe.h:22
@ DLP_POLL_NONBLOCK
Prevents PollStateChange from blocking if no new data is available.
Definition: Cafe.h:24
Definition: ac_cpp.h:15