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

Function sal_recvfrom

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

Source from the content-addressed store, hash-verified

995}
996
997int sal_recvfrom(int socket, void *mem, size_t len, int flags,
998 struct sockaddr *from, socklen_t *fromlen)
999{
1000 struct sal_socket *sock;
1001 struct sal_proto_family *pf;
1002
1003 /* get the socket object by socket descriptor */
1004 SAL_SOCKET_OBJ_GET(sock, socket);
1005
1006 /* check the network interface is up status */
1007 SAL_NETDEV_IS_UP(sock->netdev);
1008 /* check the network interface socket opreation */
1009 SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, recvfrom);
1010
1011#ifdef SAL_USING_TLS
1012 if (SAL_SOCKOPS_PROTO_TLS_VALID(sock, recv))
1013 {
1014 int ret;
1015
1016 if ((ret = proto_tls->ops->recv(sock->user_data_tls, mem, len)) < 0)
1017 {
1018 return -1;
1019 }
1020 return ret;
1021 }
1022 else
1023 {
1024 return pf->skt_ops->recvfrom((int)(size_t)sock->user_data, mem, len, flags, from, fromlen);
1025 }
1026#else
1027 return pf->skt_ops->recvfrom((int)(size_t)sock->user_data, mem, len, flags, from, fromlen);
1028#endif
1029}
1030
1031int sal_sendto(int socket, const void *dataptr, size_t size, int flags,
1032 const struct sockaddr *to, socklen_t tolen)

Callers 5

dfs_net_readFunction · 0.85
recvFunction · 0.85
recvfromFunction · 0.85
TC_sal_socket_send_recvFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected