HsTCPIPv4 - Embedded TCP IP Protocol Stack

Overview

HsTCPIPv4 is a suite of cross platform ANSI C source code libraries which fully implement TCP IP protocol. HsTCPIPv4 as a whole or any of its included components can be used in an embedded system or on PC.

HsTCPIPv4 is supplied with full ANSI C source code and binaries.

HsTCPIPv4 has been tested on both Little-endian (Intel x86) and Big-endian (Freescale / Motorola PowerQUICC) memory architectures.

HsTCPIPv4 includes the following components / protocols:.

  • ARP, ICMP, IP, UDP, TCP
  • DHCP / BOOTP (client), DNS (client)
  • TFTP, FTP, NTP / SNTP
  • POP3, SMTP
  • Sample applications: ICMP Ping, NTP client, TFTP server and Client, FTP Client, POP3 Client, SMTP Client

The use of HsTCPIPv4 source code is royalty free.

HsTCPIPv4 includes sample applications with source code HsTCPIPv4 can be tested on Windows PC.

To test on windows PC, please first install free WinPcap packet driver
http://www.winpcap.org/install/default.htm

HsTCPIPv4 demo applications for windows use WinPcap to enable HsTCPIPv4 to communicate directly to ethernet packet driver, as it would be in a embedded system. Before testing, disable windows TCP/IP on your network adapter: right click local area connection, click properties, unselect Internet Protocol (TCP/IP) and click OK.




HsTCPIPv4 Software Architecture

HsTCPIPv4 is designed in a modular way, you can use only the specific modules you need for your application



At the top level are sample applications supplied with HsTCPIPv4 protocol stack: SMTP client, POP3 client, FTP client, TFTP server and client, NTP client and ICMP Ping.

These applications use their respective library part of HsTCPIPv4: HsSmtp, HsPop3, HsFtp, HsTftp, HsNtp, HsIcmp

The above protocol modules interface to a common socket layer HsSock.

HsSock library is talking to TCP (HsTcp) and UDP (HsUdp) modules

Both TCP and UDP modules and ICMP module interface to IP module (HsIp)

HsIp interfaces to ARP (HsArp) module. Both ARP and IP libraries interface to user supplied ethernet packet driver.

HsTCPIPv4 protocol stack parameter configuration is done through HsSock module either using static parameters (IP address, Router IP address, subnet mask, DNS server IP address) or using dynamic configuration via HsDhcp library

All protocol modules use HsDns API if it is necessary to resolve target domain name to an IP address


Description of Individual Modules

HsIp

HsIP module implements IP (Internet Protocol) layer as specified in RFC 791. HsIp primary functions include:

  • Building IP packets and transmitting to the network using ethernet packet driver API
  • Resolving destination IP address to ethernet MAC address using HsArp module API
  • IP packet fragmentation if payload exceeds configured MTU
  • Processing received IP datagrams
  • IP fragment re-assembly

HsArp

HsArp module implements ARP (Address Resolution Protocol) protocol as specified in RFC 826. HsArp primary function include:

  • Serving HsIP and HsIcmp requests (via API call) to resolve 4 byte IP address to a 6 byte MAC address.
  • Building and sending ARP protocol packets
  • Reception of processing of ARP protocol packets
  • HsArp maintains ARP table and uses fast hash lookup algorithm to find MAC address by IP address if it is already in ARP table

HsIcmp

HsIcmp module implements ICMP (Internet Control Message Protocol), specifically 2 functions:

  • Responding to incoming ICMP echo requests received from the network
  • Sending and ICMP echo requests and processing ICMP echo replies

HsTcp

HsTcp module implements TCP (Transport Control Protocol) as per RFC 793. It is the most complex part of HsTCPIPv4 suite and is responsible for many functions, such as:

  • Incoming and outgoing connection establishment / connection management, selection of unique initial sequence numbers,
  • TCP options negotiation
  • Reliable data transmission, error detection, re-transmissions
  • Flow control, congestion control

HsUdp

HsUdp module implements UDP (User Datagram Protocol) as per RFC 768. It's functions include:

  • Building and sending UDP datagrams using HsIP module
  • Processing UDP datagrams received from HsIP module

HsSock

HsSock module provides a common API interface to network level protocols fusing UDP and TCP protocols. The services of HsSock are used by HsSmtp, HsPop3, HsFtp, HsTftp, HsNtp, HsDns, HsDhcp. HsSock interface can also be used directly from a user application. The function of HsSock module is session management.

HsDns

HsDns module implements client side of domain name resolution to an IP address. It is implemented using a simple client server request response model. HsDns provides services to all network level protocols.

HsDhcp

HsDhcp module implements client side of Dynamic Host Configuration Protocol (DHCP) according to RFC 2131. HsSock module can update all relevant components of HsTCPIPv4 stack with new network parameters received from HsDhcp. Supported network parameters include IP address, router IP address, network mask, DNS server ip address. HsDhcp functions include:

  • Requesting network parameters from a DHCP server
  • IP lease management, renewal, re-binding and release

HsSmtp

HsSmtp module implements client side of Simple Mail Transfer Protocol (SMTP) as per RFC821. SMTP functions include:

  • Transmission of message header and text to SMTP server
  • ESMTP extension for authentication using LOGIN base64 encoding
  • Message sending to multiple recipients from address list
  • Sending binary file attachments using MIME version 1.0 base64 encoding

HsPop3

HsPop3 module implements client side of Post Office Protocol (POP3) as per RFC 1939. HsPop3 functions include:

  • Reception of message header and text
  • Supported POP3 commands: USER, PASS, STAT, LIST, UIDL, RETR, DELE, QUIT

HsFtp

HsFtp module implements client side of File Transfer Protocol as per RFC 959. FTP functions include:

  • Session authentication and connection management
  • Transmission and reception of files and folders
  • Requesting, receiving, processing and parsing directory listings
  • Traversing / browsing server directory tree
  • Creating and deleting files and folders
  • Recursive folder upload, download and delete
  • Supported FTP Commands: USER, PASS, PASV, LIST, TYPE, RETR, STOR, CWD, MKD, RMD, DELE, NOOP, PWD, RNFR, RNTO

HsTftp

HsTftp module implements Trivial File Transfer Protocol (TFTP) client and server side as per RFC 1350. HsTftp functions include

  • File transmission and reception in server and client modes
  • Detection of packet loss and error recovery using timers, sequence numbers and retransmissions
  • Blocksize option negotiation

HsNtp

HsNtp module implements client side of Network Time Protocol (NTP) as per RFC 2030. Its functions include

  • Building NTP request packet and transmission to NTP server
  • Reception and processing of NTP reply from NTP server and calculating time offset.

Customization

Hillstone Software provides additional services for customization, porting and integration of the library code to better suit the needs of your products