emNet is organized in different layers, illustrated in the following diagram. A short description of each layer's functionality follows below.
|Application layer||Application layer protocols:|
CoAP, DHCP, DNS, FTP, HTTP, MQTT, POP3, SMTP, TELNET, SSL, ...
|Transport layer||Tranport layer protocols:|
TCP, UDP, ...
|Network layer||Network layer protocols:|
IP, ICMP, IGMP, ARP, RARP, ...
|Link layer||Link layer protocols:|
Ethernet (IEEE 802.3), ...
The API Layer is the interface between emNet and the user application. It uses the emNet API to transmit data over a TCP/IP network. The emNet API provides functions in Berkley socket style, such as connect(), bind(), listen(), etc.
The transport layer provides end-to-end communication services for applications. The two relevant protocols of the transport layer protocol are the Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP). TCP is a reliable connection-oriented transport service. It provides end-to-end reliability, resequencing, and flow control. UDP is a connectionless transport service.
All protocols of the Transport layer use the Internet Protocol (IP) to carry data from source host to destination host. IP is a connectionless service, providing no end-to-end delivery guarantees. IP datagrams may arrive at the destination host damaged, duplicated, out of order, or not at all. The Transport layer is responsible for reliable delivery of the datagrams when it is required. The IP protocol includes provision for addressing, type-of-service specification, fragmentation and reassembly, and security information.
The Link layer provides the implementation of the communication protocol used to interface to the directly-connected network. A variety of communication protocols have been developed and standadized. The most commonly used protocol is Ethernet (IEEE 802.3).
The four layers structure is defined in RFC 1122. The data flow starts at application layer, through the transport layer, the network layer, and the link layer. Every protocol adds a protocol-specific header and encapsulates the data and header from the layer above as data. On the receiving side the data will be extracted in the complementary direction. The opposed protocols do not know which protocols on the layers above and below are used. The following illustration shows the encapsulation of data within a UDP datagram within an IP packet.