From 7ff37c9af3b56237ebc2d9809af33868ae089cc2 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 14 Dec 2025 18:13:03 -0600 Subject: [PATCH] Update: Ensure sockets defines for SOCKET_* and catch missing MSG_* defines. Add `MSG_*` defines that I missed in a previous commit. Add the `SOCKET_*` defines. --- level_0/f_socket/c/socket/common.h | 88 ++++++++++++++++++++++++++++++-------- 1 file changed, 71 insertions(+), 17 deletions(-) diff --git a/level_0/f_socket/c/socket/common.h b/level_0/f_socket/c/socket/common.h index f852df2..056f664 100644 --- a/level_0/f_socket/c/socket/common.h +++ b/level_0/f_socket/c/socket/common.h @@ -440,9 +440,9 @@ extern "C" { #define MSG_PEEK 0x02 #endif // MSG_PEEK - #ifndef MSG_TRYHARD - #define MSG_TRYHARD 0x04 - #endif // MSG_TRYHARD + #ifndef MSG_DONTROUTE + #define MSG_DONTROUTE 0x04 + #endif // MSG_DONTROUTE #ifndef MSG_CTRUNC #define MSG_CTRUNC 0x08 @@ -464,10 +464,18 @@ extern "C" { #define MSG_EOR 0x80 #endif // MSG_EOR + #ifndef MSG_WAITALL + #define MSG_WAITALL 0x100 + #endif // MSG_WAITALL + #ifndef MSG_FIN #define MSG_FIN 0x200 #endif // MSG_FIN + #ifndef MSG_SOCK_DEVMEM + #define MSG_SOCK_DEVMEM 0x2000000 + #endif // MSG_SOCK_DEVMEM + #ifndef MSG_SYN #define MSG_SYN 0x400 #endif // MSG_SYN @@ -484,6 +492,10 @@ extern "C" { #define MSG_ERRQUEUE 0x2000 #endif // MSG_ERRQUEUE + #ifndef MSG_NOSIGNAL + #define MSG_NOSIGNAL 0x4000 + #endif // MSG_NOSIGNAL + #ifndef MSG_MORE #define MSG_MORE 0x8000 #endif // MSG_MORE @@ -962,6 +974,44 @@ extern "C" { #ifndef SOL_VSOCK #define SOL_VSOCK 287 #endif // SOL_VSOCK + + + // The SOCKET_* defines. + #ifndef SOCK_STREAM + #define SOCK_STREAM 1 + #endif // SOCK_STREAM + + #ifndef SOCK_DGRAM + #define SOCK_DGRAM 2 + #endif // SOCK_DGRAM + + #ifndef SOCK_RAW + #define SOCK_RAW 3 + #endif // SOCK_RAW + + #ifndef SOCK_RDM + #define SOCK_RDM 4 + #endif // SOCK_RDM + + #ifndef SOCK_SEQPACKET + #define SOCK_SEQPACKET 5 + #endif // SOCK_SEQPACKET + + #ifndef SOCK_DCCP + #define SOCK_DCCP 6 + #endif // SOCK_DCCP + + #ifndef SOCK_PACKET + #define SOCK_PACKET 10 + #endif // SOCK_PACKET + + #ifndef SOCK_CLOEXEC + #define SOCK_CLOEXEC 02000000 + #endif // SOCK_CLOEXEC + + #ifndef SOCK_NONBLOCK + #define SOCK_NONBLOCK 00004000 + #endif // SOCK_NONBLOCK #endif // _di_f_socket_defines_d_ /** @@ -1742,23 +1792,27 @@ extern "C" { * Socket types. * * f_socket_type_*_e: - * - close_on_execute: Close on execute. - * - datagram: Datagram (connectionless, unreliable, fixed length). - * - datagram_reliable: Reliable Datagram (reliable variant of datagram, unordered) - * - datagram_sequence: Sequenced Datagram. - * - nonblocking: Non-blocking. - * - raw: Raw access. - * - stream: Stream. + * - close_on_execute: Close on execute. + * - datagram: Datagram (connectionless, unreliable, fixed length). + * - datagram_congestion: Datagram Congestion Control Protocol. + * - datagram_reliable: Reliable Datagram (reliable variant of datagram, unordered) + * - datagram_sequence: Sequenced Datagram. + * - nonblocking: Non-blocking. + * - packet: Socket Packet (linux-specific way to get packets at the device level). + * - raw: Raw access. + * - stream: Stream. */ #ifndef _di_f_socket_type_e_ enum { - f_socket_type_close_on_execute_e = SOCK_CLOEXEC, - f_socket_type_datagram_e = SOCK_DGRAM, - f_socket_type_datagram_reliable_e = SOCK_RDM, - f_socket_type_datagram_sequence_e = SOCK_SEQPACKET, - f_socket_type_nonblocking_e = SOCK_NONBLOCK, - f_socket_type_raw_e = SOCK_RAW, - f_socket_type_stream_e = SOCK_STREAM, + f_socket_type_close_on_execute_e = SOCK_CLOEXEC, + f_socket_type_datagram_e = SOCK_DGRAM, + f_socket_type_datagram_congestion_e = SOCK_DCCP, + f_socket_type_datagram_reliable_e = SOCK_RDM, + f_socket_type_datagram_sequence_e = SOCK_SEQPACKET, + f_socket_type_nonblocking_e = SOCK_NONBLOCK, + f_socket_type_packet_e = SOCK_PACKET, + f_socket_type_raw_e = SOCK_RAW, + f_socket_type_stream_e = SOCK_STREAM, }; // enum #endif // _di_f_socket_type_e_ -- 1.8.3.1