Network Core Engine

Principle

The Net module defines a low-level network framework for embedded devices. This module allows you to manage connection (TCP)- or connectionless (UDP)-oriented protocols for client/server networking applications.

Functional Description

The Net library includes two sub-protocols:

  • UDP: a connectionless-oriented protocol that allows communication with the server or client side in a non-reliable way. No handshake mechanisms, no guarantee on delivery, and no order in packet sending.

  • TCP: a connection-oriented protocol that allows communication with the server or client side in a reliable way. Handshakes mechanism used, bytes ordered, and error checking performed upon delivery.

Dependencies

  • LLNET_CHANNEL_impl.h, LLNET_SOCKETCHANNEL_impl.h, LLNET_STREAMSOCKETCHANNEL_impl.h, LLNET_DATAGRAMSOCKETCHANNEL_impl.h, LLNET_DNS_impl.h, LLNET_NETWORKADDRESS_impl.h, LLNET_NETWORKINTERFACE_impl.h (see LLNET: Network).

Installation

NET is an additional module. To enable it, the Net Pack (which bundles several libraries: Net, SSL & Security) must be installed in your VEE Port:

microejPack("com.microej.pack.net:net-pack:11.0.2")

Initialization

When porting the Net library the initialize function shall make sure the underlying network stack is initialized. The entry point for this initialization is the following native function: LLNET_CHANNEL_impl_initialize:

/**
 * @brief Initializes the TCP/IP stack components.
 *
 * @note Throws NativeIOException on error.
 *
 * @see LLNET_ERRORS.h header file for error codes.
 */
void LLNET_CHANNEL_IMPL_initialize(void);

It is called during the initialization phase of the Net library so it will run before the application starts.

In most of the VEE Ports a macro llnet_init() is provided to call any specific code required before using the network:

// ...

#include "LLNET_configuration.h" // Macro is defined in this header.
#include "LLNET_CHANNEL_impl.h"

void LLNET_CHANNEL_IMPL_initialize(void) {
   llnet_init(); // Custom initialization here.
   // ...
}

// ...

An example of how the network is initialized with the same requirements can be found here in the NXP VEE Port for i.MX RT1170 EVK.

Use

The Net API Module must be added to the Application project build file to use the NET library:

implementation("ej.api:net:1.1.4")

This library provides a set of options. Refer to the chapter Standalone Application Options which lists all available options.