MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sal_sendto

Function sal_sendto

components/net/sal/src/sal_socket.c:1031–1063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1029}
1030
1031int sal_sendto(int socket, const void *dataptr, size_t size, int flags,
1032 const struct sockaddr *to, socklen_t tolen)
1033{
1034 struct sal_socket *sock;
1035 struct sal_proto_family *pf;
1036
1037 /* get the socket object by socket descriptor */
1038 SAL_SOCKET_OBJ_GET(sock, socket);
1039
1040 /* check the network interface is up status */
1041 SAL_NETDEV_IS_UP(sock->netdev);
1042 /* check the network interface socket opreation */
1043 SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, sendto);
1044
1045#ifdef SAL_USING_TLS
1046 if (SAL_SOCKOPS_PROTO_TLS_VALID(sock, send))
1047 {
1048 int ret;
1049
1050 if ((ret = proto_tls->ops->send(sock->user_data_tls, dataptr, size)) < 0)
1051 {
1052 return -1;
1053 }
1054 return ret;
1055 }
1056 else
1057 {
1058 return pf->skt_ops->sendto((int)sock->user_data, dataptr, size, flags, to, tolen);
1059 }
1060#else
1061 return pf->skt_ops->sendto((int)(size_t)sock->user_data, dataptr, size, flags, to, tolen);
1062#endif
1063}
1064
1065int sal_socket(int domain, int type, int protocol)
1066{

Callers 5

dfs_net_writeFunction · 0.85
sendFunction · 0.85
sendtoFunction · 0.85
TC_sal_socket_send_recvFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected