wut  v1.7.0
Wii U Toolchain
Data Structures | Typedefs | Enumerations | Functions | Variables
nn::uds::Cafe Namespace Reference

Data Structures

struct  ConnectionStatus
 Stores the connection status of the network. More...
 
struct  NodeInformation
 Stores information about a node. More...
 
struct  ScrambledLocalFriendCode
 Stores data about the scrambled local friend code of a node. More...
 

Typedefs

using EndpointDescriptor = uint32_t
 Describes a network endpoint. More...
 

Enumerations

enum  PollStateChangeFlags : uint8_t { UDS_POLL_NONBLOCK = 1 << 0 }
 
enum  ReceiveFlags : uint8_t { UDS_RECEIVE_NONBLOCK = 1 << 0 }
 

Functions

nn::Result AllowToConnect () asm("AllowToConnect__Q3_2nn3uds4CafeFv")
 Allows clients to connect to the network. More...
 
nn::Result AllowToSpectate () asm("AllowToSpectate__Q3_2nn3uds4CafeFv")
 Allows clients to spectate the network. More...
 
nn::Result Attach (EndpointDescriptor *fd, uint16_t networkNodeId, uint8_t dataChannel, uint32_t recvBufferSize) asm("Attach__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe18EndpointDescriptorUsUcUi")
 Attaches an endpoint to a specified node. More...
 
uint32_t CreateLocalCommunicationId (uint32_t uniqueId, bool unknown) asm("CreateLocalCommunicationId__Q3_2nn3uds4CafeFUib")
 Creates a local communication ID based on the given paramaters. More...
 
nn::Result CreateEndpoint (EndpointDescriptor *fd) asm("CreateEndpoint__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe18EndpointDescriptor")
 Creates a new endpoint. More...
 
nn::Result CreateNetwork (uint8_t id8, uint8_t maxNodes, uint32_t localCommunicationId, const char *passphrase, uint32_t passphraseSize, uint8_t channel) asm("CreateNetwork__Q3_2nn3uds4CafeFUcT1UiPCcT3T1")
 Creates a new network with the given parameters. More...
 
nn::Result CreateNetwork (uint8_t id8, uint8_t maxNodes, uint32_t localCommunicationId, const char *passphrase, uint32_t passphraseSize, uint8_t channel, const void *appData, uint32_t appDataSize) asm("CreateNetwork__Q3_2nn3uds4CafeFUcT1UiPCcT3T1PCvT3")
 Creates a new network with the given parameters. More...
 
nn::Result CreateNetwork (uint8_t id8, uint8_t maxNodes, uint32_t localCommunicationId, const char *passphrase, uint32_t passphraseSize, bool unused, uint8_t channel, const void *appData, uint32_t appDataSize) asm("CreateNetwork__Q3_2nn3uds4CafeFUcT1UiPCcT3bT1PCvT3")
 Creates a new network with the given parameters. More...
 
nn::Result DestroyEndpoint (EndpointDescriptor *fd) asm("DestroyEndpoint__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe18EndpointDescriptor")
 Destroys the given endpoint. More...
 
nn::Result DestroyNetwork () asm("DestroyNetwork__Q3_2nn3uds4CafeFv")
 Destroys the previously created network. More...
 
nn::Result DisallowToConnect (bool unknown) asm("DisallowToConnect__Q3_2nn3uds4CafeFb")
 Prevents clients from connecting to the network. More...
 
nn::Result EjectClient (uint16_t networkNodeId) asm("EjectClient__Q3_2nn3uds4CafeFUs")
 Ejects the specified client from the network. More...
 
nn::Result EjectSpectator () asm("EjectSpectator__Q3_2nn3uds4CafeFv")
 Ejects all spectators from the network. More...
 
void Finalize () asm("Finalize__Q3_2nn3uds4CafeFv")
 Finalizes UDS. More...
 
nn::Result GetApplicationDataFromBeacon (void *appData, uint32_t *readSize, uint32_t size) asm("GetApplicationDataFromBeacon__Q3_2nn3uds4CafeFPvPUiUi")
 Gets the application data from the network. More...
 
nn::Result GetChannel (uint8_t *channel) asm("GetChannel__Q3_2nn3uds4CafeFPUc")
 Gets the network channel. More...
 
nn::Result GetConnectionStatus (ConnectionStatus *status) asm("GetConnectionStatus__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe16ConnectionStatus")
 Retrieves the connection status of the network. More...
 
nn::Result GetNodeInformation (NodeInformation *info, uint16_t networkNodeId) asm("GetNodeInformation__Q3_2nn3uds4CafeFPQ4_2nn3uds4Cafe15NodeInformationUs")
 Gets information about a specified node. More...
 
nn::Result Initialize (void *workMemory, uint32_t workMemorySize) asm("Initialize__Q3_2nn3uds4CafeFPvUi")
 Initializes UDS. More...
 
nn::Result Initialize (void *workMemory, uint32_t workMemorySize, nn::cfg::CTR::UserName *username) asm("Initialize__Q3_2nn3uds4CafeFPvUiPQ4_2nn3cfg3CTR8UserName")
 Initializes UDS with the given username. More...
 
nn::Result PollStateChange (uint8_t flags) asm("PollStateChange__Q3_2nn3uds4CafeFUc")
 Checks if new data can be retrieved through GetConnectionStatus, and waits until new data is available if specified. More...
 
nn::Result ReceiveFrom (const EndpointDescriptor &fd, void *buf, uint32_t *receivedSize, uint16_t *networkNodeId, uint32_t size, uint8_t flags) asm("ReceiveFrom__Q3_2nn3uds4CafeFRCQ4_2nn3uds4Cafe18EndpointDescriptorPvPUiPUsUiUc")
 Receives data from the specified endpoint. More...
 
nn::Result Receive (const EndpointDescriptor &fd, void *buf, uint32_t *receivedSize, uint32_t size, uint8_t flags) asm("Receive__Q3_2nn3uds4CafeFRCQ4_2nn3uds4Cafe18EndpointDescriptorPvPUiUiUc")
 Receives data from the specified endpoint. More...
 
nn::Result SendTo (const EndpointDescriptor &fd, const void *buf, uint32_t size, uint16_t destNodeId, uint8_t dataChannel, uint8_t flags) asm("SendTo__Q3_2nn3uds4CafeFRCQ4_2nn3uds4Cafe18EndpointDescriptorPCvUiUsUcT5")
 Sends data to the specified node ID through the given data channel. More...
 
nn::Result SetApplicationDataToBeacon (const void *appData, uint32_t size) asm("SetApplicationDataToBeacon__Q3_2nn3uds4CafeFPCvUi")
 Sets the application data to the network. More...
 

Variables

static constexpr uint32_t kWorkMemorySize = 0x14000
 Recommended size to use for work memory buffer. More...
 

Data Structure Documentation

◆ nn::uds::Cafe::ConnectionStatus

struct nn::uds::Cafe::ConnectionStatus

Stores the connection status of the network.

Definition at line 28 of file Cafe.h.

Data Fields
uint32_t status The network status.
uint32_t reason The reason why the status has changed.
uint16_t networkNodeId The network node ID of this device.
uint16_t changedNodes Bitmask of nodes that have changed.
uint16_t nodes[UDS_MAX_NODES] Array of nodes connected to the network.
uint8_t totalNodes Total amount of nodes connected to the network.
uint8_t maxNodes Maximum number of nodes that can connect to the network, including the host.
uint16_t nodeBitmask Bitmask of nodes connected to the network.

◆ nn::uds::Cafe::NodeInformation

struct nn::uds::Cafe::NodeInformation

Stores information about a node.

Definition at line 16 of file NodeInformation.h.

Data Fields
ScrambledLocalFriendCode scrambledLocalFriendCode The scrambled local friend code of the node.
UserName username The node username.
uint16_t networkNodeId The network node ID.

◆ nn::uds::Cafe::ScrambledLocalFriendCode

struct nn::uds::Cafe::ScrambledLocalFriendCode

Stores data about the scrambled local friend code of a node.

Definition at line 14 of file ScrambledLocalFriendCode.h.

Data Fields
uint64_t localFriendCode The scrambled local friend code. On the Wii U this is always descrambled.
uint16_t networkNodeId The node ID that the local friend code belongs to.
uint16_t xorKey The XOR key used for descrambling the local friend code.

Typedef Documentation

◆ EndpointDescriptor

using EndpointDescriptor = uint32_t

Describes a network endpoint.

Definition at line 60 of file Cafe.h.

Enumeration Type Documentation

◆ PollStateChangeFlags

enum PollStateChangeFlags : uint8_t
Enumerator
UDS_POLL_NONBLOCK 

Prevents PollStateChange from blocking if no new data is available.

Definition at line 62 of file Cafe.h.

◆ ReceiveFlags

enum ReceiveFlags : uint8_t
Enumerator
UDS_RECEIVE_NONBLOCK 

Prevents Receive from blocking if no new data is available.

Definition at line 68 of file Cafe.h.

Function Documentation

◆ AllowToConnect()

nn::Result nn::uds::Cafe::AllowToConnect ( )

Allows clients to connect to the network.

◆ AllowToSpectate()

nn::Result nn::uds::Cafe::AllowToSpectate ( )

Allows clients to spectate the network.

◆ Attach()

nn::Result nn::uds::Cafe::Attach ( EndpointDescriptor fd,
uint16_t  networkNodeId,
uint8_t  dataChannel,
uint32_t  recvBufferSize 
)

Attaches an endpoint to a specified node.

Parameters
fdThe endpoint descriptor.
networkNodeIdThe network node ID. Use UDS_BROADCAST_NODE_ID to attach to all nodes.
dataChannelData channel to attach to. Must not be 0.
recvBufferSizeSize to be allocated for the internal buffer for receiving data. Must be greater or equal than 1536 bytes.

◆ CreateLocalCommunicationId()

uint32_t nn::uds::Cafe::CreateLocalCommunicationId ( uint32_t  uniqueId,
bool  unknown 
)

Creates a local communication ID based on the given paramaters.

Parameters
uniqueIdA unique identifier of the current title. This is truncated to 20 bits on the created ID.
unknownEnables or disables a flag on the created ID.
Returns
The created local communication ID.

◆ CreateEndpoint()

nn::Result nn::uds::Cafe::CreateEndpoint ( EndpointDescriptor fd)

Creates a new endpoint.

Parameters
fdA pointer where the endpoint descriptor is written.

◆ CreateNetwork() [1/3]

nn::Result nn::uds::Cafe::CreateNetwork ( uint8_t  id8,
uint8_t  maxNodes,
uint32_t  localCommunicationId,
const char *  passphrase,
uint32_t  passphraseSize,
uint8_t  channel 
)

Creates a new network with the given parameters.

Parameters
id8ID8 to be used on the network. Must not be 0xFF.
maxNodesThe maximum amount of nodes that will be able to connect to the network, including the host. Must be a number between 2 and 9 inclusively.
localCommunicationIdLocal communication ID used for identifying the network.
passphrasePassphrase to be used for the network.
passphraseSizeSize of the passphrase, including NULL termination. Must be greater than 8 characters and lower than 255 characters inclusively.
channelChannel to use for hosting the network. Use 0 to choose a channel automatically. Must be either 0, 1, 6 or 11.

◆ CreateNetwork() [2/3]

nn::Result nn::uds::Cafe::CreateNetwork ( uint8_t  id8,
uint8_t  maxNodes,
uint32_t  localCommunicationId,
const char *  passphrase,
uint32_t  passphraseSize,
uint8_t  channel,
const void *  appData,
uint32_t  appDataSize 
)

Creates a new network with the given parameters.

Parameters
id8ID8 to be used on the network. Must not be 0xFF.
maxNodesThe maximum amount of nodes that will be able to connect to the network, including the host. Must be a number between 2 and 9 inclusively.
localCommunicationIdLocal communication ID used for identifying the network.
passphrasePassphrase to be used for the network.
passphraseSizeSize of the passphrase, including NULL termination. Must be greater than 8 characters and lower than 255 characters inclusively.
channelChannel to use for hosting the network. Use 0 to choose a channel automatically. Must be either 0, 1, 6 or 11.
appDataPointer to application data.
appDataSizeSize of application data. Must be lower than 200 bytes inclusively.

◆ CreateNetwork() [3/3]

nn::Result nn::uds::Cafe::CreateNetwork ( uint8_t  id8,
uint8_t  maxNodes,
uint32_t  localCommunicationId,
const char *  passphrase,
uint32_t  passphraseSize,
bool  unused,
uint8_t  channel,
const void *  appData,
uint32_t  appDataSize 
)

Creates a new network with the given parameters.

Parameters
id8ID8 to be used on the network. Must not be 0xFF.
maxNodesThe maximum amount of nodes that will be able to connect to the network, including the host. Must be a number between 2 and 9 inclusively.
localCommunicationIdLocal communication ID used for identifying the network.
passphrasePassphrase to be used for the network.
passphraseSizeSize of the passphrase, including NULL termination. Must be greater than 8 characters and lower than 255 characters inclusively.
unusedThis parameter is unused.
channelChannel to use for hosting the network. Use 0 to choose a channel automatically. Must be either 0, 1, 6 or 11.
appDataPointer to application data.
appDataSizeSize of application data. Must be lower than 200 bytes inclusively.

◆ DestroyEndpoint()

nn::Result nn::uds::Cafe::DestroyEndpoint ( EndpointDescriptor fd)

Destroys the given endpoint.

Parameters
fdThe endpoint descriptor.

◆ DestroyNetwork()

nn::Result nn::uds::Cafe::DestroyNetwork ( )

Destroys the previously created network.

◆ DisallowToConnect()

nn::Result nn::uds::Cafe::DisallowToConnect ( bool  unknown)

Prevents clients from connecting to the network.

Parameters
unknownTriggers an unknown flag.

◆ EjectClient()

nn::Result nn::uds::Cafe::EjectClient ( uint16_t  networkNodeId)

Ejects the specified client from the network.

Parameters
networkNodeIdThe network node ID of the client. Use UDS_BROADCAST_NODE_ID to eject all clients.

◆ EjectSpectator()

nn::Result nn::uds::Cafe::EjectSpectator ( )

Ejects all spectators from the network.

◆ Finalize()

void nn::uds::Cafe::Finalize ( )

Finalizes UDS.

◆ GetApplicationDataFromBeacon()

nn::Result nn::uds::Cafe::GetApplicationDataFromBeacon ( void *  appData,
uint32_t *  readSize,
uint32_t  size 
)

Gets the application data from the network.

Parameters
appDataBuffer where the application data is written.
readSizePointer where the size of the application data is written.
sizeSize of the buffer.

◆ GetChannel()

nn::Result nn::uds::Cafe::GetChannel ( uint8_t *  channel)

Gets the network channel.

Parameters
channelPointer where the channel is written.

◆ GetConnectionStatus()

nn::Result nn::uds::Cafe::GetConnectionStatus ( ConnectionStatus status)

Retrieves the connection status of the network.

Parameters
statusPointer where the connection status is written.

◆ GetNodeInformation()

nn::Result nn::uds::Cafe::GetNodeInformation ( NodeInformation info,
uint16_t  networkNodeId 
)

Gets information about a specified node.

Parameters
infoOutput node information.
networkNodeIdThe network node ID.

◆ Initialize() [1/2]

nn::Result nn::uds::Cafe::Initialize ( void *  workMemory,
uint32_t  workMemorySize 
)

Initializes UDS.

The username will be set to the Mii name.

Parameters
workMemoryPointer to work memory to be used by UDS.
workMemorySizeSize of work memory. See kWorkMemorySize for a recomended amount of memory.

◆ Initialize() [2/2]

nn::Result nn::uds::Cafe::Initialize ( void *  workMemory,
uint32_t  workMemorySize,
nn::cfg::CTR::UserName username 
)

Initializes UDS with the given username.

Parameters
workMemoryPointer to work memory to be used by UDS.
workMemorySizeSize of work memory. See kWorkMemorySize for a recomended amount of memory.
usernameThe username to be used. If NULL, the username will be set to the Mii name.

◆ PollStateChange()

nn::Result nn::uds::Cafe::PollStateChange ( uint8_t  flags)

Checks if new data can be retrieved through GetConnectionStatus, and waits until new data is available if specified.

Parameters
flagsFlags, see PollStateChangeFlags for all flags.

◆ ReceiveFrom()

nn::Result nn::uds::Cafe::ReceiveFrom ( const EndpointDescriptor fd,
void *  buf,
uint32_t *  receivedSize,
uint16_t *  networkNodeId,
uint32_t  size,
uint8_t  flags 
)

Receives data from the specified endpoint.

Parameters
fdThe endpoint descriptor.
bufOutput buffer where the data will be written.
receivedSizePointer where the received size is written.
networkNodeIdPointer where the incoming node ID is written.
sizeSize of the buffer. Must be 4-byte aligned.
flagsFlags, see ReceiveFlags for all flags.

◆ Receive()

nn::Result nn::uds::Cafe::Receive ( const EndpointDescriptor fd,
void *  buf,
uint32_t *  receivedSize,
uint32_t  size,
uint8_t  flags 
)

Receives data from the specified endpoint.

Parameters
fdThe endpoint descriptor.
bufOutput buffer where the data will be written.
receivedSizePointer where the received size is written.
sizeSize of the buffer. Must be 4-byte aligned.
flagsFlags, see ReceiveFlags for all flags.

◆ SendTo()

nn::Result nn::uds::Cafe::SendTo ( const EndpointDescriptor fd,
const void *  buf,
uint32_t  size,
uint16_t  destNodeId,
uint8_t  dataChannel,
uint8_t  flags 
)

Sends data to the specified node ID through the given data channel.

Parameters
fdTHe endpoint descriptor.
bufBuffer which holds the data to be sent.
sizeSize of the buffer. Must be lower or equal than 1478 bytes.
destNodeIdThe destination node ID.
dataChannelThe destination data channel.
flagsUnknown flags.

◆ SetApplicationDataToBeacon()

nn::Result nn::uds::Cafe::SetApplicationDataToBeacon ( const void *  appData,
uint32_t  size 
)

Sets the application data to the network.

Parameters
appDataApplication data.
sizeSize of application data. Must be lower or equal to 200 bytes.

Variable Documentation

◆ kWorkMemorySize

constexpr uint32_t kWorkMemorySize = 0x14000
staticconstexpr

Recommended size to use for work memory buffer.

Definition at line 57 of file Cafe.h.