Ip networking – reference
Contents
- Socket API
- IP stacks
- Network interfacesIP Networking in Mbed OS is layered in three clearly defined API levels. The diagram below shows the layers near the nearest matching OSI model layers.IP networkingThe next…
- IP stacks
- Network interfaces
- Network motorists
IP Networking in Mbed OS is layered in three clearly defined API levels. The diagram below shows the layers near the nearest matching OSI model layers.
IP networking
The next sections introduce the APIs and technologies implemented in every level.
Socket API
The Socket API may be the common API of all IP connectivity methods. All network stacks in Mbed OS supply the same Socket API, making applications portable among different connectivity methods or perhaps stacks.
Within the OSI model, the Socket API pertains to layer 4, the Transport layer. In Mbed OS, the Socket API supports both TCP and UDP protocols.
Make reference to Socket API reference for usage instructions.
IP stacks
Mbed OS has three choices to select for that IP stack. The connectivity modules provides two built-in IP stacks or perhaps an exterior IP stack.
Network stack
Because the diagram above shows, all stacks implement exactly the same Socket API. Therefore, the applying developer rarely must know which stack will probably be used. Mbed OS chooses one in the build time, in most cases it’s LwIP.
Some exterior Wi-Fi modules and many cellular modules are actually exterior IP stacks in the application perspective. For the reason that situation, the network driver implements the entire Network stack API. These motorists usually drive the module with an AT-command kind of interface. Utilizing an exterior IP module saves RAM and Flash, but with respect to the driver and also at-command interface, may possibly not correctly match the entire Socket API.
The next table summarizes different stacks, use cases as well as their limitations.
Stack | Network protocols supported | Use cases | Limitations |
---|---|---|---|
LwIP | IPv4, IPv6, PPP | Ethernet, Wi-Fi, 2G/3G/4G Cellular | 4 sockets, 1 interface, no routing |
Nanostack | IPv6, 6LoWPAN, Thread | Mesh networking, Border Router | Only IPv6 |
Exterior IP module | Depends upon the module | (Save RAM/Flash) | Depends upon the module. Usually poor match to Socket API |
Configuring the IP stack interface
With respect to the Layer 3, Network layer, protocol used, there are various methods to configure the interface. Additionally, it depends upon the stack used, which configurations are supported on every link layer.
Stack | Data link layer | Network layer | Configurations supported |
---|---|---|---|
LwIP | Ethernet, Wireless | IPv4 | DHCP, static |
LwIP | Ethernet, Wireless | IPv6 | RFC 4862 IPv6 Stateless Address Autoconfiguration. No DHCPv6 support |
LwIP | PPP | IPv4,IPv6 | automatic |
Nanostack | Ethernet | IPv6 | static or RFC 4862 IPv6 Stateless Address Autoconfiguration. No DHCPv6 support |
Nanostack | IEEE 802.15.4 | 6LoWPAN | Thread or 6LoWPAN-ND+RPL |
Network interfaces
IP Networking in Mbed OS is layered in three clearly defined API levels. The diagram below shows the layers near the nearest matching OSI model layers.IP networking
The next sections introduce the APIs and technologies implemented in every level.
Socket API
The Socket API may be the common API of all IP connectivity methods. All network stacks in Mbed OS supply the same Socket API, making applications portable among different connectivity methods or perhaps stacks.
Within the OSI model, the Socket API pertains to layer 4, the Transport layer. In Mbed OS, the Socket API supports both TCP and UDP protocols.
Make reference to Socket API reference for usage instructions.
IP stacks
Mbed OS has three choices to select for that IP stack. The connectivity modules provides two built-in IP stacks or perhaps an exterior IP stack.
Network stack
Because the diagram above shows, all stacks implement exactly the same Socket API. Therefore, the applying developer rarely must know which stack will probably be used. Mbed OS chooses one in the build time, in most cases it’s LwIP.
Some exterior Wi-Fi modules and many cellular modules are actually exterior IP stacks in the application perspective. For the reason that situation, the network driver implements the entire Network stack API. These motorists usually drive the module with an AT-command kind of interface. Utilizing an exterior IP module saves RAM and Flash, but with respect to the driver and also at-command interface, may possibly not correctly match the entire Socket API.
The next table summarizes different stacks, use cases as well as their limitations.
Stack | Network protocols supported | Use cases | Limitations |
---|---|---|---|
LwIP | IPv4, IPv6, PPP | Ethernet, Wi-Fi, 2G/3G/4G Cellular | 4 sockets, 1 interface, no routing |
Nanostack | IPv6, 6LoWPAN, Thread | Mesh networking, Border Router | Only IPv6 |
Exterior IP module | Depends upon the module | (Save RAM/Flash) | Depends upon the module. Usually poor match to Socket API |
Configuring the IP stack interface
With respect to the Layer 3, Network layer, protocol used, there are various methods to configure the interface. Additionally, it depends upon the stack used, which configurations are supported on every link layer.
Stack | Data link layer | Network layer | Configurations supported |
---|---|---|---|
LwIP | Ethernet, Wireless | IPv4 | DHCP, static |
LwIP | Ethernet, Wireless | IPv6 | RFC 4862 IPv6 Stateless Address Autoconfiguration. No DHCPv6 support |
LwIP | PPP | IPv4,IPv6 | automatic |
Nanostack | Ethernet | IPv6 | static or RFC 4862 IPv6 Stateless Address Autoconfiguration. No DHCPv6 support |
Nanostack | IEEE 802.15.4 | 6LoWPAN | Thread or 6LoWPAN-ND+RPL |
Network interfaces
Network interfaces would be the application level APIs where users pick the driver, connectivity method and IP stack. Each connectivity methods requires different configuration, so these APIs aren’t interchangeable. The applying developer must pick one. Selecting the interface also instantly pulls within the network stack like a dependency.
Please be aware that the interface API is totally different from the network driver. The interface API may be the control interface for that application. The network driver implements the controlling API only when it takes configuration from application. In the application perspective, there’s no difference, however the network driver developer needs to understand that.
Mbed OS implements the next network interface APIs:
- Ethernet.
- Wi-Fi.
- Cellular (PPP).
- 6LoWPAN-ND mesh networking.
- Thread mesh networking.
- Wi-SUN mesh networking.
Make reference to Network Interface API reference for usage instructions.
Network motorists
“Network driver” describes different APIs that connect a networking device towards the IP stack or Socket API. Here is a description of every driver API.
Ethernet driver
Emac API
Ethernet motorists are implemented while using stack-independent EMAC API. Since the Ethernet driver requires no configuration, it doesn’t implement any controlling interface for that application.
Wi-Fi driver
Wi-Fi driver
There’s two kinds of Wi-Fi motorists in Mbed OS, based on which protocol layer it implements. Wi-Fi motorists are generally a unique situation of Ethernet driver or exterior IP stacks. Wi-Fi motorists require configuration from your application and, therefore, implement both low-level EMAC API or Network stack API and also the higher level controlling interface API known as WiFiInterface.
Cellular modem driver
Cellular driver
Cellular motorists have a similar two separate cases as Wi-Fi. When they make use of an exterior IP stack, the motive force implements the Network stack API. When they make use of the internal IP stack, LwIP, they implement the Serial PPP driver.
Mesh (Wi-SUN, 6LoWPAN-ND, Thread) RF driver
RF driver
On Mesh systems, Nanostack uses IEEE 802.15.4 radios for transmitting and receiving packets. The RF driver implements the NanostackRfPhy API.
This driver type doesn’t have other use cases, so it’s implemented in C utilizing a Nanostack-specific API.
Please visit Porting a brand new RF driver for that 6LoWPAN stack to learn more.
Resourse: https://os.mbed.com/docs/mbed-os/v5.14/reference/