net: Network

Top  Previous  Next

The Network functions are used for establishing a connection either to the internet or to a local network.

 

The following network interfaces are supported:

 

IFACE

Name

Description

1

Mobile

Cellular connection.

2

LAN 1

Primary Ethernet connection.

3

LAN 2

Secondary / USB Ethernet connection.

4

WLAN

Wireless network connection.

5

AP

Wireless Access Point connection.

When using the 'net' API the external WiFi and Ethernet add-on modules are not supported.

 

The following defines are present representing each interface:
 

1        _NET_IFACE_MOBILE // _NET_IFACE_CELLULAR

2        _NET_IFACE_LAN1

3        _NET_IFACE_LAN2

4        _NET_IFACE_WLAN

5        _NET_IFACE_WLAN_AP

 

 

Network Address Translation (NAT)

This is a way to route socket connections between different network interfaces.

It is possible to configure a network interface to be a gateway to the Internet.

When this is done, NAT is used to masquerade outgoing socket connection, as if sending from the device.

Please note that only one network interface can be set as gateway at a time.

The NAT functionality is only available on devices with NX32L architecture.

 

 

Dynamic Host Configuration Protocol (DHCP) server

This server uses the DHCP to dynamically assign an IP address and other network configuration parameters to each device on a network.

The configuration parameters the DHCP server assigns are configured for each network interface.

The DHCP server is only available on devices with NX32L architecture.

 

 

Port Forwarding

This is a way to forward incoming connections from a network interface to a client device located on a different network interface.

The forwarding rules always apply to the network interface which is configured as the NAT gateway.

If the NAT gateway configuration is moved to a different network interface, the port forwarding rules will follow automatically.

For example:

If the WLAN network interface is configured as NAT Gateway, then only incoming connections from this interface will be forwarded.

Later the Mobile network interface is configured as NAT Gateway,and only incoming connections from this interface will be forwarded, no changes to the port forwarding rules are necessary.

 

If no rules are defined, no incoming socket connections will be forwarded to other network interfaces.

 

 

 

The following functions are available:

 


netOpen

Opens a network interface.


netClose

Closes a network interface.


netConnected

Queries if an interface is connected to the network.


netPresent

Determines if the network interface is available.


netGetInformation

Returns information about a network interface.


netGetSignalLevel

Returns the signal strength of a network interface.


netPing

Ping a host (advanced)


netPingS

Ping a host (simple)

 

The following functions are available for configuring the network interfaces:

 


netSetLANParam

Sets TCP/IP configuration parameters for the LAN interface.


netGetLANParam

Retrieves the TCP/IP configuration parameters for the LAN interface.


netSetMobileParam

Sets TCP/IP configuration parameters for the Mobile interface.


netGetMobileParam

Retrieves the TCP/IP configuration parameters for the Mobile interface.


netSetWLANParam

Sets wireless network configuration parameters for the WLAN interface


netGetWLANParam

Retrieves the wireless network configuration parameters for the WLAN interface.


netGetWLANSecurity

Retrieves the security configuration for a wireless network.


netWLANSecurityWPA

The parameters for WPA/WPA2 pre-shared key security


netSetAPParam

Sets wireless network configuration parameters for the AP interface


netGetAPParam

Retrieves the wireless network configuration parameters for the AP interface.


netGetAPSecurity

Retrieves the security configuration for the AP interface

 

The following functions are available for network services:

 


netGetMonitorParam

Retrieve the network monitoring service parameters for a network interface.


netSetMonitorParam

Set the network monitoring service parameters for a network interface.


netSetNATParam

Sets the NAT parameters for a network interface.


netGetNATParam

Retrieve the NAT parameters for a network interface.


netSetDHCPParam

Sets the DHCP parameters for a network interface.


netGetDHCPParam

Retrieve the DHCP parameters for a network interface.


netPortForwardClear

Clear all port forward rules.


netPortForwardGet

Retrieve a port forward rule.


netPortForwardSet

Set a port forward rule.


netRouteAdd

Add a user route to the system.


netRouteDel

Remove a user route from the system.


netRouteGet

Get information about a user route.