SimpleLink CC32xx ATCommands Library
Simplifies the implementation of Internet connectivity
NetApp

Activates networking applications, such as: HTTP Server, DHCP Server, Ping, DNS and mDNS. More...

Functions

int32_t ATCmdNetapp_startCallback (void *arg)
 Netapp start callback. More...
 
int32_t ATCmdNetapp_stopCallback (void *arg)
 Netapp stop callback. More...
 
int32_t ATCmdNetapp_getHostByNameCallback (void *arg)
 Netapp Get Host By Name callback. More...
 
int32_t ATCmdNetapp_getHostByServiceCallback (void *arg)
 Netapp Get Host By Service callback. More...
 
int32_t ATCmdNetapp_getCallback (void *arg)
 Netapp Get callback. More...
 
int32_t ATCmdNetapp_setCallback (void *arg)
 Netapp Set callback. More...
 
int32_t ATCmdNetapp_sendCallback (void *arg)
 Netapp Send callback. More...
 
int32_t ATCmdNetapp_recvCallback (void *arg)
 Netapp Recv callback. More...
 
int32_t ATCmdNetapp_pingCallback (void *arg)
 Netapp Ping callback. More...
 
int32_t ATCmdNetapp_getServiceListCallback (void *arg)
 Netapp GetServiceList callback. More...
 
int32_t ATCmdNetapp_registerServiceCallback (void *arg)
 Netapp RegisterMDNS callback. More...
 
int32_t ATCmdNetapp_unregisterServiceCallback (void *arg)
 Netapp UnregisterMDNS callback. More...
 

Detailed Description

Activates networking applications, such as: HTTP Server, DHCP Server, Ping, DNS and mDNS.

Function Documentation

§ ATCmdNetapp_getCallback()

int32_t ATCmdNetapp_getCallback ( void *  arg)

Netapp Get callback.

This routine gets network applications configurations

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp Get callback.

This routine gets network applications configurations

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 2037 of file atcmd_netapp.c.

2038 {
2039  int32_t ret = 0;
2040  ATCmdNetapp_Set_t *params;
2041 
2042  params = malloc(sizeof(ATCmdNetapp_Set_t));
2043 
2044  if (params == NULL)
2045  {
2046  ATCmd_errorResult(ATCmd_errorAllocStr,0);
2047  return -1;
2048  }
2049  memset(params, 0x0, sizeof(ATCmdNetapp_Set_t));
2050 
2051  /* Call the command parser */
2052  ret = ATCmdNetapp_getParse((char *)arg, params);
2053 
2054  if (ret < 0)
2055  {
2056  ATCmd_errorResult(ATCmd_errorParseStr,ret);
2057  ATCmdNetapp_getFree(params);
2058  return -1;
2059  }
2060 
2061  /* set netapp option */
2062  ret = sl_NetAppGet(params->id,params->option,&params->len,params->value);
2063 
2064  if (ret < 0)
2065  {
2066  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
2067  ATCmdNetapp_getFree(params);
2068  }
2069  else
2070  {
2071  ATCmd_commandResult(ATCmdNetapp_getResult,params,0);
2072  ATCmd_okResult();
2073  }
2074 
2075  return ret;
2076 }

§ ATCmdNetapp_getHostByNameCallback()

int32_t ATCmdNetapp_getHostByNameCallback ( void *  arg)

Netapp Get Host By Name callback.

This routine get host IP by name

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp Get Host By Name callback.

This routine get host IP by name

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 339 of file atcmd_netapp.c.

340 {
341  int32_t ret = 0;
342  ATCmdNetapp_GetHostByName_t *params;
343 
344  params = malloc(sizeof(ATCmdNetapp_GetHostByName_t));
345 
346  if (params == NULL)
347  {
348  ATCmd_errorResult(ATCmd_errorAllocStr,0);
349  return -1;
350  }
351  memset(params, 0x0, sizeof(ATCmdNetapp_GetHostByName_t));
352 
353  /* Call the command parser */
354  ret = ATCmdNetapp_getHostByNameParse((char *)arg, params);
355 
356  if (ret < 0)
357  {
358  ATCmd_errorResult(ATCmd_errorParseStr,ret);
359  ATCmdNetapp_getHostByNameFree(params);
360  return -1;
361  }
362 
363  /* Get host by name */
364  ret = sl_NetAppDnsGetHostByName(params->hostName, params->nameLen, (_u32 *)params->addr, params->family);
365 
366  if (ret < 0)
367  {
368  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
369  ATCmdNetapp_getHostByNameFree(params);
370  }
371  else
372  {
373  ATCmd_commandResult(ATCmdNetapp_getHostByNameResult,params,0);
374  ATCmd_okResult();
375  }
376 
377  return ret;
378 }

§ ATCmdNetapp_getHostByServiceCallback()

int32_t ATCmdNetapp_getHostByServiceCallback ( void *  arg)

Netapp Get Host By Service callback.

This routine get host IP by service

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp Get Host By Service callback.

This routine get host IP by service

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 483 of file atcmd_netapp.c.

484 {
485  int32_t ret = 0;
486  ATCmdNetapp_GetHostByService_t *params;
487 
488  params = malloc(sizeof(ATCmdNetapp_GetHostByService_t));
489 
490  if (params == NULL)
491  {
492  ATCmd_errorResult(ATCmd_errorAllocStr,0);
493  return -1;
494  }
495  memset(params, 0x0, sizeof(ATCmdNetapp_GetHostByService_t));
496 
497  /* Call the command parser */
498  ret = ATCmdNetapp_getHostByServiceParse((char *)arg, params);
499 
500  if (ret < 0)
501  {
502  ATCmd_errorResult(ATCmd_errorParseStr,ret);
503  ATCmdNetapp_getHostByServiceFree(params);
504  return -1;
505  }
506 
507  params->textLen = SL_NETAPP_MAX_SERVICE_TEXT_SIZE;
508  params->text = malloc(params->textLen);
509  if (params->text == NULL)
510  {
511  ATCmd_errorResult(ATCmd_errorAllocStr,0);
512  ATCmdNetapp_getHostByServiceFree(params);
513  return -1;
514  }
515  /* Get host by service */
516  ret = sl_NetAppDnsGetHostByService(params->serviceName, params->serviceLen, params->family,(_u32 *)params->addr,(_u32 *)&params->port,&params->textLen,params->text);
517 
518  if (ret < 0)
519  {
520  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
521  ATCmdNetapp_getHostByServiceFree(params);
522  }
523  else
524  {
525  ATCmd_commandResult(ATCmdNetapp_getHostByServiceResult,params,0);
526  ATCmd_okResult();
527  }
528 
529  return ret;
530 }

§ ATCmdNetapp_getServiceListCallback()

int32_t ATCmdNetapp_getServiceListCallback ( void *  arg)

Netapp GetServiceList callback.

This routine get service list

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp GetServiceList callback.

This routine get service list

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 1135 of file atcmd_netapp.c.

1136 {
1137  int32_t ret = 0;
1138  ATCmdNetapp_GetServiceList_t *params;
1139 
1140  params = malloc(sizeof(ATCmdNetapp_GetServiceList_t));
1141 
1142  if (params == NULL)
1143  {
1144  ATCmd_errorResult(ATCmd_errorAllocStr,0);
1145  return -1;
1146  }
1147  memset(params, 0x0, sizeof(ATCmdNetapp_GetServiceList_t));
1148 
1149  /* Call the command parser */
1150  ret = ATCmdNetapp_getServiceListParse((char *)arg, params);
1151 
1152  if (ret < 0)
1153  {
1154  ATCmd_errorResult(ATCmd_errorParseStr,ret);
1155  ATCmdNetapp_getServiceListFree(params);
1156  return -1;
1157  }
1158  params->bufferLen = params->maxCount * ATCmdNetapp_serviceSize[params->flags];
1159  if (params->bufferLen > ATCMDNETAPP_MAX_BUFFER_LEN)
1160  {
1161  params->bufferLen = ATCMDNETAPP_MAX_BUFFER_LEN;
1162  }
1163  params->buffer = malloc(params->bufferLen);
1164  if (params->buffer == NULL)
1165  {
1166  ATCmd_errorResult(ATCmd_errorAllocStr,0);
1167  ATCmdNetapp_getServiceListFree(params);
1168  return -1;
1169  }
1170  /* netapp GetServiceList */
1171  params->count = sl_NetAppGetServiceList(params->offest, params->maxCount, params->flags,params->buffer,params->bufferLen);
1172 
1173  if (params->count < 0)
1174  {
1175  ATCmd_errorResult(ATCmd_errorCmdStr,params->count);
1176  ATCmdNetapp_getServiceListFree(params);
1177  return -1;
1178  }
1179  else
1180  {
1181  ATCmd_commandResult(ATCmdNetapp_getServiceListResult,params,0);
1182  ATCmd_okResult();
1183  }
1184 
1185  return ret;
1186 }

§ ATCmdNetapp_pingCallback()

int32_t ATCmdNetapp_pingCallback ( void *  arg)

Netapp Ping callback.

This routine send ping to network hosts

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp Ping callback.

This routine send ping to network hosts

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 942 of file atcmd_netapp.c.

943 {
944  int32_t ret = 0;
945  ATCmdNetapp_Ping_t params;
946 
947  memset(&params, 0x0, sizeof(ATCmdNetapp_Ping_t));
948 
949  /* Call the command parser */
950  ret = ATCmdNetapp_pingParse((char *)arg, &params);
951 
952  if (ret < 0)
953  {
954  ATCmd_errorResult(ATCmd_errorParseStr,ret);
955  return -1;
956  }
957 
958  /* netapp ping */
959  ret = sl_NetAppPing(&params.pingParams, params.family,&params.report,ATCmdNetapp_pingReport);
960 
961  if (ret < 0)
962  {
963  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
964  }
965  else
966  {
967  ATCmd_okResult();
968  }
969 
970  return ret;
971 }

§ ATCmdNetapp_recvCallback()

int32_t ATCmdNetapp_recvCallback ( void *  arg)

Netapp Recv callback.

This routine receives data from the network processor

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp Recv callback.

This routine receives data from the network processor following a Netapp response event

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 774 of file atcmd_netapp.c.

775 {
776  int32_t ret = 0;
777  ATCmdNetapp_t *params;
778 
779  params = malloc(sizeof(ATCmdNetapp_t));
780 
781  if (params == NULL)
782  {
783  ATCmd_errorResult(ATCmd_errorAllocStr,0);
784  return -1;
785  }
786 
787  memset(params, 0x0, sizeof(ATCmdNetapp_t));
788 
789  /* Call the command parser */
790  ret = ATCmdNetapp_recvParse((char *)arg, params);
791 
792  if (ret < 0)
793  {
794  ATCmd_errorResult(ATCmd_errorParseStr,ret);
795  ATCmdNetapp_recvFree(params);
796  return -1;
797  }
798 
799  /* netapp recv */
800  ret = sl_NetAppRecv(params->handle, &params->len, params->data,(_u32 *)&params->flags);
801 
802  if (ret < 0)
803  {
804  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
805  ATCmdNetapp_recvFree(params);
806  }
807  else
808  {
809  ATCmd_commandResult(ATCmdNetapp_recvResult,params,0);
810  ATCmd_okResult();
811  }
812 
813  return ret;
814 }

§ ATCmdNetapp_registerServiceCallback()

int32_t ATCmdNetapp_registerServiceCallback ( void *  arg)

Netapp RegisterMDNS callback.

This routine register a new mDNS service

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp RegisterMDNS callback.

This routine register a new mDNS service

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 1269 of file atcmd_netapp.c.

1270 {
1271  int32_t ret = 0;
1272  ATCmdNetapp_RegisterService_t params;
1273 
1274  memset(&params, 0x0, sizeof(ATCmdNetapp_RegisterService_t));
1275 
1276  /* Call the command parser */
1277  ret = ATCmdNetapp_registerServiceParse((char *)arg, &params);
1278 
1279  if (ret < 0)
1280  {
1281  ATCmd_errorResult(ATCmd_errorParseStr,ret);
1282  ATCmdNetapp_registerServiceFree(&params);
1283  return -1;
1284  }
1285 
1286  if ((params.serviceNameLen + params.textLen) > SL_NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH)
1287  {
1288  ATCmd_errorResult(ATCmd_errorParseStr,0);
1289  ATCmdNetapp_registerServiceFree(&params);
1290  return -1;
1291  }
1292 
1293  /* netapp MDNSRegisterService */
1294  ret = sl_NetAppMDNSRegisterService(params.serviceName, params.serviceNameLen, params.text,params.textLen,params.port,params.ttl,params.options);
1295 
1296  if (ret < 0)
1297  {
1298  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
1299  }
1300  else
1301  {
1302  ATCmd_okResult();
1303  }
1304  ATCmdNetapp_registerServiceFree(&params);
1305 
1306  return ret;
1307 }

§ ATCmdNetapp_sendCallback()

int32_t ATCmdNetapp_sendCallback ( void *  arg)

Netapp Send callback.

This routine sends Netapp response or data

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp Send callback.

This routine sends Netapp response or data following a Netapp request event

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 629 of file atcmd_netapp.c.

630 {
631  int32_t ret = 0;
632  ATCmdNetapp_t params;
633 
634  memset(&params, 0x0, sizeof(ATCmdNetapp_t));
635 
636  /* Call the command parser */
637  ret = ATCmdNetapp_sendParse((char *)arg, &params);
638 
639  if (ret < 0)
640  {
641  ATCmd_errorResult(ATCmd_errorParseStr,ret);
642  ATCmdNetapp_sendFree(&params);
643  return -1;
644  }
645 
646  /* netapp send */
647  ret = sl_NetAppSend(params.handle, params.len, params.data,params.flags);
648 
649  if (ret < 0)
650  {
651  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
652  }
653  else
654  {
655  ATCmd_okResult();
656  }
657 
658  ATCmdNetapp_sendFree(&params);
659  return ret;
660 }

§ ATCmdNetapp_setCallback()

int32_t ATCmdNetapp_setCallback ( void *  arg)

Netapp Set callback.

This routine sets network applications configurations

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp Set callback.

This routine sets network applications configurations

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 1698 of file atcmd_netapp.c.

1699 {
1700  int32_t ret = 0;
1701  ATCmdNetapp_Set_t params;
1702 
1703  memset(&params, 0x0, sizeof(ATCmdNetapp_Set_t));
1704 
1705  /* Call the command parser */
1706  ret = ATCmdNetapp_setParse((char *)arg, &params);
1707 
1708  if (ret < 0)
1709  {
1710  ATCmd_errorResult(ATCmd_errorParseStr,ret);
1711  ATCmdNetapp_setFree(&params);
1712  return -1;
1713  }
1714 
1715  /* set netapp option */
1716  ret = sl_NetAppSet(params.id,params.option,params.len,params.value);
1717 
1718  if (ret < 0)
1719  {
1720  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
1721  }
1722  else
1723  {
1724  ATCmd_okResult();
1725  }
1726 
1727  ATCmdNetapp_setFree(&params);
1728  return ret;
1729 }

§ ATCmdNetapp_startCallback()

int32_t ATCmdNetapp_startCallback ( void *  arg)

Netapp start callback.

This routine starts a network application

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp start callback.

This routine starts a network application

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 162 of file atcmd_netapp.c.

163 {
164  int32_t ret = 0;
165  uint32_t appBitMap;
166 
167  appBitMap = 0x0;
168 
169  /* Call the command parser */
170  if ((ret = StrMpl_getBitmaskListVal(ATCmd_netappType, sizeof(ATCmd_netappType)/sizeof(StrMpl_List_t), (char **)&arg, &appBitMap, ATCMD_DELIM_TRM,ATCMD_DELIM_BIT, ATCmd_excludeDelimArray, STRMPL_FLAG_PARAM_SIZE_32 )) < 0)
171  {
172  ATCmd_errorResult(ATCmd_errorParseStr,ret);
173  return -1;
174  }
175 
176  /* app ID should exclude the SL_NETAPP_DEVICE_ID and SL_NETAPP_DNS_CLIENT_ID */
177  if (appBitMap > 0x0F)
178  {
179  ATCmd_errorResult(ATCmd_errorParseStr,0);
180  return -1;
181  }
182  /* start netapp */
183  ret = sl_NetAppStart(appBitMap);
184 
185  if (ret < 0)
186  {
187  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
188  }
189  else
190  {
191  ATCmd_okResult();
192  }
193 
194  return ret;
195 }

§ ATCmdNetapp_stopCallback()

int32_t ATCmdNetapp_stopCallback ( void *  arg)

Netapp stop callback.

This routine stops a network application

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp stop callback.

This routine stops a network application

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 208 of file atcmd_netapp.c.

209 {
210  int32_t ret = 0;
211  uint32_t appBitMap;
212 
213  appBitMap = 0x0;
214 
215  /* Call the command parser */
216  if ((ret = StrMpl_getBitmaskListVal(ATCmd_netappType, sizeof(ATCmd_netappType)/sizeof(StrMpl_List_t), (char **)&arg, &appBitMap, ATCMD_DELIM_TRM,ATCMD_DELIM_BIT, ATCmd_excludeDelimArray, STRMPL_FLAG_PARAM_SIZE_32 )) < 0)
217  {
218  ATCmd_errorResult(ATCmd_errorParseStr,ret);
219  return -1;
220  }
221  /* app ID should exclude the SL_NETAPP_DEVICE_ID and SL_NETAPP_DNS_CLIENT_ID */
222  if (appBitMap > 0x0F)
223  {
224  ATCmd_errorResult(ATCmd_errorParseStr,0);
225  return -1;
226  }
227 
228  /* stop netapp */
229  ret = sl_NetAppStop(appBitMap);
230 
231  if (ret < 0)
232  {
233  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
234  }
235  else
236  {
237  ATCmd_okResult();
238  }
239 
240  return ret;
241 }

§ ATCmdNetapp_unregisterServiceCallback()

int32_t ATCmdNetapp_unregisterServiceCallback ( void *  arg)

Netapp UnregisterMDNS callback.

This routine unregister a mDNS service

Parameters
arg- Points to command line buffer.
Returns
Zero on success, or negative error code on failure

Netapp UnregisterMDNS callback.

This routine unregister a mDNS service

Parameters
arg- Points to command line buffer.
Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return an error;

Definition at line 1374 of file atcmd_netapp.c.

1375 {
1376  int32_t ret = 0;
1377  ATCmdNetapp_UnregisterService_t params;
1378 
1379  memset(&params, 0x0, sizeof(ATCmdNetapp_UnregisterService_t));
1380 
1381  /* Call the command parser */
1382  ret = ATCmdNetapp_unregisterServiceParse((char *)arg, &params);
1383 
1384  if (ret < 0)
1385  {
1386  ATCmd_errorResult(ATCmd_errorParseStr,ret);
1387  ATCmdNetapp_unregisterServiceFree(&params);
1388  return -1;
1389  }
1390 
1391  /* netapp MDNSUnRegisterService */
1392  ret = sl_NetAppMDNSUnRegisterService(params.serviceName, params.serviceNameLen, params.options);
1393 
1394  if (ret < 0)
1395  {
1396  ATCmd_errorResult(ATCmd_errorCmdStr,ret);
1397  }
1398  else
1399  {
1400  ATCmd_okResult();
1401  }
1402  ATCmdNetapp_unregisterServiceFree(&params);
1403 
1404  return ret;
1405 }