} udsNetworkScanInfo;
enum {
- UDSNETATTR_DisableConnectClients = BIT(1), //When set new Clients are not allowed to connect.
+ UDSNETATTR_DisableConnectClients = BIT(1), //When set new Clients are (supposedly) not allowed to connect.
UDSNETATTR_DisableConnectSpectators = BIT(2), //When set new Spectators are (probably) not allowed to connect.
UDSNETATTR_Default = BIT(15), //Unknown what this bit is for.
};
*/
Result udsEjectClient(u16 NetworkNodeID);
+/**
+ * @brief This can be used by the host to update the network attributes. If bitmask 0x4 is clear in the input bitmask, this clears that bit in the value before actually writing the value into state.
+ * @param bitmask Bitmask to clear/set in the attributes. See the UDSNETATTR enum values.
+ * @param flag When false, bit-clear, otherwise bit-set.
+ */
+Result udsUpdateNetworkAttribute(u16 bitmask, bool flag);
+
+/**
+ * @brief This uses udsUpdateNetworkAttribute() for (un)blocking new connections to this host with the specified type(s). This is what it was supposed to do, doesn't seem actually to affect new connections though.
+ * @param block When true, block the specified connection types. Otherwise allow them.
+ * @param clients When true, (un)block regular clients.
+ * @param clients When true, (un)block spectators(?).
+ */
+Result udsSetNewConnectionsBlocked(bool block, bool clients, bool spectators);
+
return cmdbuf[1];
}
+Result udsUpdateNetworkAttribute(u16 bitmask, bool flag)
+{
+ u32* cmdbuf=getThreadCommandBuffer();
+
+ if(flag)flag = 1;
+
+ cmdbuf[0]=IPC_MakeHeader(0x7,2,0); // 0x70080
+ cmdbuf[1]=bitmask;
+ cmdbuf[2]=flag;
+
+ Result ret=0;
+ if(R_FAILED(ret=svcSendSyncRequest(__uds_servhandle)))return ret;
+
+ return cmdbuf[1];
+}
+
+Result udsSetNewConnectionsBlocked(bool block, bool clients, bool spectators)
+{
+ u16 bitmask = 0;
+
+ if(clients)bitmask |= UDSNETATTR_DisableConnectClients;
+ if(spectators)bitmask |= UDSNETATTR_DisableConnectSpectators;
+
+ return udsUpdateNetworkAttribute(bitmask, block);
+}
+
Result udsDestroyNetwork(void)
{
u32* cmdbuf=getThreadCommandBuffer();