8 #define UDS_MAXNODES 16
11 #define UDS_BROADCAST_NETWORKNODEID 0xFFFF
14 #define UDS_HOST_NETWORKNODEID 0x1
17 #define UDS_DEFAULT_RECVBUFSIZE 0x2E30
20 #define UDS_DATAFRAME_MAXSIZE 0x5C6
23 #define UDS_CHECK_SENDTO_FATALERROR(x) (R_FAILED(x) && x!=0xC86113F0)
27 u64 uds_friendcodeseed;
51 u16 cur_NetworkNodeID;
62 u8 host_macaddress[6];
141 UDSNETATTR_DisableConnectSpectators =
BIT(0),
142 UDSNETATTR_DisableConnectClients =
BIT(1),
143 UDSNETATTR_x4 =
BIT(2),
144 UDSNETATTR_Default =
BIT(15),
148 UDS_SENDFLAG_Default =
BIT(0),
149 UDS_SENDFLAG_Broadcast =
BIT(1)
153 UDSCONTYPE_Client = 0x1,
154 UDSCONTYPE_Spectator = 0x2
General NWM output structure from AP scanning, for each entry.
Definition: uds.h:119
Connection status struct.
Definition: uds.h:48
Output structure generated from host scanning output.
Definition: uds.h:134
Network struct stored as big-endian.
Definition: uds.h:61
Node info struct.
Definition: uds.h:26
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:47
uint64_t u64
64-bit unsigned integer
Definition: types.h:24
uint8_t u8
would be nice if newlib had this already
Definition: types.h:21
u32 Handle
Resource handle.
Definition: types.h:41
s32 Result
Function result.
Definition: types.h:42
uint16_t u16
16-bit unsigned integer
Definition: types.h:22
uint32_t u32
32-bit unsigned integer
Definition: types.h:23
Result udsUnbind(udsBindContext *bindcontext)
Remove a bind.
void udsExit(void)
Exits UDS.
Result udsPullPacket(const udsBindContext *bindcontext, void *buf, size_t size, size_t *actual_size, u16 *src_NetworkNodeID)
Receives data over the network.
Result udsCreateNetwork(const udsNetworkStruct *network, const void *passphrase, size_t passphrase_size, udsBindContext *context, u8 data_channel, u32 recv_buffer_size)
Starts hosting a new network.
Result udsSendTo(u16 dst_NetworkNodeID, u8 data_channel, u8 flags, const void *buf, size_t size)
Sends data over the network.
Result udsScanBeacons(void *outbuf, size_t maxsize, udsNetworkScanInfo **networks, size_t *total_networks, u32 wlancommID, u8 id8, const u8 *host_macaddress, bool connected)
Scans for networks via beacon-scanning.
Result udsBind(udsBindContext *bindcontext, u16 NetworkNodeID, bool spectator, u8 data_channel, u32 recv_buffer_size)
Create a bind.
Result udsDisconnectNetwork(void)
Disconnect this client device from the network.
bool udsWaitConnectionStatusEvent(bool nextEvent, bool wait)
Waits for the ConnectionStatus event to occur, or checks if the event was signaled.
Result udsDestroyNetwork(void)
Stop hosting the network.
Result udsSetNewConnectionsBlocked(bool block, bool clients, bool flag)
This uses udsUpdateNetworkAttribute() for (un)blocking new connections to this host.
Result udsEjectSpectator(void)
This can be used by the host to force-disconnect the spectators.
Result udsConnectNetwork(const udsNetworkStruct *network, const void *passphrase, size_t passphrase_size, udsBindContext *context, u16 recv_NetworkNodeID, udsConnectionType connection_type, u8 data_channel, u32 recv_buffer_size)
Connect to a network.
Result udsGetChannel(u8 *channel)
Gets the wifi channel currently being used.
Result udsSetApplicationData(const void *buf, size_t size)
This can be used by the host to set the appdata contained in the broadcasted beacons.
bool udsWaitDataAvailable(const udsBindContext *bindcontext, bool nextEvent, bool wait)
Waits for the bind event to occur, or checks if the event was signaled.
Result udsAllowSpectators(void)
This uses udsUpdateNetworkAttribute() for unblocking new spectator connections to this host.
Result udsInit(size_t sharedmem_size, const char *username)
Initializes UDS.
Result udsGetConnectionStatus(udsConnectionStatus *output)
This loads the current ConnectionStatus struct.
bool udsCheckNodeInfoInitialized(const udsNodeInfo *nodeinfo)
Checks whether a NodeInfo struct was initialized by NWM-module(not any output from udsGenerateNodeInf...
Result udsGetNodeInformation(u16 NetworkNodeID, udsNodeInfo *output)
This loads a NodeInfo struct for the specified NetworkNodeID.
Result udsGetApplicationData(void *buf, size_t size, size_t *actual_size)
This can be used while on a network(host/client) to get the appdata from the current beacon.
Result udsGetNodeInfoUsername(const udsNodeInfo *nodeinfo, char *username)
Loads the UTF-16 username stored in the input NodeInfo struct, converted to UTF-8.
Result udsGetNetworkStructApplicationData(const udsNetworkStruct *network, void *buf, size_t size, size_t *actual_size)
This can be used with a NetworkStruct, from udsScanBeacons() mainly, for getting the appdata.
Result udsEjectClient(u16 NetworkNodeID)
This can be used by the host to force-disconnect client(s).
Result udsGenerateNodeInfo(udsNodeInfo *nodeinfo, const char *username)
Generates a NodeInfo struct with data loaded from system-config.
Result udsUpdateNetworkAttribute(u16 bitmask, bool flag)
This can be used by the host to update the network attributes.
void udsGenerateDefaultNetworkStruct(udsNetworkStruct *network, u32 wlancommID, u8 id8, u8 max_nodes)
Generates a default NetworkStruct for creating networks.
#define UDS_MAXNODES
Maximum number of nodes(devices) that can be connected to the network.
Definition: uds.h:8