CC32XX SimpleLink Host Driver  1.0.0.1
 All Data Structures Functions Variables Typedefs Groups Pages
Netapp

Data Structures

struct  SlPingReport_t
 
struct  SlPingStartCommand_t
 
struct  _slHttpServerString_t
 
struct  _slHttpServerData_t
 
struct  _slHttpServerPostData_t
 
union  SlHttpServerEventData_u
 
union  SlHttpServerResponsedata_u
 
struct  SlHttpServerEvent_t
 
struct  SlHttpServerResponse_t
 
struct  SlNetAppDhcpServerBasicOpt_t
 
struct  SlNetAppGetShortServiceIpv4List_t
 
struct  SlNetAppGetFullServiceIpv4List_t
 
struct  SlNetAppGetFullServiceWithTextIpv4List_t
 
struct  SlNetAppServiceAdvertiseTimingParameters_t
 

Macros

#define SL_ERROR_NETAPP_RX_BUFFER_LENGTH_ERROR   (-230)
 
#define MAX_INPUT_STRING   (64) /* because of WPA */
 
#define MAX_AUTH_NAME_LEN   (20)
 
#define MAX_AUTH_PASSWORD_LEN   (20)
 
#define MAX_AUTH_REALM_LEN   (20)
 
#define MAX_DEVICE_URN_LEN   (15+1)
 
#define MAX_DOMAIN_NAME_LEN   (24+1)
 
#define MAX_ACTION_LEN   (30)
 
#define MAX_TOKEN_NAME_LEN   (20)
 
#define MAX_TOKEN_VALUE_LEN   MAX_INPUT_STRING
 
#define NETAPP_MAX_SERVICE_TEXT_SIZE   (256)
 
#define NETAPP_MAX_SERVICE_NAME_SIZE   (60)
 
#define NETAPP_MAX_SERVICE_HOST_NAME_SIZE   (64)
 
#define SL_NETAPP_RESPONSE_NONE   (0)
 
#define SL_NETAPP_HTTPSETTOKENVALUE   (1)
 
#define SL_NETAPP_FAMILY_MASK   (0x80)
 
#define SL_NET_APP_MASK_IPP_TYPE_OF_SERVICE   (0x00000001)
 
#define SL_NET_APP_MASK_DEVICE_INFO_TYPE_OF_SERVICE   (0x00000002)
 
#define SL_NET_APP_MASK_HTTP_TYPE_OF_SERVICE   (0x00000004)
 
#define SL_NET_APP_MASK_HTTPS_TYPE_OF_SERVICE   (0x00000008)
 
#define SL_NET_APP_MASK_WORKSATION_TYPE_OF_SERVICE   (0x00000010)
 
#define SL_NET_APP_MASK_GUID_TYPE_OF_SERVICE   (0x00000020)
 
#define SL_NET_APP_MASK_H323_TYPE_OF_SERVICE   (0x00000040)
 
#define SL_NET_APP_MASK_NTP_TYPE_OF_SERVICE   (0x00000080)
 
#define SL_NET_APP_MASK_OBJECITVE_TYPE_OF_SERVICE   (0x00000100)
 
#define SL_NET_APP_MASK_RDP_TYPE_OF_SERVICE   (0x00000200)
 
#define SL_NET_APP_MASK_REMOTE_TYPE_OF_SERVICE   (0x00000400)
 
#define SL_NET_APP_MASK_RTSP_TYPE_OF_SERVICE   (0x00000800)
 
#define SL_NET_APP_MASK_SIP_TYPE_OF_SERVICE   (0x00001000)
 
#define SL_NET_APP_MASK_SMB_TYPE_OF_SERVICE   (0x00002000)
 
#define SL_NET_APP_MASK_SOAP_TYPE_OF_SERVICE   (0x00004000)
 
#define SL_NET_APP_MASK_SSH_TYPE_OF_SERVICE   (0x00008000)
 
#define SL_NET_APP_MASK_TELNET_TYPE_OF_SERVICE   (0x00010000)
 
#define SL_NET_APP_MASK_TFTP_TYPE_OF_SERVICE   (0x00020000)
 
#define SL_NET_APP_MASK_XMPP_CLIENT_TYPE_OF_SERVICE   (0x00040000)
 
#define SL_NET_APP_MASK_RAOP_TYPE_OF_SERVICE   (0x00080000)
 
#define SL_NET_APP_MASK_ALL_TYPE_OF_SERVICE   (0xFFFFFFFF)
 
#define SL_NET_APP_DNS_QUERY_NO_RESPONSE   (-159) /* DNS query failed, no response */
 
#define SL_NET_APP_DNS_NO_SERVER   (-161) /* No DNS server was specified */
 
#define SL_NET_APP_DNS_PARAM_ERROR   (-162) /* mDNS parameters error */
 
#define SL_NET_APP_DNS_QUERY_FAILED   (-163) /* DNS query failed; no DNS server sent an 'answer' */
 
#define SL_NET_APP_DNS_INTERNAL_1   (-164)
 
#define SL_NET_APP_DNS_INTERNAL_2   (-165)
 
#define SL_NET_APP_DNS_MALFORMED_PACKET   (-166) /* Improperly formed or corrupted DNS packet received */
 
#define SL_NET_APP_DNS_INTERNAL_3   (-167)
 
#define SL_NET_APP_DNS_INTERNAL_4   (-168)
 
#define SL_NET_APP_DNS_INTERNAL_5   (-169)
 
#define SL_NET_APP_DNS_INTERNAL_6   (-170)
 
#define SL_NET_APP_DNS_INTERNAL_7   (-171)
 
#define SL_NET_APP_DNS_INTERNAL_8   (-172)
 
#define SL_NET_APP_DNS_INTERNAL_9   (-173)
 
#define SL_NET_APP_DNS_MISMATCHED_RESPONSE   (-174) /* Server response type does not match the query request*/
 
#define SL_NET_APP_DNS_INTERNAL_10   (-175)
 
#define SL_NET_APP_DNS_INTERNAL_11   (-176)
 
#define SL_NET_APP_DNS_NO_ANSWER   (-177) /* No response for one-shot query */
 
#define SL_NET_APP_DNS_NO_KNOWN_ANSWER   (-178) /* No known answer for query */
 
#define SL_NET_APP_DNS_NAME_MISMATCH   (-179) /* Illegal service name according to the RFC */
 
#define SL_NET_APP_DNS_NOT_STARTED   (-180) /* mDNS is not running */
 
#define SL_NET_APP_DNS_HOST_NAME_ERROR   (-181) /* Host name error. Host name format is not allowed according to RFC 1033,1034,1035, 6763 */
 
#define SL_NET_APP_DNS_NO_MORE_ENTRIES   (-182) /* No more entries be found. */
 
#define SL_NET_APP_DNS_MAX_SERVICES_ERROR   (-200) /* Maximum advertise services are already configured */
 
#define SL_NET_APP_DNS_IDENTICAL_SERVICES_ERROR   (-201) /* Trying to register a service that is already exists */
 
#define SL_NET_APP_DNS_NOT_EXISTED_SERVICE_ERROR   (-203) /* Trying to delete service that does not existed */
 
#define SL_NET_APP_DNS_ERROR_SERVICE_NAME_ERROR   (-204) /* Illegal service name according to the RFC */
 
#define SL_NET_APP_DNS_RX_PACKET_ALLOCATION_ERROR   (-205) /* Retry request */
 
#define SL_NET_APP_DNS_BUFFER_SIZE_ERROR   (-206) /* List size buffer is bigger than internally allowed in the NWP */
 
#define SL_NET_APP_DNS_NET_APP_SET_ERROR   (-207) /* Illegal length of one of the mDNS Set functions */
 
#define SL_NET_APP_DNS_GET_SERVICE_LIST_FLAG_ERROR   (-208)
 
#define SL_NET_APP_DNS_NO_CONFIGURATION_ERROR   (-209)
 
#define SL_ERROR_DEVICE_NAME_LEN_ERR   (-117)
 
#define SL_ERROR_DEVICE_NAME_INVALID   (-118)
 
#define SL_ERROR_DOMAIN_NAME_LEN_ERR   (-119)
 
#define SL_ERROR_DOMAIN_NAME_INVALID   (-120)
 
#define SL_NET_APP_HTTP_SERVER_ID   (1)
 
#define SL_NET_APP_DHCP_SERVER_ID   (2)
 
#define SL_NET_APP_MDNS_ID   (4)
 
#define SL_NET_APP_DNS_SERVER_ID   (8)
 
#define SL_NET_APP_DEVICE_CONFIG_ID   (16)
 
#define NETAPP_SET_DHCP_SRV_BASIC_OPT   (0)
 
#define NETAPP_SET_GET_HTTP_OPT_PORT_NUMBER   (0)
 
#define NETAPP_SET_GET_HTTP_OPT_AUTH_CHECK   (1)
 
#define NETAPP_SET_GET_HTTP_OPT_AUTH_NAME   (2)
 
#define NETAPP_SET_GET_HTTP_OPT_AUTH_PASSWORD   (3)
 
#define NETAPP_SET_GET_HTTP_OPT_AUTH_REALM   (4)
 
#define NETAPP_SET_GET_HTTP_OPT_ROM_PAGES_ACCESS   (5)
 
#define NETAPP_SET_GET_MDNS_CONT_QUERY_OPT   (1)
 
#define NETAPP_SET_GET_MDNS_QEVETN_MASK_OPT   (2)
 
#define NETAPP_SET_GET_MDNS_TIMING_PARAMS_OPT   (3)
 
#define NETAPP_SET_GET_DNS_OPT_DOMAIN_NAME   (0)
 
#define NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN   (0)
 
#define NETAPP_SET_GET_DEV_CONF_OPT_DOMAIN_NAME   (1)
 

Typedefs

typedef struct
_slHttpServerString_t 
slHttpServerString_t
 
typedef struct _slHttpServerData_t slHttpServerData_t
 
typedef struct
_slHttpServerPostData_t 
slHttpServerPostData_t
 
typedef void(* P_SL_DEV_PING_CALLBACK )(SlPingReport_t *)
 

Enumerations

enum  SlNetAppGetServiceListType_e { SL_NET_APP_FULL_SERVICE_WITH_TEXT_IPV4_TYPE = 1, SL_NET_APP_FULL_SERVICE_IPV4_TYPE, SL_NET_APP_SHORT_SERVICE_IPV4_TYPE }
 

Functions

_i16 sl_NetAppStart (_u32 AppBitMap)
 Starts a network application. More...
 
_i16 sl_NetAppStop (_u32 AppBitMap)
 Stops a network application. More...
 
_i16 sl_NetAppDnsGetHostByName (_i8 *hostname, _u16 usNameLen, _u32 *out_ip_addr, _u8 family)
 Get host IP by name. More...
 
_i32 sl_NetAppDnsGetHostByService (_i8 *pServiceName, _u8 ServiceLen, _u8 Family, _u32 pAddr[], _u32 *pPort, _u16 *pTextLen, _i8 *pText)
 Return service attributes like IP address, port and text according to service name. More...
 
_i16 sl_NetAppGetServiceList (_u8 IndexOffest, _u8 MaxServiceCount, _u8 Flags, _i8 *pBuffer, _u32 RxBufferLength)
 Get service List Insert into out pBuffer a list of peer's services that are the NWP. The list is in a form of service struct. The user should chose the type of the service struct like: More...
 
_i16 sl_NetAppMDNSUnRegisterService (const _i8 *pServiceName, _u8 ServiceNameLen)
 Unregister mDNS service This function deletes the mDNS service from the mDNS package and the database. More...
 
_i16 sl_NetAppMDNSRegisterService (const _i8 *pServiceName, _u8 ServiceNameLen, const _i8 *pText, _u8 TextLen, _u16 Port, _u32 TTL, _u32 Options)
 Register a new mDNS service. More...
 
_i16 sl_NetAppPingStart (SlPingStartCommand_t *pPingParams, _u8 family, SlPingReport_t *pReport, const P_SL_DEV_PING_CALLBACK pPingCallback)
 send ICMP ECHO_REQUEST to network hosts More...
 
_i32 sl_NetAppSet (_u8 AppId, _u8 Option, _u8 OptionLen, _u8 *pOptionValue)
 Internal function for setting network application configurations. More...
 
_i32 sl_NetAppGet (_u8 AppId, _u8 Option, _u8 *pOptionLen, _u8 *pOptionValue)
 Internal function for getting network applications configurations. More...
 

Detailed Description

Function Documentation

_i16 sl_NetAppDnsGetHostByName ( _i8 *  hostname,
_u16  usNameLen,
_u32 *  out_ip_addr,
_u8  family 
)

Get host IP by name.

Obtain the IP Address of machine on network, by machine name.

Parameters
[in]hostnamehost name
[in]usNameLenname length
[out]out_ip_addrThis parameter is filled in with host IP address. In case that host name is not resolved, out_ip_addr is zero.
[in]familyprotocol family
Returns
On success, 0 is returned. On error, negative is returned SL_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS Possible DNS error codes:
  • SL_NET_APP_DNS_QUERY_NO_RESPONSE
  • SL_NET_APP_DNS_NO_SERVER
  • SL_NET_APP_DNS_QUERY_FAILED
  • SL_NET_APP_DNS_MALFORMED_PACKET
  • SL_NET_APP_DNS_MISMATCHED_RESPONSE
See also
Note
Only one sl_NetAppDnsGetHostByName can be handled at a time. Calling this API while the same command is called from another thread, may result in one of the two scenarios:
  1. The command will wait (internal) until the previous command finish, and then be executed.
  2. There are not enough resources and POOL_IS_EMPTY error will return. In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try again later to issue the command.
Warning
Example:
_u32 DestinationIP;
sl_NetAppDnsGetHostByName("www.google.com", strlen("www.google.com"), &DestinationIP,SL_AF_INET);
Addr.sin_family = SL_AF_INET;
Addr.sin_port = sl_Htons(80);
Addr.sin_addr.s_addr = sl_Htonl(DestinationIP);
AddrSize = sizeof(SlSockAddrIn_t);
SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
_i32 sl_NetAppDnsGetHostByService ( _i8 *  pServiceName,
_u8  ServiceLen,
_u8  Family,
_u32  pAddr[],
_u32 *  pPort,
_u16 *  pTextLen,
_i8 *  pText 
)

Return service attributes like IP address, port and text according to service name.

The user sets a service name Full/Part (see example below), and should get:
  • IP of service
  • The port of service
  • The text of service

Hence it can make a connection to the specific service and use it. It is similar to get host by name method. It is done by a single shot query with PTR type on the service name. The command that is sent is from constant parameters and variables parameters.

Parameters
[in]pServiceService name can be full or partial.
Example for full service name:
  1. PC1._ipp._tcp.local
  2. PC2_server._ftp._tcp.local
Example for partial service name:
  1. _ipp._tcp.local
  2. _ftp._tcp.local
[in]ServiceLenThe length of the service name (in_pService).
[in]FamilyIPv4 or IPv6 (SL_AF_INET , SL_AF_INET6).
[out]pAddrContains the IP address of the service.
[out]pPortContains the port of the service.
[out]pTextLenHas 2 options. One as Input field and the other one as output:
  • Input:
    Contains the max length of the text that the user wants to get.
    It means that if the text len of service is bigger that its value than the text is cut to inout_TextLen value.
  • Output:
    Contain the length of the text that is returned. Can be full text or part of the text (see above).
[out]pOut_pTextContains the text of the service full or partial
Returns
On success, zero is returned SL_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS In case No service is found error SL_NET_APP_DNS_NO_ANSWER will be returned
Note
The returns attributes belongs to the first service found. There may be other services with the same service name that will response to the query. The results of these responses are saved in the peer cache of the Device and should be read by another API.

Only one sl_NetAppDnsGetHostByService can be handled at a time. Calling this API while the same command is called from another thread, may result in one of the two scenarios:

  1. The command will wait (internal) until the previous command finish, and then be executed.
  2. There are not enough resources and SL_POOL_IS_EMPTY error will return. In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try again later to issue the command.
Warning
Text length can be 120 bytes only
_i32 sl_NetAppGet ( _u8  AppId,
_u8  Option,
_u8 *  pOptionLen,
_u8 *  pOptionValue 
)

Internal function for getting network applications configurations.

Returns
On success, zero is returned. On error, -1 is returned
Parameters
[in]AppIdApplication id, could be one of the following:
  • SL_NET_APP_HTTP_SERVER_ID
  • SL_NET_APP_DHCP_SERVER_ID
[in]OptionsGet option, could be one of the following:
NETAPP_SET_BASIC_OPT
[in]OptionLenThe length of the allocated memory as input, when the function complete, the value of this parameter would be the len that actually read from the device. If the device return length that is longer from the input value, the function will cut the end of the returned structure and will return ESMALLBUF
[out]pValuespointer to the option structure which will be filled with the response from the device
See also
Note
Warning
Get DHCP Server parameters example:
_u8 outLen = sizeof(SlNetAppDhcpServerBasicOpt_t);
sl_NetAppGet(SL_NET_APP_DHCP_SERVER_ID, NETAPP_SET_DHCP_SRV_BASIC_OPT, &outLen, (_u8* )&dhcpParams);
printf("DHCP Start IP %d.%d.%d.%d End IP %d.%d.%d.%d Lease time seconds %d\n",
SL_IPV4_BYTE(dhcpParams.ipv4_addr_start,3),SL_IPV4_BYTE(dhcpParams.ipv4_addr_start,2),
SL_IPV4_BYTE(dhcpParams.ipv4_addr_start,1),SL_IPV4_BYTE(dhcpParams.ipv4_addr_start,0),
SL_IPV4_BYTE(dhcpParams.ipv4_addr_last,3),SL_IPV4_BYTE(dhcpParams.ipv4_addr_last,2),
SL_IPV4_BYTE(dhcpParams.ipv4_addr_last,1),SL_IPV4_BYTE(dhcpParams.ipv4_addr_last,0),
dhcpParams.lease_time);
Get Device URN name example:
Maximum length of 33 characters of device name.
Device name affects URN name, own SSID name in AP mode, and WPS file "device name" in WPS I.E (STA-WPS / P2P)
in case no device URN name set, the default name is "mysimplelink"
_u8 my_device_name[35];
sl_NetAppGet (SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, strlen(my_device_name), (_u8 *)my_device_name);
_i16 sl_NetAppGetServiceList ( _u8  IndexOffest,
_u8  MaxServiceCount,
_u8  Flags,
_i8 *  pBuffer,
_u32  RxBufferLength 
)

Get service List Insert into out pBuffer a list of peer's services that are the NWP. The list is in a form of service struct. The user should chose the type of the service struct like:

  • Full service parameters with text.
  • Full service parameters.
  • Short service parameters (port and IP only) especially for tiny hosts.

The different types of struct are made to give the Possibility to save memory in the host

The user also chose how many max services to get and start point index NWP peer cache. For example:

  1. Get max of 3 full services from index 0.Up to 3 full services from index 0 are inserted into pBuffer (services that are in indexes 0,1,2).
  2. Get max of 4 full services from index 3.Up to 4 full services from index 3 are inserted into pBuffer (services that are in indexes 3,4,5,6).
  3. Get max of 2 int services from index 6.Up to 2 int services from index 6 are inserted into pBuffer (services that are in indexes 6,7).

See below - command parameters.

Parameters
[in]indexOffset- The start index in the peer cache that from it the first service is returned.
[in]MaxServiceCount- The Max services that can be returned if existed or if not exceed the max index in the peer cache
[in]Flags- an ENUM number that means which service struct to use (means which types of service to fill)
[out]Buffer- The Services are inserted into this buffer. In the struct form according to the bit that is set in the Flags input parameter.
Returns
ServiceFoundCount - The number of the services that were inserted into the buffer. zero means no service is found negative number means an error
See also
sl_NetAppMDNSRegisterService
Note
Warning
if the out pBuffer size is bigger than an RX packet(1480), than an error is returned because there is no place in the RX packet. The size is a multiply of MaxServiceCount and size of service struct(that is set according to flag value).
_i16 sl_NetAppMDNSRegisterService ( const _i8 *  pServiceName,
_u8  ServiceNameLen,
const _i8 *  pText,
_u8  TextLen,
_u16  Port,
_u32  TTL,
_u32  Options 
)

Register a new mDNS service.

This function registers a new mDNS service to the mDNS package and the DB.

This registered service is a service offered by the application. The service name should be full service name according to RFC of the DNS-SD - meaning the value in name field in the SRV answer. Example for service name:

  1. PC1._ipp._tcp.local
  2. PC2_server._ftp._tcp.local

If the option is_unique is set, mDNS probes the service name to make sure it is unique before starting to announce the service on the network. Instance is the instance portion of the service name.

Parameters
[in]ServiceLenThe length of the service.
[in]TextLenThe length of the service should be smaller than 64.
[in]portThe port on this target host port.
[in]TTLThe TTL of the service
[in]Optionsbitwise parameters:
  • bit 0 - service is unique (means that the service needs to be unique)
  • bit 31 - for internal use if the service should be added or deleted (set means ADD).
  • bit 1-30 for future.
[in]pServiceNameThe service name. Example for service name:
  1. PC1._ipp._tcp.local
  2. PC2_server._ftp._tcp.local
[in]pTextThe description of the service. should be as mentioned in the RFC (according to type of the service IPP,FTP...)
Returns
On success, zero is returned Possible error codes:
  • Maximum advertise services are already configured. Delete another existed service that is registered and then register again the new service
  • Trying to register a service that is already exists
  • Trying to delete service that does not existed
  • Illegal service name according to the RFC
  • Retry request
  • Illegal length of one of the mDNS Set functions
  • mDNS is not operational as the device has no IP.Connect the device to an AP to get an IP address.
  • mDNS parameters error
  • mDNS internal cache error
  • mDNS internal error
  • Adding a service is not allowed as it is already exist (duplicate service)
  • mDNS is not running
  • Host name error. Host name format is not allowed according to RFC 1033,1034,1035, 6763
  • List size buffer is bigger than internally allowed in the NWP (API get service list), change the APIsí parameters to decrease the size of the list
See also
sl_NetAppMDNSUnRegisterService
Warning
1) Temporary - there is an allocation on stack of internal buffer. Its size is NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
It means that the sum of the text length and service name length cannot be bigger than NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
If it is - An error is returned.
2) According to now from certain constraints the variables parameters are set in the attribute part (contain constant parameters)
_i16 sl_NetAppMDNSUnRegisterService ( const _i8 *  pServiceName,
_u8  ServiceNameLen 
)

Unregister mDNS service This function deletes the mDNS service from the mDNS package and the database.

The mDNS service that is to be unregistered is a service that the application no longer wishes to provide.
The service name should be the full service name according to RFC of the DNS-SD - meaning the value in name field in the SRV answer.

Examples for service names:

  1. PC1._ipp._tcp.local
  2. PC2_server._ftp._tcp.local
Parameters
[in]pServiceNameFull service name.
Example for service name:
  1. PC1._ipp._tcp.local
  2. PC2_server._ftp._tcp.local
[in]ServiceLenThe length of the service.
Returns
On success, zero is returned
See also
sl_NetAppMDNSRegisterService
Note
Warning
The size of the service length should be smaller than 255.
_i16 sl_NetAppPingStart ( SlPingStartCommand_t pPingParams,
_u8  family,
SlPingReport_t pReport,
const P_SL_DEV_PING_CALLBACK  pPingCallback 
)

send ICMP ECHO_REQUEST to network hosts

Ping uses the ICMP protocol's mandatory ECHO_REQUEST

Parameters
[in]pPingParamsPointer to the ping request structure:
  • if flags parameter is set to 0, ping will report back once all requested pings are done (as defined by TotalNumberOfAttempts).
  • if flags parameter is set to 1, ping will report back after every ping, for TotalNumberOfAttempts.
  • if flags parameter is set to 2, ping will stop after the first successful ping, and report back for the successful ping, as well as any preceding failed ones. For stopping an ongoing ping activity, set parameters IP address to 0
[in]familySL_AF_INET or SL_AF_INET6
[out]pReportPing pReport
[out]pCallbackCallback function upon completion. If callback is NULL, the API is blocked until data arrives
Returns
On success, zero is returned. On error, -1 is returned SL_POOL_IS_EMPTY may be return in case there are no resources in the system In this case try again later or increase MAX_CONCURRENT_ACTIONS
See also
sl_NetAppPingReport
Note
Only one sl_NetAppPingStart can be handled at a time. Calling this API while the same command is called from another thread, may result in one of the two scenarios:
  1. The command will wait (internal) until the previous command finish, and then be executed.
  2. There are not enough resources and SL_POOL_IS_EMPTY error will return. In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try again later to issue the command.
Warning
Example:
An example of sending 20 ping requests and reporting results to a callback routine when
all requests are sent:
// callback routine
void pingRes(SlPingReport_t* pReport)
{
// handle ping results
}
// ping activation
void PingTest()
{
SlPingStartCommand_t pingCommand;
pingCommand.Ip = SL_IPV4_VAL(10,1,1,200); // destination IP address is 10.1.1.200
pingCommand.PingSize = 150; // size of ping, in bytes
pingCommand.PingIntervalTime = 100; // delay between pings, in milliseconds
pingCommand.PingRequestTimeout = 1000; // timeout for every ping in milliseconds
pingCommand.TotalNumberOfAttempts = 20; // max number of ping requests. 0 - forever
pingCommand.Flags = 0; // report only when finished
sl_NetAppPingStart( &pingCommand, SL_AF_INET, &report, pingRes ) ;
}
_i32 sl_NetAppSet ( _u8  AppId,
_u8  Option,
_u8  OptionLen,
_u8 *  pOptionValue 
)

Internal function for setting network application configurations.

Returns
On success, zero is returned. On error, -1 is returned
Parameters
[in]AppIdApplication id, could be one of the following:
  • SL_NET_APP_HTTP_SERVER_ID
  • SL_NET_APP_DHCP_SERVER_ID
  • SL_NET_APP_DHCP_SERVER_ID
[in]SetOptionsset option, could be one of the following:
NETAPP_SET_BASIC_OPT
[in]OptionLenoption structure length
[in]pOptionValuespointer to the option structure
See also
Note
Warning
Set DHCP Server (AP mode) parameters example:
_u8 outLen = sizeof(SlNetAppDhcpServerBasicOpt_t);
dhcpParams.lease_time = 4096; // lease time (in seconds) of the IP Address
dhcpParams.ipv4_addr_start = SL_IPV4_VAL(192,168,1,10); // first IP Address for allocation. IP Address should be set as Hex number - i.e. 0A0B0C01 for (10.11.12.1)
dhcpParams.ipv4_addr_last = SL_IPV4_VAL(192,168,1,16); // last IP Address for allocation. IP Address should be set as Hex number - i.e. 0A0B0C01 for (10.11.12.1)
sl_NetAppStop(SL_NET_APP_DHCP_SERVER_ID); // Stop DHCP server before settings
sl_NetAppSet(SL_NET_APP_DHCP_SERVER_ID, NETAPP_SET_DHCP_SRV_BASIC_OPT, outLen, (_u8* )&dhcpParams); // set parameters
sl_NetAppStart(SL_NET_APP_DHCP_SERVER_ID); // Start DHCP server with new settings
Set Device URN name example:
Device name, maximum length of 33 characters
Device name affects URN name, own SSID name in AP mode, and WPS file "device name" in WPS I.E (STA-WPS / P2P)
In case no device URN name set, the default name is "mysimplelink"
Allowed characters in device name are: 'a - z' , 'A - Z' , '0-9' and '-'
_u8 *my_device = "MY-SIMPLELINK-DEV";
sl_NetAppSet (SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, strlen(my_device), (_u8 *) my_device);
_i16 sl_NetAppStart ( _u32  AppBitMap)

Starts a network application.

Gets and starts network application for the current WLAN mode

Parameters
[in]AppBitMapapplication bitmap, could be one or combination of the following:
  • SL_NET_APP_HTTP_SERVER_ID
  • SL_NET_APP_DHCP_SERVER_ID
  • SL_NET_APP_MDNS_ID
Returns
On error, negative number is returned
See also
Stop one or more the above started applications using sl_NetAppStop
Note
This command activates the application for the current WLAN mode (AP or STA)
Warning
Example:
For example: Starting internal HTTP server + DHCP server:
sl_NetAppStart(SL_NET_APP_HTTP_SERVER_ID | SL_NET_APP_DHCP_SERVER_ID)
_i16 sl_NetAppStop ( _u32  AppBitMap)

Stops a network application.

Gets and stops network application for the current WLAN mode

Parameters
[in]AppBitMapapplication id, could be one of the following:
  • SL_NET_APP_HTTP_SERVER_ID
  • SL_NET_APP_DHCP_SERVER_ID
  • SL_NET_APP_MDNS_ID
Returns
On error, negative number is returned
See also
Note
This command disables the application for the current active WLAN mode (AP or STA)
Warning
Example:
For example: Stopping internal HTTP server:
sl_NetAppStop(SL_NET_APP_HTTP_SERVER_ID);