Network Services API  2.75.00.17
SL Interface Porting Guide

Introduction

The generic SlNetSock layer sits between the application/service and the interface stack. This guide describes the details of adding a network stack into the SlNetSock environment.

The porting steps for adding new interface:

  1. Create slnetifxxx file for the new interface
  2. Select the capabilities set
  3. Adding the interface to your application/service
  4. Add the relevant functions to your application/service
  5. Test your code to validate the correctness of your porting

Step 1 - slnetifxxx.c and slnetifxxx.h file for your interface

Each interface needs to provide a set of API's to work with the interface. Some are mandatory, others are optional (but recommended).

Step 2 - Select the capabilities set

The capabilities prototype should be declared in your slnetifxxx.h and implemented in your slnetifxxx.c

Each mandatory API's must be set, additional API's can be set or must be set to NULL.

An example config declaration for TI's SimpleLink CC31XX/CC32xx

SlNetIfConfig SlNetIfConfigWiFi =
{
SlNetIfWifi_socket, // Callback function sockCreate in slnetif module
SlNetIfWifi_close, // Callback function sockClose in slnetif module
NULL, // Callback function sockShutdown in slnetif module
SlNetIfWifi_accept, // Callback function sockAccept in slnetif module
SlNetIfWifi_bind, // Callback function sockBind in slnetif module
SlNetIfWifi_listen, // Callback function sockListen in slnetif module
SlNetIfWifi_connect, // Callback function sockConnect in slnetif module
NULL, // Callback function sockGetPeerName in slnetif module
NULL, // Callback function sockGetLocalName in slnetif module
SlNetIfWifi_select, // Callback function sockSelect in slnetif module
SlNetIfWifi_setSockOpt, // Callback function sockSetOpt in slnetif module
SlNetIfWifi_getSockOpt, // Callback function sockGetOpt in slnetif module
SlNetIfWifi_recv, // Callback function sockRecv in slnetif module
SlNetIfWifi_recvFrom, // Callback function sockRecvFrom in slnetif module
SlNetIfWifi_send, // Callback function sockSend in slnetif module
SlNetIfWifi_sendTo, // Callback function sockSendTo in slnetif module
SlNetIfWifi_sockstartSec, // Callback function sockstartSec in slnetif module
SlNetIfWifi_getHostByName, // Callback function utilGetHostByName in slnetif module
SlNetIfWifi_getIPAddr, // Callback function ifGetIPAddr in slnetif module
SlNetIfWifi_getConnectionStatus, // Callback function ifGetConnectionStatus in slnetif module
SlNetIfWifi_loadSecObj, // Callback function ifLoadSecObj in slnetif module
NULL // Callback function ifCreateContext in slnetif module
};

In the example above the following API's are not supported by the interface, and are set to NULL:

Step 3 - Adding the interface to your application/service

Include the new file in the board header file in the application.

Step 4 - Add the relevant functions to your application/service

After configuring the capabilities of the interface, Adding the interface to the SlNetSock is required.

Use SlNetIf_add in order to add the interface and set his ID, Name, function list and priority. Later on you need to use the BSD API's or SlNetSock API's for socket handling.

Step 5 - Test your code to validate the correctness of your porting

After porting the layer into your setup, validate that your code work as expected

© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale