Controls standard client/server sockets programming options and capabilities.
More...
Controls standard client/server sockets programming options and capabilities.
§ ATCmdSock_acceptCallback()
int32_t ATCmdSock_acceptCallback |
( |
void * |
arg | ) |
|
Sock Accept callback.
This routine Accept a connection on a socket.
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine Accept a connection on a socket.
- 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 406 of file atcmd_socket.c.
409 ATCmdSock_Accept_t *params;
411 params = malloc(
sizeof(ATCmdSock_Accept_t));
415 ATCmd_errorResult(ATCmd_errorAllocStr,0);
418 memset(params, 0x0,
sizeof(ATCmdSock_Accept_t));
421 ret = ATCmdSock_acceptParse((
char *)arg, params);
425 ATCmd_errorResult(ATCmd_errorParseStr,ret);
426 ATCmdSock_acceptFree(params);
434 params->ret.sd = sl_Accept(params->sd,¶ms->ret.addr,¶ms->ret.addrlen);
436 if (params->ret.sd < 0)
438 ATCmd_errorResult(ATCmd_errorCmdStr,params->ret.sd);
439 ATCmdSock_acceptFree(params);
443 ATCmd_commandResult(ATCmdSock_acceptResult,params,0);
§ ATCmdSock_bindCallback()
int32_t ATCmdSock_bindCallback |
( |
void * |
arg | ) |
|
Sock Bind callback.
This routine assign a name to a socket.
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine assign a name to a socket.
- 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 537 of file atcmd_socket.c.
542 memset(¶ms, 0x0,
sizeof(ATCmdSock_t));
545 ret = ATCmdSock_parse((
char **)&arg, ¶ms,ATCMD_DELIM_TRM);
549 ATCmd_errorResult(ATCmd_errorParseStr,ret);
554 ret = sl_Bind(params.sd,¶ms.addr,params.addrlen);
558 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
§ ATCmdSock_closeCallback()
int32_t ATCmdSock_closeCallback |
( |
void * |
arg | ) |
|
Sock Close callback.
This routine close socket.
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine close socket.
- 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 257 of file atcmd_socket.c.
263 if ((ret = StrMpl_getVal((
char **)&arg, (
void *)&sock, ATCMD_DELIM_TRM,STRMPL_FLAG_PARAM_SIZE_16 )) < 0)
265 ATCmd_errorResult(ATCmd_errorParseStr,ret);
270 ret = sl_Close(sock);
274 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
278 ATCmd_commandResult(ATCmdSock_closeResult,NULL,sock);
§ ATCmdSock_connectCallback()
int32_t ATCmdSock_connectCallback |
( |
void * |
arg | ) |
|
Sock Connect callback.
This routine initiate a connection on a socket.
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine initiate a connection on a socket.
- 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 714 of file atcmd_socket.c.
719 params = malloc(
sizeof(ATCmdSock_t));
723 ATCmd_errorResult(ATCmd_errorAllocStr,0);
726 memset(params, 0x0,
sizeof(ATCmdSock_t));
729 ret = ATCmdSock_parse((
char **)&arg, params,ATCMD_DELIM_TRM);
733 ATCmd_errorResult(ATCmd_errorParseStr,ret);
734 ATCmdSock_connectFree(params);
742 ret = sl_Connect(params->sd,¶ms->addr,params->addrlen);
746 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
747 ATCmdSock_connectFree(params);
751 ATCmd_commandResult(ATCmdSock_connectResult,params,0);
§ ATCmdSock_getSockOptCallback()
int32_t ATCmdSock_getSockOptCallback |
( |
void * |
arg | ) |
|
Sock GetSockOpt callback.
This routine get socket options
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine get socket options
- 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 1402 of file atcmd_socket.c.
1405 ATCmdSock_SetSockOpt_t *params;
1407 params = malloc(
sizeof(ATCmdSock_SetSockOpt_t));
1411 ATCmd_errorResult(ATCmd_errorAllocStr,0);
1414 memset(params, 0x0,
sizeof(ATCmdSock_SetSockOpt_t));
1417 ret = ATCmdSock_getSockOptParse((
char *)arg, params);
1421 ATCmd_errorResult(ATCmd_errorParseStr,ret);
1422 ATCmdSock_getSockOptFree(params);
1427 ret = sl_GetSockOpt(params->sd,params->level,params->optname,params->optval,¶ms->optlen);
1431 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
1432 ATCmdSock_getSockOptFree(params);
1436 ATCmd_commandResult(ATCmdSock_getSockOptResult,params,0);
§ ATCmdSock_listenCallback()
int32_t ATCmdSock_listenCallback |
( |
void * |
arg | ) |
|
Sock Listen callback.
This routine Listen for connections on a socket.
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine Listen for connections on a socket.
- 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 609 of file atcmd_socket.c.
612 ATCmdSock_Listen_t params;
614 memset(¶ms, 0x0,
sizeof(ATCmdSock_Listen_t));
617 ret = ATCmdSock_listenParse((
char *)arg, ¶ms);
621 ATCmd_errorResult(ATCmd_errorParseStr,ret);
626 ret = sl_Listen(params.sd,params.backlog);
630 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
§ ATCmdSock_recvCallback()
int32_t ATCmdSock_recvCallback |
( |
void * |
arg | ) |
|
Sock Recv callback.
This routine This routine read data from TCP socket
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine This routine read data from TCP socket
- 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 1684 of file atcmd_socket.c.
1687 ATCmdSock_tcp_t *params;
1689 params = malloc(
sizeof(ATCmdSock_tcp_t));
1693 ATCmd_errorResult(ATCmd_errorAllocStr,0);
1697 memset(params, 0x0,
sizeof(ATCmdSock_tcp_t));
1700 ret = ATCmdSock_recvParse((
char *)arg, params);
1704 ATCmd_errorResult(ATCmd_errorParseStr,ret);
1705 ATCmdSock_recvFree(params);
1713 params->len = sl_Recv(params->sd, params->data, params->len, params->flags);
1715 if (params->len < 0)
1717 ATCmd_errorResult(ATCmd_errorCmdStr,params->len);
1718 ATCmdSock_recvFree(params);
1722 ATCmd_commandResult(ATCmdSock_recvResult,params,0);
§ ATCmdSock_recvFromCallback()
int32_t ATCmdSock_recvFromCallback |
( |
void * |
arg | ) |
|
Sock RecvFrom callback.
This routine read data from socket
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine read data from socket
- 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 1972 of file atcmd_socket.c.
1975 ATCmdSock_udp_t *params;
1977 params = malloc(
sizeof(ATCmdSock_udp_t));
1981 ATCmd_errorResult(ATCmd_errorAllocStr,0);
1985 memset(params, 0x0,
sizeof(ATCmdSock_udp_t));
1988 ret = ATCmdSock_recvFromParse((
char *)arg, params);
1992 ATCmd_errorResult(ATCmd_errorParseStr,ret);
1993 ATCmdSock_recvFromFree(params);
2001 params->len = sl_RecvFrom(params->target.sd, params->data, params->len, params->flags,¶ms->target.addr,¶ms->target.addrlen);
2003 if (params->len < 0)
2005 ATCmd_errorResult(ATCmd_errorCmdStr,params->len);
2006 ATCmdSock_recvFromFree(params);
2010 ATCmd_commandResult(ATCmdSock_recvFromResult,params,0);
§ ATCmdSock_selectCallback()
int32_t ATCmdSock_selectCallback |
( |
void * |
arg | ) |
|
Sock Select callback.
This routine monitor socket activity.
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine monitor socket activity.
- 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 848 of file atcmd_socket.c.
851 ATCmdSock_Select_t *params;
853 params = malloc(
sizeof(ATCmdSock_Select_t));
857 ATCmd_errorResult(ATCmd_errorAllocStr,0);
860 memset(params, 0x0,
sizeof(ATCmdSock_Select_t));
863 ret = ATCmdSock_selectParse((
char *)arg, params);
867 ATCmd_errorResult(ATCmd_errorParseStr,ret);
868 ATCmdSock_selectFree(params);
877 ret = sl_Select(params->nfds,¶ms->readsds,NULL,NULL,¶ms->timeout);
881 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
882 ATCmdSock_selectFree(params);
886 ATCmd_commandResult(ATCmdSock_selectResult,params,0);
§ ATCmdSock_sendCallback()
int32_t ATCmdSock_sendCallback |
( |
void * |
arg | ) |
|
Sock Send callback.
This routine write data to TCP socket
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine write data to TCP socket
- 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 1534 of file atcmd_socket.c.
1537 ATCmdSock_tcp_t params;
1539 memset(¶ms, 0x0,
sizeof(ATCmdSock_tcp_t));
1542 ret = ATCmdSock_sendParse((
char *)arg, ¶ms);
1546 ATCmd_errorResult(ATCmd_errorParseStr,ret);
1547 ATCmdSock_sendFree(¶ms);
1552 ret = sl_Send(params.sd, params.data, params.len, params.flags);
1556 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
1563 ATCmdSock_sendFree(¶ms);
§ ATCmdSock_sendToCallback()
int32_t ATCmdSock_sendToCallback |
( |
void * |
arg | ) |
|
Sock SendTo callback.
This routine write data to socket
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine write data to socket
- 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 1820 of file atcmd_socket.c.
1823 ATCmdSock_udp_t params;
1825 memset(¶ms, 0x0,
sizeof(ATCmdSock_udp_t));
1828 ret = ATCmdSock_sendToParse((
char *)arg, ¶ms);
1832 ATCmd_errorResult(ATCmd_errorParseStr,ret);
1833 ATCmdSock_sendToFree(¶ms);
1838 ret = sl_SendTo(params.target.sd, params.data, params.len, params.flags,¶ms.target.addr,params.target.addrlen);
1842 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
1849 ATCmdSock_sendToFree(¶ms);
§ ATCmdSock_setSockOptCallback()
int32_t ATCmdSock_setSockOptCallback |
( |
void * |
arg | ) |
|
Sock SetSockOpt callback.
This routine Set socket options
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine Set socket options
- 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 1144 of file atcmd_socket.c.
1147 ATCmdSock_SetSockOpt_t params;
1149 memset(¶ms, 0x0,
sizeof(ATCmdSock_SetSockOpt_t));
1152 ret = ATCmdSock_setSockOptParse((
char *)arg, ¶ms);
1156 ATCmd_errorResult(ATCmd_errorParseStr,ret);
1157 ATCmdSock_setSockOptFree(¶ms);
1162 ret = sl_SetSockOpt(params.sd,params.level,params.optname,(
const void *)params.optval,params.optlen);
1166 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
1173 ATCmdSock_setSockOptFree(¶ms);
§ ATCmdSock_socketCallback()
int32_t ATCmdSock_socketCallback |
( |
void * |
arg | ) |
|
Sock Socket callback.
This routine create socket.
- Parameters
-
arg | - Points to command line buffer. |
- Returns
- Zero on success, or negative error code on failure
This routine create socket.
- 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 193 of file atcmd_socket.c.
196 ATCmdSock_Socket_t sockParams;
198 memset(&sockParams, 0x0,
sizeof(ATCmdSock_Socket_t));
201 ret = ATCmdSock_socketParse((
char *)arg,&sockParams);
205 ATCmd_errorResult(ATCmd_errorParseStr,ret);
210 ret = sl_Socket(sockParams.domain, sockParams.type, sockParams.protocol);
214 ATCmd_errorResult(ATCmd_errorCmdStr,ret);
218 ATCmd_commandResult(ATCmdSock_socketResult,NULL,ret);