11#include "../sf/service.h"
12#include "../kernel/event.h"
35 char service_name[0x21];
54 u8 preshared_key[0x3F];
63 u8 advertise_data[0x80];
Result lp2pGetMembers(Lp2pNodeInfo *members, s32 count, s32 *total_out)
GetMembers.
Result lp2pLeave(u32 *out)
Leave.
Result lp2pAttachJoinEvent(Event *out_event)
AttachJoinEvent.
Result lp2pScan(const Lp2pGroupInfo *info, Lp2pScanResult *results, s32 count, s32 *total_out)
Scan.
Result lp2pRemoveAcceptableGroupId(void)
RemoveAcceptableGroupId.
Service * lp2pGetServiceSession_INetworkServiceMonitor(void)
Gets the Service object for INetworkServiceMonitor.
Result lp2pGetAdvertiseData2(void *buffer, size_t size, u16 *transfer_size, u16 *original_size)
GetAdvertiseData2.
Result lp2pCreateGroup(const Lp2pGroupInfo *info)
CreateGroup.
static void lp2pGroupInfoSetStealthEnabled(Lp2pGroupInfo *info, bool flag)
Sets Lp2pGroupInfo::stealth_enabled.
Definition lp2p.h:149
void lp2pCreateGroupInfoScan(Lp2pGroupInfo *info)
Creates a default Lp2pGroupInfo for use with lp2pScan.
Lp2pServiceType
Definition lp2p.h:14
@ Lp2pServiceType_App
Initializes lp2p:app.
Definition lp2p.h:15
@ Lp2pServiceType_System
Initializes lp2p:sys.
Definition lp2p.h:16
Result lp2pAttachNetworkInterfaceStateChangeEvent(Event *out_event)
AttachNetworkInterfaceStateChangeEvent.
static void lp2pGroupInfoSetMemberCountMax(Lp2pGroupInfo *info, size_t count)
Sets Lp2pGroupInfo::member_count_max.
Definition lp2p.h:129
Result lp2pGroupInfoSetPassphrase(Lp2pGroupInfo *info, const char *passphrase)
Sets the passphrase, for when standard WPA2-PSK is being used.
Result lp2pSetAdvertiseData(const void *buffer, size_t size)
SetAdvertiseData.
void lp2pGroupInfoSetFlags(Lp2pGroupInfo *info, s8 *flags, size_t count)
Sets Lp2pGroupInfo::flags_count and Lp2pGroupInfo::flags.
Result lp2pJoin(Lp2pGroupInfo *out, const Lp2pGroupInfo *info)
This runs the same code as lp2pCreateGroup to generate the Lp2pGroupInfo for the input struct.
void lp2pExit(void)
Exit lp2p.
Result lp2pAddAcceptableGroupId(Lp2pGroupId group_id)
AddAcceptableGroupId.
Result lp2pGetIpConfig(Lp2pIpConfig *out)
GetIpConfig.
Result lp2pRecvFromOtherGroup(void *buffer, size_t size, u32 flags, Lp2pMacAddress *addr, u16 *unk0, s32 *unk1, u64 *out_size, s32 *unk2)
This receives an Action frame.
Result lp2pGetAdvertiseData(void *buffer, size_t size, u16 *transfer_size, u16 *original_size)
GetAdvertiseData.
Result lp2pInitialize(Lp2pServiceType service_type)
Initialize lp2p.
Result lp2pGetNetworkInterfaceLastError(void)
GetNetworkInterfaceLastError.
void lp2pGroupInfoSetServiceName(Lp2pGroupInfo *info, const char *name)
Sets Lp2pGroupInfo::service_name.
void lp2pGroupInfoSetPresharedKey(Lp2pGroupInfo *info, const void *key, size_t size)
Sets the PresharedKey for the specified Lp2pGroupInfo.
static void lp2pGroupInfoSetFrequencyChannel(Lp2pGroupInfo *info, u16 frequency, s16 channel)
Sets Lp2pGroupInfo::frequency and Lp2pGroupInfo::channel.
Definition lp2p.h:139
Result lp2pGetGroupOwner(Lp2pNodeInfo *out)
GetGroupOwner.
void lp2pCreateGroupInfo(Lp2pGroupInfo *info)
Creates a default Lp2pGroupInfo for use with lp2pCreateGroup / lp2pJoin.
Result lp2pGetGroupInfo(Lp2pGroupInfo *out)
GetGroupInfo.
Result lp2pSendToOtherGroup(const void *buffer, size_t size, Lp2pMacAddress addr, Lp2pGroupId group_id, s16 frequency, s16 channel, u32 flags)
This sends an Action frame to the specified Lp2pGroupId, with the specified destination Lp2pMacAddres...
Result lp2pDestroyGroup(void)
This destroys the previously created group from lp2pCreateGroup.
Result lp2pGetRole(u8 *out)
GetRole.
Service * lp2pGetServiceSession_INetworkService(void)
Gets the Service object for INetworkService.
Kernel-mode event structure.
Definition event.h:13
GroupId.
Definition lp2p.h:25
GroupInfo lp2pScan only uses the following fields for the cmd input struct: supported_platform/priori...
Definition lp2p.h:31
u8 supported_platform
SupportedPlatform. Must match value 1. 0 is PlatformIdNX, 1 is PlatformIdFuji.
Definition lp2p.h:38
s16 channel
Wifi channel number. 0 = use default, otherwise this must be one of the following depending on the fr...
Definition lp2p.h:43
s8 flags_count
Must be <=0x3F.
Definition lp2p.h:36
u8 stealth_enabled
StealthEnabled. Bool flag, controls whether the SSID is hidden.
Definition lp2p.h:50
u8 unk_x8C
Unknown.
Definition lp2p.h:48
u8 unk_x83
Unknown.
Definition lp2p.h:41
u8 priority
Priority. Must match one of the following, depending on the used service (doesn't apply to lp2pJoin):...
Definition lp2p.h:49
u8 network_mode
NetworkMode.
Definition lp2p.h:44
u8 unk_x8F
If zero, a default value of 0x20 is used.
Definition lp2p.h:51
s8 static_aes_key_index
StaticAesKeyIndex. Used as the array-index for selecting the KeySource used with GenerateAesKek durin...
Definition lp2p.h:47
u8 performance_requirement
PerformanceRequirement.
Definition lp2p.h:45
Lp2pGroupId group_id
Should be all-zero for the input struct so that the default is used.
Definition lp2p.h:34
u16 frequency
Wifi frequency: 24 = 2.4GHz, 50 = 5GHz.
Definition lp2p.h:42
s8 member_count_max
MemberCountMax. Must be <=0x8. If zero during group-creation, a default of value 1 is used for the va...
Definition lp2p.h:39
u8 security_type
Security type, used during key derivation. 0 = use defaults, 1 = plaintext, 2 = encrypted....
Definition lp2p.h:46
u8 preshared_key_binary_size
PresharedKeyBinarySize.
Definition lp2p.h:53
u8 unk_x82
Unknown.
Definition lp2p.h:40
u64 local_communication_id
LocalCommunicationId. When zero, the value from the user-process control.nacp is loaded....
Definition lp2p.h:33
IpConfig. Only contains IPv4 addresses.
Definition lp2p.h:76
MacAddress.
Definition lp2p.h:20
NodeInfo.
Definition lp2p.h:68
Lp2pMacAddress mac_addr
Lp2pMacAddress
Definition lp2p.h:71
ScanResult.
Definition lp2p.h:58
u16 advertise_data_size
Size of the following AdvertiseData.
Definition lp2p.h:62
u8 unk_x200
Unknown.
Definition lp2p.h:60
Lp2pGroupInfo group_info
Lp2pGroupInfo
Definition lp2p.h:59
Service object structure.
Definition service.h:14
uint64_t u64
64-bit unsigned integer.
Definition types.h:22
uint8_t u8
8-bit unsigned integer.
Definition types.h:19
int8_t s8
8-bit signed integer.
Definition types.h:25
int16_t s16
16-bit signed integer.
Definition types.h:26
uint16_t u16
16-bit unsigned integer.
Definition types.h:20
u32 Result
Function error code result type.
Definition types.h:44
#define NX_CONSTEXPR
Flags a function as constexpr in C++14 and above; or as (always) inline otherwise.
Definition types.h:92
int32_t s32
32-bit signed integer.
Definition types.h:27
uint32_t u32
32-bit unsigned integer.
Definition types.h:21