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

Function sal_get_socket

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

* This function will get sal socket object by sal socket descriptor. * * @param socket sal socket index * * @return sal socket object of the current sal socket index */

Source from the content-addressed store, hash-verified

365 * @return sal socket object of the current sal socket index
366 */
367struct sal_socket *sal_get_socket(int socket)
368{
369 struct sal_socket_table *st = &socket_table;
370
371 socket = socket - SAL_SOCKET_OFFSET;
372
373 if (socket < 0 || socket >= (int)st->max_socket)
374 {
375 return RT_NULL;
376 }
377
378 /* check socket structure valid or not */
379 RT_ASSERT(st->sockets[socket]->magic == SAL_SOCKET_MAGIC);
380
381 return st->sockets[socket];
382}
383
384/**
385 * This function will lock sal socket.

Callers 8

socket_deleteFunction · 0.85
sal_acceptFunction · 0.85
sal_socketFunction · 0.85
at_pollFunction · 0.85
mbedtls_net_send_cbFunction · 0.85
mbedtls_net_recv_cbFunction · 0.85
mbedtls_closesocketFunction · 0.85
inet_pollFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected