| 1029 | } |
| 1030 | |
| 1031 | int 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 | |
| 1065 | int sal_socket(int domain, int type, int protocol) |
| 1066 | { |
no outgoing calls
no test coverage detected