BSB Developer Docs
Loading...
Searching...
No Matches
network.h File Reference

Network TCP/IP stack API. More...

#include <lwip/netif.h>

Go to the source code of this file.

Macros

#define RECORD_NETWORK   "network"
 The string key for Network instance access.
 

Typedefs

typedef struct Network Network
 Opaque Network type declaration.
 

Enumerations

enum  NetworkNetif { NetworkNetifWifi , NetworkNetifUsb , NetworkNetifCount }
 Identifies a logical network interface. More...
 

Functions

struct netif * network_find_netif (NetworkNetif netif)
 Find a netif by its logical interface identifier.
 
void network_netif_assign_name (struct netif *netif, NetworkNetif id)
 Assign the lwIP 2-character name to a netif.
 
void network_init_current_thread (Network *instance)
 Initialise the calling thread for use with the TCP/IP stack.
 
void network_deinit_current_thread (Network *instance)
 Deinitialise the calling thread.
 

Detailed Description

Network TCP/IP stack API.

Macro Definition Documentation

◆ RECORD_NETWORK

#define RECORD_NETWORK   "network"

The string key for Network instance access.

Get the instance pointer by calling furi_record_open(RECORD_NETWORK)

Enumeration Type Documentation

◆ NetworkNetif

Identifies a logical network interface.

Enumerator
NetworkNetifWifi 

Wi-Fi (WL) interface.

NetworkNetifUsb 

USB-NCM (EX) interface.

NetworkNetifCount 

Sentinel — not a valid interface.

Function Documentation

◆ network_deinit_current_thread()

void network_deinit_current_thread ( Network * instance)

Deinitialise the calling thread.

Needs to be called before exiting from a thread initialised with the network_init_current_thread() call.

Parameters
[in,out]instancepointer to the Network instance

◆ network_find_netif()

struct netif * network_find_netif ( NetworkNetif netif)

Find a netif by its logical interface identifier.

Must be called with the lwIP core lock held — either from within the lwIP thread or between LOCK_TCPIP_CORE / UNLOCK_TCPIP_CORE.

Parameters
netifLogical interface to find.
Returns
First matching netif, or NULL if not found.

◆ network_init_current_thread()

void network_init_current_thread ( Network * instance)

Initialise the calling thread for use with the TCP/IP stack.

Every thread that uses APIs from the following files:

  • lwip/api.h
  • lwip/netbuf.h
  • lwip/netifapi.h
  • lwip/sockets.h

MUST first register itself by calling this function from inside of its execution context.

Parameters
[in,out]instancepointer to the Network instance

◆ network_netif_assign_name()

void network_netif_assign_name ( struct netif * netif,
NetworkNetif id )

Assign the lwIP 2-character name to a netif.

Encapsulates the interface-to-name mapping; call from netif init callbacks.

Parameters
netifThe lwIP netif to name.
idLogical interface identifier.