From: falcovorbis <fal...@us...> - 2023-11-18 16:13:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ed6c8f946d1ff8f59de05f02e8772b81298cae59 (commit) via 1f7aa3f098a59d730c2efaf521d6bc0bbfd6ff36 (commit) via 659799bf6e56a0c00da7fe2a0fadd774014a6842 (commit) via 55f0e708b11ca73e55fa251df621f0cb1470f24e (commit) from f75efb895335970db3a4019f08457b196c985ae1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ed6c8f946d1ff8f59de05f02e8772b81298cae59 Merge: f75efb8 1f7aa3f Author: Falco Girgis <gyr...@gm...> Date: Sat Nov 18 10:13:23 2023 -0600 Merge pull request #372 from KallistiOS/netinet-tcp-h Add <netinet/tcp.h> header commit 1f7aa3f098a59d730c2efaf521d6bc0bbfd6ff36 Author: Lawrence Sebald <ljs...@us...> Date: Sat Nov 18 11:12:13 2023 -0500 Update CHANGELOG commit 659799bf6e56a0c00da7fe2a0fadd774014a6842 Author: Lawrence Sebald <ljs...@us...> Date: Sat Nov 18 11:02:59 2023 -0500 Add TCP_NODELAY into setsockopt/getsockopt. Note that the option is effectively ignored as we do not implement Nagle's algorithm. commit 55f0e708b11ca73e55fa251df621f0cb1470f24e Author: Lawrence Sebald <ljs...@us...> Date: Sat Nov 18 11:02:29 2023 -0500 Add netinet/tcp.h file and update documentation to reflect it. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 4 +++- include/netinet/in.h | 4 ++++ include/netinet/tcp.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ kernel/net/net_tcp.c | 36 ++++++++++++++++++++++++++++-------- 4 files changed, 86 insertions(+), 9 deletions(-) create mode 100644 include/netinet/tcp.h diff --git a/doc/CHANGELOG b/doc/CHANGELOG index c90e2ba..6cfd0bb 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -192,7 +192,8 @@ KallistiOS version 2.1.0 ----------------------------------------------- - *** Added toolchain and KOS support for C/C++ compiler-level TLS [CP && FG] - DC Added vmu functions to check/enable/disable the extra 41 blocks [AB] - *** Added driver for the SH4's Watchdog Timer peripheral [FG] -- DC Added Moop powered fast path to sq_cpy, added TapamN pvr related sq functions [AB] +- DC Added Moop powered fast path to sq_cpy, added TapamN pvr related sq + functions [AB] - DC Garbage-collect network stack [PC] - DC Rework romdisks [PC] - DC Refactored g2bus API, converted magic values to macros, added @@ -203,6 +204,7 @@ KallistiOS version 2.1.0 ----------------------------------------------- - DC Optimized separating stereo PCM [RR] - DC Refactored sfx and streaming to add SQ fast path [RR] - DC Added 4/8-bit wav support to sfx and streaming [RR] +- *** Added <netinet/tcp.h> header file and required option [LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Megan Potter == MP] diff --git a/include/netinet/in.h b/include/netinet/in.h index f7d12e4..1ddd45b 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -197,6 +197,7 @@ extern const struct in6_addr in6addr_loopback; \see ipv6_opts \see udp_opts \see udplite_opts + \see tcp_opts @{ */ @@ -215,6 +216,7 @@ extern const struct in6_addr in6addr_loopback; \see ipv4_opts \see udp_opts \see udplite_opts + \see tcp_opts @{ */ @@ -236,6 +238,7 @@ extern const struct in6_addr in6addr_loopback; \see ipv4_opts \see ipv6_opts \see udplite_opts + \see tcp_opts @{ */ @@ -251,6 +254,7 @@ extern const struct in6_addr in6addr_loopback; \see ipv4_opts \see ipv6_opts \see udp_opts + \see tcp_opts @{ */ diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h new file mode 100644 index 0000000..7c74be2 --- /dev/null +++ b/include/netinet/tcp.h @@ -0,0 +1,51 @@ +/* KallistiOS ##version## + + netinet/tcp.h + Copyright (C) 2023 Lawrence Sebald + +*/ + +/** \file netinet/tcp.h + \brief Definitions for the Transmission Control Protocol. + + This file contains the standard definitions (as directed by the Open Group + Base Specifications Issue 7, 2018 Edition aka POSIX 2017) for functionality + of the Transmission Control Protocol. + This does is not guaranteed to have everything that one might have in a + fully-standard compliant implementation of the POSIX standard. + + \author Lawrence Sebald +*/ + +#ifndef __NETINET_TCP_H +#define __NETINET_TCP_H + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +/** \defgroup tcp_opts TCP protocol level options + + These are the various socket-level optoins that can be accessed with the + setsockopt() and getsockopt() fnctions for the IPPROTO_TCP level value. + + All options listed here are at least guaranteed to be accepted by + setsockopt() and getsockopt() for IPPROTO_TCP, however they are not + guaranteed to be implemented in any meaningful way. + + \see so_opts + \see ipv4_opts + \see ipv6_opts + \see udp_opts + \see udplite_opts + + @{ +*/ + +#define TCP_NODELAY 1 /**< \brief Don't delay to coalesce. */ + +/** @} */ + +__END_DECLS + +#endif /* !__NETINET_TCP_H */ diff --git a/kernel/net/net_tcp.c b/kernel/net/net_tcp.c index 4250b2d..6991a6e 100644 --- a/kernel/net/net_tcp.c +++ b/kernel/net/net_tcp.c @@ -11,6 +11,7 @@ #include <stdint.h> #include <poll.h> #include <sys/socket.h> +#include <netinet/tcp.h> #include <kos/fs.h> #include <kos/net.h> @@ -1708,7 +1709,6 @@ static int net_tcp_getsockopt(net_socket_t *hnd, int level, int option_name, break; case IPPROTO_IP: - if(sock->domain != AF_INET) goto ret_inval; @@ -1721,7 +1721,6 @@ static int net_tcp_getsockopt(net_socket_t *hnd, int level, int option_name, break; case IPPROTO_IPV6: - if(sock->domain != AF_INET6) goto ret_inval; @@ -1734,6 +1733,17 @@ static int net_tcp_getsockopt(net_socket_t *hnd, int level, int option_name, tmp = !!(sock->flags & FS_SOCKET_V6ONLY); goto copy_int; } + + break; + + case IPPROTO_TCP: + switch(option_name) { + case TCP_NODELAY: + tmp = 1; + goto copy_int; + } + + break; } /* If it wasn't handled, return that error. */ @@ -1803,7 +1813,6 @@ static int net_tcp_setsockopt(net_socket_t *hnd, int level, int option_name, switch(level) { case SOL_SOCKET: - switch(option_name) { case SO_ACCEPTCONN: case SO_ERROR: @@ -1853,13 +1862,11 @@ static int net_tcp_setsockopt(net_socket_t *hnd, int level, int option_name, break; case IPPROTO_IP: - if(sock->domain != AF_INET) goto ret_inval; switch(option_name) { case IP_TTL: - if(option_len != sizeof(int)) goto ret_inval; @@ -1878,13 +1885,11 @@ static int net_tcp_setsockopt(net_socket_t *hnd, int level, int option_name, break; case IPPROTO_IPV6: - if(sock->domain != AF_INET6) goto ret_inval; switch(option_name) { case IPV6_UNICAST_HOPS: - if(option_len != sizeof(int)) goto ret_inval; @@ -1900,7 +1905,6 @@ static int net_tcp_setsockopt(net_socket_t *hnd, int level, int option_name, goto ret_success; case IPV6_V6ONLY: - if(option_len != sizeof(int)) goto ret_inval; @@ -1914,6 +1918,22 @@ static int net_tcp_setsockopt(net_socket_t *hnd, int level, int option_name, goto ret_success; } + break; + + case IPPROTO_TCP: + switch(option_name) { + case TCP_NODELAY: + if(option_len != sizeof(int)) + goto ret_inval; + + tmp = *((int *)option_value); + + if(tmp == 0) + goto ret_inval; + + goto ret_success; + } + break; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |