Platforms: Split out TCP and UDP socket functions on a platform basis

Currently supported types

Posix
LwIP
Contiki
RIOT

Zephyr and Windows are treated as Posix.

UDP
src/coap_dgrm_contiki.c      Datagram r/w/c functions from src/coap_io_contiki.c
src/coap_dgrm_lwip.c         Datagram r/w/c functions from src/coap_io_lwip.c
src/coap_dgrm_posix.c        Datagram r/w/c functions from src/coap_io.c
src/coap_dgrm_riot.c         Datagram r/w/c functions from src/coap_io_riot.c

TCP
src/coap_strm_contiki.c      Stub TCP entries
src/coap_strm_lwip.c         Stream r/w/c functions from src/coap_io_lwip.c
src/coap_strm_posix.c        Was src/coap_tcp.c with stream r/w/c functions from src/coap_io.c
src/coap_strm_riot.c         Stream r/w/c functions from src/coap_io_riot.c

I/O specific
src/coap_io_contiki.c        Datagram / Stream functions removed
src/coap_io_lwip.c           Datagram / Stream functions removed
src/coap_io_posix.c          Abstracted from src/coap_io.c
src/coap_io_riot.c           Datagram / Stream functions removed

Remaining common I/O functions
src/coap_io.c                With separated out code removed
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2025-09-22 10:27:14 +01:00
1 parent c12193fdef
commit ea6a3c6f53
26 files changed
+3453 -3108

No files matched your search

+4 -3
View File
@@ -113,14 +113,15 @@ ssize_t coap_socket_send(coap_socket_t *sock, coap_session_t *session,
*/
ssize_t coap_socket_recv(coap_socket_t *sock, coap_packet_t *packet);
/**
* Function interface to close off a socket (for both TCP and UDP).
* Function interface to close off a datagram socket.
*
* Internal function.
*
* @param sock Socket to close.
*
*/
void coap_socket_close(coap_socket_t *sock);
void coap_socket_dgrm_close(coap_socket_t *sock);
/** @} */
+4
View File
@@ -97,6 +97,10 @@ void coap_mfree_endpoint(coap_endpoint_t *ep);
const char *coap_socket_format_errno(int error);
#ifdef _WIN32
void coap_win_error_to_errno(void);
#endif /* _WIN32 */
/**
* Epoll specific function to add the state of events that epoll is to track
* for the appropriate file descriptor.
+10 -3
View File
@@ -116,6 +116,13 @@ ssize_t coap_netif_dgrm_read_ep(coap_endpoint_t *endpoint,
ssize_t coap_netif_dgrm_write(coap_session_t *session, const uint8_t *data,
size_t datalen);
/**
* Layer function interface for netif datagram close for a session.
*
* @param session Session to do the netif datagram close on.
*/
void coap_netif_dgrm_close(coap_session_t *session);
/**
* Layer function interface for Netif stream listem (tcp).
*
@@ -195,11 +202,11 @@ ssize_t coap_netif_strm_write(coap_session_t *session,
const uint8_t *data, size_t datalen);
/**
* Layer function interface for Netif close for a session.
* Layer function interface for netif stream close for a session.
*
* @param session Session to do the netif close on.
* @param session Session to do the netif stream close on.
*/
void coap_netif_close(coap_session_t *session);
void coap_netif_strm_close(coap_session_t *session);
/**
* Layer function interface for Netif close for a endpoint.
+10
View File
@@ -131,6 +131,16 @@ ssize_t coap_socket_write(coap_socket_t *sock, const uint8_t *data, size_t data_
*/
ssize_t coap_socket_read(coap_socket_t *sock, uint8_t *data, size_t data_len);
/**
* Function interface to close off a stream socket.
*
* Internal function.
*
* @param sock Socket to close.
*
*/
void coap_socket_strm_close(coap_socket_t *sock);
#endif /* !COAP_DISABLE_TCP */
/** @} */