| author | |
| committer | |
| log | e1c0f13ae54ced1505abb1934e3ae7e0f8d118a2 |
| tree | 0ad46d9e20774e765bb2eadebe9a299ea6a76c3b |
| parent | e78ea8f2cb3677c0a104319b8aa5e37ea64d9cfa |
Primary motivation was the lack of TCP.NODELAY on multiple targets
that should have it.
Note that FreeBSD has a much larger set of defines in the "TCP_"
namespace than what I've pasted here, including a bunch of
non-option constants and extremely platform-specific features. I
stuck to just the simpler and more traditional options only for
now. The rest could be added later, and may need some thought as
how to best represent them.7 files changed, 122 insertions(+), 0 deletions(-)
lib/std/c.zig+6| ... | @@ -5997,8 +5997,14 @@ pub const SOCK = switch (native_os) { | ... | @@ -5997,8 +5997,14 @@ pub const SOCK = switch (native_os) { |
| 5997 | pub const TCP = switch (native_os) { | 5997 | pub const TCP = switch (native_os) { |
| 5998 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.TCP, | 5998 | .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos => darwin.TCP, |
| 5999 | .linux => linux.TCP, | 5999 | .linux => linux.TCP, |
| 6000 | .freebsd => freebsd.TCP, | ||
| 6001 | .netbsd => netbsd.TCP, | ||
| 6002 | .openbsd => openbsd.TCP, | ||
| 6003 | .dragonfly => dragonfly.TCP, | ||
| 6000 | .emscripten => emscripten.TCP, | 6004 | .emscripten => emscripten.TCP, |
| 6001 | .windows => ws2_32.TCP, | 6005 | .windows => ws2_32.TCP, |
| 6006 | .illumos => illumos.TCP, | ||
| 6007 | .haiku => haiku.TCP, | ||
| 6002 | // https://github.com/SerenityOS/serenity/blob/61ac554a3403838f79ca746bd1c65ded6f97d124/Kernel/API/POSIX/netinet/tcp.h#L13-L14 | 6008 | // https://github.com/SerenityOS/serenity/blob/61ac554a3403838f79ca746bd1c65ded6f97d124/Kernel/API/POSIX/netinet/tcp.h#L13-L14 |
| 6003 | .serenity => struct { | 6009 | .serenity => struct { |
| 6004 | pub const NODELAY = 10; | 6010 | pub const NODELAY = 10; |
lib/std/c/dragonfly.zig+14| ... | @@ -302,3 +302,17 @@ pub const IPTOS = struct { | ... | @@ -302,3 +302,17 @@ pub const IPTOS = struct { |
| 302 | pub const ECN_CE = 0x03; | 302 | pub const ECN_CE = 0x03; |
| 303 | pub const ECN_MASK = 0x03; | 303 | pub const ECN_MASK = 0x03; |
| 304 | }; | 304 | }; |
| 305 | |||
| 306 | // https://github.com/DragonFlyBSD/DragonFlyBSD/blob/8410ea0817ce17438e0a10fc4ba6c9697281048a/sys/netinet/tcp.h#L156 | ||
| 307 | pub const TCP = struct { | ||
| 308 | pub const NODELAY = 0x01; | ||
| 309 | pub const MAXSEG = 0x02; | ||
| 310 | pub const NOPUSH = 0x04; | ||
| 311 | pub const NOOPT = 0x08; | ||
| 312 | pub const SIGNATURE_ENABLE = 0x10; | ||
| 313 | pub const KEEPINIT = 0x20; | ||
| 314 | pub const FASTKEEP = 0x80; | ||
| 315 | pub const KEEPIDLE = 0x100; | ||
| 316 | pub const KEEPINTVL = 0x200; | ||
| 317 | pub const KEEPCNT = 0x400; | ||
| 318 | }; |
lib/std/c/freebsd.zig+43| ... | @@ -586,3 +586,46 @@ pub const IPTOS = struct { | ... | @@ -586,3 +586,46 @@ pub const IPTOS = struct { |
| 586 | pub const ECN_CE = 0x03; | 586 | pub const ECN_CE = 0x03; |
| 587 | pub const ECN_MASK = 0x03; | 587 | pub const ECN_MASK = 0x03; |
| 588 | }; | 588 | }; |
| 589 | |||
| 590 | // https://cgit.freebsd.org/src/tree/sys/netinet/tcp.h?id=52c0d52b91e34f9190c9ba8fab7b6bc463bc4cbb#n183 | ||
| 591 | pub const TCP = struct { | ||
| 592 | pub const NODELAY = 1; | ||
| 593 | pub const MAXSEG = 2; | ||
| 594 | pub const NOPUSH = 4; | ||
| 595 | pub const NOOPT = 8; | ||
| 596 | pub const MD5SIG = 16; | ||
| 597 | pub const INFO = 32; | ||
| 598 | pub const STATS = 33; | ||
| 599 | pub const LOG = 34; | ||
| 600 | pub const LOGBUF = 35; | ||
| 601 | pub const LOGID = 36; | ||
| 602 | pub const LOGDUMP = 37; | ||
| 603 | pub const LOGDUMPID = 38; | ||
| 604 | pub const TXTLS_ENABLE = 39; | ||
| 605 | pub const TXTLS_MODE = 40; | ||
| 606 | pub const RXTLS_ENABLE = 41; | ||
| 607 | pub const RXTLS_MODE = 42; | ||
| 608 | pub const IWND_NB = 43; | ||
| 609 | pub const IWND_NSEG = 44; | ||
| 610 | pub const USE_DDP = 45; | ||
| 611 | pub const LOGID_CNT = 46; | ||
| 612 | pub const LOG_TAG = 47; | ||
| 613 | pub const USER_LOG = 48; | ||
| 614 | pub const CONGESTION = 64; | ||
| 615 | pub const CCALGOOPT = 65; | ||
| 616 | pub const MAXUNACKTIME = 68; | ||
| 617 | pub const IDLE_REDUCE = 70; | ||
| 618 | pub const REMOTE_UDP_ENCAPS_PORT = 71; | ||
| 619 | pub const DELACK = 72; | ||
| 620 | pub const FIN_IS_RST = 73; | ||
| 621 | pub const LOG_LIMIT = 74; | ||
| 622 | pub const SHARED_CWND_ALLOWED = 75; | ||
| 623 | pub const PROC_ACCOUNTING = 76; | ||
| 624 | pub const USE_CMP_ACKS = 77; | ||
| 625 | pub const PERF_INFO = 78; | ||
| 626 | pub const KEEPINIT = 128; | ||
| 627 | pub const KEEPIDLE = 256; | ||
| 628 | pub const KEEPINTVL = 512; | ||
| 629 | pub const KEEPCNT = 1024; | ||
| 630 | pub const FASTOPEN = 1025; | ||
| 631 | }; |
lib/std/c/haiku.zig+8| ... | @@ -289,3 +289,11 @@ pub const IPTOS = struct { | ... | @@ -289,3 +289,11 @@ pub const IPTOS = struct { |
| 289 | pub const THROUGHPUT = 0x08; | 289 | pub const THROUGHPUT = 0x08; |
| 290 | pub const LOWDELAY = 0x10; | 290 | pub const LOWDELAY = 0x10; |
| 291 | }; | 291 | }; |
| 292 | |||
| 293 | // https://github.com/haiku/haiku/blob/2ffb9aef511dde272ab57d545a5d8631705a5ec8/headers/posix/netinet/tcp.h#L74 | ||
| 294 | pub const TCP = struct { | ||
| 295 | pub const NODELAY = 0x01; | ||
| 296 | pub const MAXSEG = 0x02; | ||
| 297 | pub const NOPUSH = 0x04; | ||
| 298 | pub const NOOPT = 0x08; | ||
| 299 | }; |
lib/std/c/illumos.zig+28| ... | @@ -455,3 +455,31 @@ pub const IPTOS = struct { | ... | @@ -455,3 +455,31 @@ pub const IPTOS = struct { |
| 455 | pub const PREC_PRIORITY = 0x20; | 455 | pub const PREC_PRIORITY = 0x20; |
| 456 | pub const PREC_ROUTINE = 0x00; | 456 | pub const PREC_ROUTINE = 0x00; |
| 457 | }; | 457 | }; |
| 458 | |||
| 459 | // https://github.com/illumos/illumos-gate/blob/e1e6b944360d951edf36ef4198261818ed2d9b2f/usr/src/uts/common/netinet/tcp.h#L94 | ||
| 460 | pub const TCP = struct { | ||
| 461 | pub const NODELAY = 0x01; | ||
| 462 | pub const MAXSEG = 0x02; | ||
| 463 | pub const KEEPALIVE = 0x8; | ||
| 464 | pub const NOTIFY_THRESHOLD = 0x10; | ||
| 465 | pub const ABORT_THRESHOLD = 0x11; | ||
| 466 | pub const CONN_NOTIFY_THRESHOLD = 0x12; | ||
| 467 | pub const CONN_ABORT_THRESHOLD = 0x13; | ||
| 468 | pub const RECVDSTADDR = 0x14; | ||
| 469 | pub const INIT_CWND = 0x15; | ||
| 470 | pub const KEEPALIVE_THRESHOLD = 0x16; | ||
| 471 | pub const KEEPALIVE_ABORT_THRESHOLD = 0x17; | ||
| 472 | pub const CORK = 0x18; | ||
| 473 | pub const RTO_INITIAL = 0x19; | ||
| 474 | pub const RTO_MIN = 0x1A; | ||
| 475 | pub const RTO_MAX = 0x1B; | ||
| 476 | pub const LINGER2 = 0x1C; | ||
| 477 | pub const ANONPRIVBIND = 0x20; | ||
| 478 | pub const EXCLBIND = 0x21; | ||
| 479 | pub const KEEPIDLE = 0x22; | ||
| 480 | pub const KEEPCNT = 0x23; | ||
| 481 | pub const KEEPINTVL = 0x24; | ||
| 482 | pub const CONGESTION = 0x25; | ||
| 483 | pub const QUICKACK = 0x26; | ||
| 484 | pub const MD5SIG = 0x27; | ||
| 485 | }; |
lib/std/c/netbsd.zig+13| ... | @@ -373,3 +373,16 @@ pub const IPTOS = struct { | ... | @@ -373,3 +373,16 @@ pub const IPTOS = struct { |
| 373 | pub const PREC_PRIORITY = 0x20; | 373 | pub const PREC_PRIORITY = 0x20; |
| 374 | pub const PREC_ROUTINE = 0x00; | 374 | pub const PREC_ROUTINE = 0x00; |
| 375 | }; | 375 | }; |
| 376 | |||
| 377 | // https://github.com/NetBSD/src/blob/2579a44b3da9597de159e42cb1b5db0d382bd511/sys/netinet/tcp.h#L126 | ||
| 378 | pub const TCP = struct { | ||
| 379 | pub const NODELAY = 1; | ||
| 380 | pub const MAXSEG = 2; | ||
| 381 | pub const KEEPIDLE = 3; | ||
| 382 | pub const KEEPINTVL = 5; | ||
| 383 | pub const KEEPCNT = 6; | ||
| 384 | pub const KEEPINIT = 7; | ||
| 385 | pub const INFO = 9; | ||
| 386 | pub const MD5SIG = 0x10; | ||
| 387 | pub const CONGCTL = 0x20; | ||
| 388 | }; |
lib/std/c/openbsd.zig+10| ... | @@ -443,3 +443,13 @@ pub const IPTOS = struct { | ... | @@ -443,3 +443,13 @@ pub const IPTOS = struct { |
| 443 | pub const ECN_CE = 0x03; | 443 | pub const ECN_CE = 0x03; |
| 444 | pub const ECN_MASK = 0x03; | 444 | pub const ECN_MASK = 0x03; |
| 445 | }; | 445 | }; |
| 446 | |||
| 447 | // https://github.com/openbsd/src/blob/5761484065d1eed341f812f818ecf3f79138e7c6/sys/netinet/tcp.h#L215 | ||
| 448 | pub const TCP = struct { | ||
| 449 | pub const NODELAY = 0x01; | ||
| 450 | pub const MAXSEG = 0x02; | ||
| 451 | pub const MD5SIG = 0x04; | ||
| 452 | pub const SACK_ENABLE = 0x08; | ||
| 453 | pub const INFO = 0x09; | ||
| 454 | pub const NOPUSH = 0x10; | ||
| 455 | }; |