Network Services User's Guide
Table of Contents
Overview
The Network Services product is a collection of application layer networking protocols - such as HTTP Clients (versions 1.1 and 2.0) and SNTP Client, and abstraction layer for TLS that support multiple TLS stacks - SimpleLink WiFi and WolfSSL. These libraries are specifically designed for TI embedded devices keeping in mind the memory constraints on these devices. Also, these protocols are developed to work with various networking stacks such as SimpleLink WiFi, TI-RTOS NDK and Linux networking stacks.
The following subsections describe the features and usage details for the protocols and the abstraction layers.
HTTP Clients
The HyperText Transfer Protocol (HTTP), an ubiquitous application protocol that powers the web, has become the preferred communication protocol for device-to-device communication as well. To jump start the development of such connected embedded devices, TI provides a well defined set of APIs for client-side implementation of the IETF standard for HTTP/1.1 (RFC 2616) and HTTP/2 (RFC 7540). The HTTP/2 APIs are experimental which are subject to change if needed.
These implementations provide APIs to connect, perform HTTP operations (i.e. GET, POST, PUT, HEAD, OPTIONS, DELETE and PATCH) and APIs to process response and extract relevant information such as the response status code and data. Additionally, HTTP/1.1 library includes support for handling redirections (3xx status code) and chunked responses. At the IP level, both IPv4 and IPv6 transports are supported.
With security increasingly being a key concern, the standard security via SSL/TLS to make the session secure (HTTPS) and communication through proxies (HTTP/1.1 only) are included. This implementation supports SimpleLink WiFi TLS stack for Wireless devices and WolfSSL stack for EMAC devices. The detailed instructions for using WolfSSL with TI-RTOS is available in Using WolfSSL with TI-RTOS wiki.
API Reference Guide
The detailed description of the APIs can be found in the reference guides:
Usage
To use the HTTP/1.1 client APIs, the application should include its header file as follows:
#include <ti/net/http/httpcli.h>
Or, to use the HTTP/2 client APIs, the application should include its header file as follows:
#include <ti/net/http/http2cli.h>
HTTP Clients use BSD Socket APIs by including
For SimpleLink WiFi networking layer:
-DNET_SL
For NDK networking layer:
-DNET_NDK
And, add the following library paths (use actual paths) to the link line:
For SimpleLink WiFi networking layer:
-l<NS_INSTALL_DIR>/source/ti/net/http/http_sl.a<target>
-l<NS_INSTALL_DIR>/source/ti/net/network_sl.a<target>
For NDK networking layer:
-l<NS_INSTALL_DIR>/source/ti/net/http/http_ndk.a<target>
-l<NS_INSTALL_DIR>/source/ti/net/network_ndk.a<target>
For NDK networking layer with WolfSSL:
-l<NS_INSTALL_DIR>/source/ti/net/http/http_ndk.a<target>
-l<NS_INSTALL_DIR>/source/ti/net/network_ndk_wolfssl.a<target>
Examples
Example pseudo codes can be found in the reference guides:
SNTP Client
The SNTP client uses the Network Time Protocol (NTP) to provide a continuous service of maintaining system time by synchronizing with NTP servers.
API Reference Guide
The detailed description of the APIs can be found in the SNTP Client API Reference Guide.
Usage
To use the SNTP client APIs, the application should include its header file as follows:
#include <ti/net/sntp/sntp.h>
SNTP Client uses BSD Socket APIs by including
For SimpleLink WiFi networking layer:
-DNET_SL
For NDK networking layer:
-DNET_NDK
And, add the following library paths (use actual paths) to the link line:
For SimpleLink WiFi networking layer:
-l<NS_INSTALL_DIR>/source/ti/net/sntp/sntp_sl.a<target>
-l<NS_INSTALL_DIR>/source/ti/net/network_sl.a<target>
For NDK networking layer:
-l<NS_INSTALL_DIR>/source/ti/net/sntp/sntp_ndk.a<target>
-l<NS_INSTALL_DIR>/source/ti/net/network_ndk.a<target>
Examples
The example usage can be found in the SNTP API Reference Guide.
TLS
The TLS APIs provide a simple portable interface to create and delete TLS contexts for various TLS layers like SimpleLink WiFi and WolfSSL. These contexts can be shared with supported networking protocols like HTTP, MQTT and other protocols which require TLS and connect to the same host server.
The certificates can be provided either as a buffer input or as a string containing the certificate paths on the file system.
API Reference Guide
The detailed description of the APIs can be found in the TLS API Reference Guide.
Usage
To use the TLS APIs, the application should include its header file as follows:
#include <ti/net/tls.h>
And, add the following library paths (use actual paths) to the link line:
For SimpleLink WiFi networking layer:
-l<NS_INSTALL_DIR>/source/ti/net/network_sl.a<target>
For NDK networking layer with WolfSSL:
-l<NS_INSTALL_DIR>/source/ti/net/network_ndk_wolfssl.a<target>
Examples
The example usage can be found in the TLS API Reference Guide.