libnx  v4.7.0
Data Structures | Enumerations | Functions
nifm.h File Reference

Network interface service IPC wrapper. More...

#include "../types.h"
#include "../sf/service.h"
#include "../kernel/event.h"

Go to the source code of this file.

Data Structures

struct  NifmRequest
 Request. More...
 
struct  NifmClientId
 ClientId. More...
 
struct  NifmIpV4Address
 IpV4Address. More...
 
struct  NifmIpAddressSetting
 IpAddressSetting. More...
 
struct  NifmDnsSetting
 DnsSetting. More...
 
struct  NifmProxySetting
 ProxySetting. More...
 
struct  NifmIpSettingData
 IpSettingData. More...
 
struct  NifmWirelessSettingData
 WirelessSettingData. More...
 
struct  NifmSfWirelessSettingData
 SfWirelessSettingData. More...
 
struct  NifmSfNetworkProfileData
 SfNetworkProfileData. Converted to/from NifmNetworkProfileData. More...
 
struct  NifmNetworkProfileData
 NetworkProfileData. Converted from/to NifmSfNetworkProfileData. More...
 

Enumerations

enum  NifmServiceType {
  NifmServiceType_User = 0 ,
  NifmServiceType_System = 1 ,
  NifmServiceType_Admin = 2
}
 
enum  NifmInternetConnectionType {
  NifmInternetConnectionType_WiFi = 1 ,
  NifmInternetConnectionType_Ethernet = 2
}
 
enum  NifmInternetConnectionStatus {
  NifmInternetConnectionStatus_ConnectingUnknown1 = 0 ,
  NifmInternetConnectionStatus_ConnectingUnknown2 = 1 ,
  NifmInternetConnectionStatus_ConnectingUnknown3 = 2 ,
  NifmInternetConnectionStatus_ConnectingUnknown4 = 3 ,
  NifmInternetConnectionStatus_Connected = 4
}
 
enum  NifmRequestState {
  NifmRequestState_Invalid = 0 ,
  NifmRequestState_Unknown1 = 1 ,
  NifmRequestState_OnHold = 2 ,
  NifmRequestState_Available = 3 ,
  NifmRequestState_Unknown4 = 4 ,
  NifmRequestState_Unknown5 = 5
}
 

Functions

Result nifmInitialize (NifmServiceType service_type)
 Initialize nifm. This is used automatically by gethostid().
 
void nifmExit (void)
 Exit nifm. This is used automatically by gethostid().
 
ServicenifmGetServiceSession_StaticService (void)
 Gets the Service object for the actual nifm:* service session.
 
ServicenifmGetServiceSession_GeneralService (void)
 Gets the Service object for IGeneralService.
 
NifmClientId nifmGetClientId (void)
 GetClientId.
 
Result nifmCreateRequest (NifmRequest *r, bool autoclear)
 CreateRequest. More...
 
Result nifmGetCurrentNetworkProfile (NifmNetworkProfileData *profile)
 GetCurrentNetworkProfile. More...
 
Result nifmGetNetworkProfile (Uuid uuid, NifmNetworkProfileData *profile)
 GetNetworkProfile. More...
 
Result nifmSetNetworkProfile (const NifmNetworkProfileData *profile, Uuid *uuid)
 SetNetworkProfile. More...
 
Result nifmGetCurrentIpAddress (u32 *out)
 GetCurrentIpAddress. More...
 
Result nifmGetCurrentIpConfigInfo (u32 *current_addr, u32 *subnet_mask, u32 *gateway, u32 *primary_dns_server, u32 *secondary_dns_server)
 GetCurrentIpConfigInfo. More...
 
Result nifmSetWirelessCommunicationEnabled (bool enable)
 
Result nifmIsWirelessCommunicationEnabled (bool *out)
 
Result nifmGetInternetConnectionStatus (NifmInternetConnectionType *connectionType, u32 *wifiStrength, NifmInternetConnectionStatus *connectionStatus)
 
Result nifmIsEthernetCommunicationEnabled (bool *out)
 
bool nifmIsAnyInternetRequestAccepted (NifmClientId id)
 IsAnyInternetRequestAccepted. More...
 
Result nifmIsAnyForegroundRequestAccepted (bool *out)
 
Result nifmPutToSleep (void)
 
Result nifmWakeUp (void)
 
Result nifmSetWowlDelayedWakeTime (s32 val)
 SetWowlDelayedWakeTime. More...
 
IRequest
void nifmRequestClose (NifmRequest *r)
 Close a NifmRequest. More...
 
Result nifmGetRequestState (NifmRequest *r, NifmRequestState *out)
 GetRequestState. More...
 
Result nifmGetResult (NifmRequest *r)
 GetResult. More...
 
Result nifmRequestCancel (NifmRequest *r)
 Cancel. More...
 
Result nifmRequestSubmit (NifmRequest *r)
 Submit. More...
 
Result nifmRequestSubmitAndWait (NifmRequest *r)
 SubmitAndWait. More...
 
Result nifmRequestGetAppletInfo (NifmRequest *r, u32 theme_color, void *buffer, size_t size, u32 *applet_id, u32 *mode, u32 *out_size)
 GetAppletInfo. More...
 
Result nifmRequestSetKeptInSleep (NifmRequest *r, bool flag)
 SetKeptInSleep. More...
 
Result nifmRequestRegisterSocketDescriptor (NifmRequest *r, int sockfd)
 RegisterSocketDescriptor. More...
 
Result nifmRequestUnregisterSocketDescriptor (NifmRequest *r, int sockfd)
 UnregisterSocketDescriptor. More...
 

Detailed Description

Network interface service IPC wrapper.

Author
shadowninja108, shibboleet, exelix, yellows8

Enumeration Type Documentation

◆ NifmInternetConnectionStatus

Enumerator
NifmInternetConnectionStatus_ConnectingUnknown1 

Unknown internet connection status 1.

NifmInternetConnectionStatus_ConnectingUnknown2 

Unknown internet connection status 2.

NifmInternetConnectionStatus_ConnectingUnknown3 

Unknown internet connection status 3 (conntest?).

NifmInternetConnectionStatus_ConnectingUnknown4 

Unknown internet connection status 4.

NifmInternetConnectionStatus_Connected 

Internet is connected.

◆ NifmInternetConnectionType

Enumerator
NifmInternetConnectionType_WiFi 

Wi-Fi connection is used.

NifmInternetConnectionType_Ethernet 

Ethernet connection is used.

◆ NifmRequestState

Enumerator
NifmRequestState_Invalid 

Error.

NifmRequestState_Unknown1 

Not yet submitted or error.

NifmRequestState_OnHold 

OnHold.

NifmRequestState_Available 

Available.

NifmRequestState_Unknown4 

Unknown.

NifmRequestState_Unknown5 

Unknown.

◆ NifmServiceType

Enumerator
NifmServiceType_User 

Initializes nifm:u.

NifmServiceType_System 

Initializes nifm:s.

NifmServiceType_Admin 

Initializes nifm:a.

Function Documentation

◆ nifmCreateRequest()

Result nifmCreateRequest ( NifmRequest r,
bool  autoclear 
)

CreateRequest.

Parameters
[out]rNifmRequest
[in]autoclearEvent autoclear to use for NifmRequest::event1, a default of true can be used for this.

◆ nifmGetCurrentIpAddress()

Result nifmGetCurrentIpAddress ( u32 out)

GetCurrentIpAddress.

Parameters
[out]outIPv4 address (struct in_addr).

◆ nifmGetCurrentIpConfigInfo()

Result nifmGetCurrentIpConfigInfo ( u32 current_addr,
u32 subnet_mask,
u32 gateway,
u32 primary_dns_server,
u32 secondary_dns_server 
)

GetCurrentIpConfigInfo.

Parameters
[out]current_addrSame as nifmGetCurrentIpAddress output.
[out]subnet_maskSubnet Mask (struct in_addr).
[out]gatewayGateway (struct in_addr).
[out]primary_dns_serverPrimary DNS server IPv4 address (struct in_addr).
[out]secondary_dns_serverSecondary DNS server IPv4 address (struct in_addr).

◆ nifmGetCurrentNetworkProfile()

Result nifmGetCurrentNetworkProfile ( NifmNetworkProfileData profile)

GetCurrentNetworkProfile.

Parameters
[out]profileNifmNetworkProfileData

◆ nifmGetInternetConnectionStatus()

Result nifmGetInternetConnectionStatus ( NifmInternetConnectionType connectionType,
u32 wifiStrength,
NifmInternetConnectionStatus connectionStatus 
)
Note
Will fail with 0xd46ed if Internet is neither connecting or connected (airplane mode or no known network in reach).
Parameters
wifiStrengthStrength of the Wi-Fi signal in number of bars from 0 to 3.

◆ nifmGetNetworkProfile()

Result nifmGetNetworkProfile ( Uuid  uuid,
NifmNetworkProfileData profile 
)

GetNetworkProfile.

Parameters
[in]uuidUuid
[out]profileNifmNetworkProfileData

◆ nifmGetRequestState()

Result nifmGetRequestState ( NifmRequest r,
NifmRequestState out 
)

GetRequestState.

Parameters
rNifmRequest
[out]outNifmRequestState

◆ nifmGetResult()

Result nifmGetResult ( NifmRequest r)

GetResult.

Parameters
rNifmRequest

◆ nifmIsAnyInternetRequestAccepted()

bool nifmIsAnyInternetRequestAccepted ( NifmClientId  id)

IsAnyInternetRequestAccepted.

Parameters
[in]idNifmClientId

◆ nifmRequestCancel()

Result nifmRequestCancel ( NifmRequest r)

Cancel.

Parameters
rNifmRequest

◆ nifmRequestClose()

void nifmRequestClose ( NifmRequest r)

Close a NifmRequest.

Parameters
rNifmRequest

◆ nifmRequestGetAppletInfo()

Result nifmRequestGetAppletInfo ( NifmRequest r,
u32  theme_color,
void *  buffer,
size_t  size,
u32 applet_id,
u32 mode,
u32 out_size 
)

GetAppletInfo.

Note
This is used by nifmLaHandleNetworkRequestResult.
Parameters
rNifmRequest
[in]theme_colorThemeColor
[out]bufferOutput buffer for storage data.
[in]sizeOutput buffer size.
[out]applet_idAppletId
[out]modeLibAppletMode
[out]out_sizeTotal data size written to the output buffer.

◆ nifmRequestRegisterSocketDescriptor()

Result nifmRequestRegisterSocketDescriptor ( NifmRequest r,
int  sockfd 
)

RegisterSocketDescriptor.

Only 1 socket can be registered at a time with a NifmRequest. Do not use directly, use socketNifmRequestRegisterSocketDescriptor instead.

Note
Only available on [3.0.0+].
NifmRequestState must be NifmRequestState_Available.
Parameters
rNifmRequest
[in]sockfdSocket fd

◆ nifmRequestSetKeptInSleep()

Result nifmRequestSetKeptInSleep ( NifmRequest r,
bool  flag 
)

SetKeptInSleep.

Note
Only available on [3.0.0+].
NifmRequestState must be NifmRequestState_Unknown1.
Parameters
rNifmRequest
[in]flagFlag

◆ nifmRequestSubmit()

Result nifmRequestSubmit ( NifmRequest r)

Submit.

Parameters
rNifmRequest

◆ nifmRequestSubmitAndWait()

Result nifmRequestSubmitAndWait ( NifmRequest r)

SubmitAndWait.

Parameters
rNifmRequest

◆ nifmRequestUnregisterSocketDescriptor()

Result nifmRequestUnregisterSocketDescriptor ( NifmRequest r,
int  sockfd 
)

UnregisterSocketDescriptor.

Do not use directly, use socketNifmRequestUnregisterSocketDescriptor instead.

Note
Only available on [3.0.0+].
NifmRequestState must be NifmRequestState_Available.
Parameters
rNifmRequest
[in]sockfdSocket fd, must match the fd previously registered with nifmRequestRegisterSocketDescriptor.

◆ nifmSetNetworkProfile()

Result nifmSetNetworkProfile ( const NifmNetworkProfileData profile,
Uuid uuid 
)

SetNetworkProfile.

Note
Only available with NifmServiceType_Admin.
Parameters
[in]profileNifmNetworkProfileData
[out]uuidUuid

◆ nifmSetWirelessCommunicationEnabled()

Result nifmSetWirelessCommunicationEnabled ( bool  enable)
Note
Works only if called from nifm:a or nifm:s.

◆ nifmSetWowlDelayedWakeTime()

Result nifmSetWowlDelayedWakeTime ( s32  val)

SetWowlDelayedWakeTime.

Note
Only available with NifmServiceType_System or NifmServiceType_Admin.
Only available on [9.0.0+].
Parameters
[in]valInput value.