[riot-notifications] [RIOT-OS/RIOT] gnrc_sock_tcp: add gnrc sock tcp (#16494)

benpicco notifications at github.com
Fri Aug 6 16:33:30 CEST 2021


@benpicco commented on this pull request.



> +    return gnrc_tcp_get_local(tcb, local);
+}
+
+int sock_tcp_get_remote(sock_tcp_t *sock, sock_tcp_ep_t *ep)
+{
+    /* Asserts defined by API. */
+    assert(sock != NULL);
+    assert(ep != NULL);
+
+    /* Asserts to protect GNRC_TCP. */
+    assert(sizeof(sock_tcp_t) == sizeof(gnrc_tcp_tcb_t));
+    assert(sizeof(sock_tcp_ep_t) == sizeof(gnrc_tcp_ep_t));
+
+    /* NOTE: GNRC_TCP and GNRC_SOCK_TCP types must have the same memory representation. */
+    gnrc_tcp_tcb_t *tcb = (gnrc_tcp_tcb_t *) sock;
+    gnrc_tcp_ep_t *remote = (gnrc_tcp_ep_t *) ep;

`net/sock.h` lives in `sys/include`, so it can always be included - no `sock_tcp` module needed  

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16494#discussion_r684283202
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210806/591805fe/attachment.htm>


More information about the notifications mailing list