跳转到内容

std.c.openbsd

标准库Zig 0.17.1官方原文
源码std/c/openbsd.zig

第 1 行

std.c.openbsd.assert

别名

第 2 行

别名目标 std.debug.assert

std.c.openbsd.AUTH

命名空间

第 122 行

std.c.openbsd.auth_approval

函数

第 55 行

pub extern "c" fn auth_approval(as: ?*auth_session_t, ?*login_cap_t, name: ?[*:0]const u8, type: ?[*:0]const u8) c_int

参数

as: ?*auth_session_t
auth_session_t: ?*login_cap_t
name: ?[*:0]const u8
type: ?[*:0]const u8

std.c.openbsd.auth_call

函数

第 74 行

pub extern "c" fn auth_call(as: *auth_session_t, path: [*:0]const u8, ...) c_int

参数

as: *auth_session_t
path: [*:0]const u8

std.c.openbsd.auth_cat

函数

第 81 行

pub extern "c" fn auth_cat(file: [*:0]const u8) c_int

参数

file: [*:0]const u8

std.c.openbsd.auth_challenge

函数

第 75 行

pub extern "c" fn auth_challenge(as: *auth_session_t) [*:0]const u8

参数

std.c.openbsd.auth_check_change

函数

第 77 行

pub extern "c" fn auth_check_change(as: *auth_session_t) i64

参数

std.c.openbsd.auth_check_expire

函数

第 76 行

pub extern "c" fn auth_check_expire(as: *auth_session_t) i64

参数

std.c.openbsd.auth_checknologin

函数

第 82 行

pub extern "c" fn auth_checknologin(lc: *login_cap_t) void

参数

std.c.openbsd.auth_clean

函数

第 67 行

pub extern "c" fn auth_clean(as: *auth_session_t) void

参数

std.c.openbsd.auth_close

函数

第 60 行

pub extern "c" fn auth_close(as: *auth_session_t) c_int

参数

std.c.openbsd.auth_clrenv

函数

第 68 行

pub extern "c" fn auth_clrenv(as: *auth_session_t) void

参数

std.c.openbsd.auth_clroption

函数

第 69 行

pub extern "c" fn auth_clroption(as: *auth_session_t, option: [*:0]const u8) void

参数

as: *auth_session_t
option: [*:0]const u8

std.c.openbsd.auth_clroptions

函数

第 70 行

pub extern "c" fn auth_clroptions(as: *auth_session_t) void

参数

std.c.openbsd.auth_getitem

函数

第 63 行

pub extern "c" fn auth_getitem(as: *auth_session_t, item: auth_item_t) ?[*:0]const u8

参数

std.c.openbsd.auth_getpwd

函数

第 78 行

pub extern "c" fn auth_getpwd(as: *auth_session_t) ?*passwd

参数

std.c.openbsd.auth_getstate

函数

第 66 行

pub extern "c" fn auth_getstate(as: *auth_session_t) c_int

参数

std.c.openbsd.auth_getvalue

函数

第 72 行

pub extern "c" fn auth_getvalue(as: *auth_session_t, what: [*:0]const u8) ?[*:0]const u8

参数

as: *auth_session_t
what: [*:0]const u8

std.c.openbsd.auth_item_t

容器

第 96 行

字段

ALL = 0
CHALLENGE = 1
CLASS = 2
NAME = 3
SERVICE = 4
STYLE = 5
INTERACTIVE = 6

std.c.openbsd.auth_mkvalue

函数

第 80 行

pub extern "c" fn auth_mkvalue(value: [*:0]const u8) ?[*:0]const u8

参数

value: [*:0]const u8

std.c.openbsd.auth_open

函数

第 59 行

pub extern "c" fn auth_open() ?*auth_session_t

std.c.openbsd.auth_session_t

容器

第 52 行

std.c.openbsd.auth_setdata

函数

第 61 行

pub extern "c" fn auth_setdata(as: *auth_session_t, ptr: *anyopaque, len: usize) c_int

参数

as: *auth_session_t
ptr: *anyopaque
len: usize

std.c.openbsd.auth_setenv

函数

第 71 行

pub extern "c" fn auth_setenv(as: *auth_session_t) void

参数

std.c.openbsd.auth_setitem

函数

第 62 行

pub extern "c" fn auth_setitem(as: *auth_session_t, item: auth_item_t, value: [*:0]const u8) c_int

参数

as: *auth_session_t
item: auth_item_t
value: [*:0]const u8

std.c.openbsd.auth_setoption

函数

第 64 行

pub extern "c" fn auth_setoption(as: *auth_session_t, n: [*:0]const u8, v: [*:0]const u8) c_int

参数

as: *auth_session_t
n: [*:0]const u8
v: [*:0]const u8

std.c.openbsd.auth_setpwd

函数

第 79 行

pub extern "c" fn auth_setpwd(as: *auth_session_t, pwd: *passwd) c_int

参数

as: *auth_session_t
pwd: *passwd

std.c.openbsd.auth_setstate

函数

第 65 行

pub extern "c" fn auth_setstate(as: *auth_session_t, s: c_int) void

参数

as: *auth_session_t
s: c_int

std.c.openbsd.auth_userchallenge

函数

第 56 行

pub extern "c" fn auth_userchallenge(name: [*:0]const u8, style: ?[*:0]const u8, arg_type: ?[*:0]const u8, chappengep: *?[*:0]const u8) ?*auth_session_t

参数

name: [*:0]const u8
style: ?[*:0]const u8
arg_type: ?[*:0]const u8
chappengep: *?[*:0]const u8

std.c.openbsd.auth_usercheck

函数

第 58 行

pub extern "c" fn auth_usercheck(name: [*:0]const u8, style: ?[*:0]const u8, arg_type: ?[*:0]const u8, password: ?[*:0]const u8) ?*auth_session_t

参数

name: [*:0]const u8
style: ?[*:0]const u8
arg_type: ?[*:0]const u8
password: ?[*:0]const u8

std.c.openbsd.auth_userokay

函数

第 54 行

pub extern "c" fn auth_userokay(name: [*:0]const u8, style: ?[*:0]const u8, arg_type: ?[*:0]const u8, password: ?[*:0]const u8) c_int

参数

name: [*:0]const u8
style: ?[*:0]const u8
arg_type: ?[*:0]const u8
password: ?[*:0]const u8

std.c.openbsd.auth_userresponse

函数

第 57 行

pub extern "c" fn auth_userresponse(as: *auth_session_t, response: [*:0]const u8, more: c_int) c_int

参数

as: *auth_session_t
response: [*:0]const u8
more: c_int

std.c.openbsd.auth_verify

函数

第 73 行

pub extern "c" fn auth_verify(as: ?*auth_session_t, style: ?[*:0]const u8, name: ?[*:0]const u8, ...) ?*auth_session_t

参数

as: ?*auth_session_t
style: ?[*:0]const u8
name: ?[*:0]const u8

std.c.openbsd.AUTH.ALLOW

常量

第 130 行

c_int

std.c.openbsd.AUTH.CHALLENGE

常量

第 127 行

c_int

std.c.openbsd.AUTH.EXPIRED

常量

第 128 行

c_int

std.c.openbsd.AUTH.OKAY

常量

第 123 行

c_int

std.c.openbsd.AUTH.PWEXPIRED

常量

第 129 行

c_int

std.c.openbsd.AUTH.ROOTOKAY

常量

第 124 行

c_int

std.c.openbsd.AUTH.SECURE

常量

第 125 行

c_int

std.c.openbsd.AUTH.SILENT

常量

第 126 行

c_int

std.c.openbsd.bcrypt

函数

第 91 行

pub extern "c" fn bcrypt(pass: [*:0]const u8, salt: [*:0]const u8) ?[*:0]const u8

参数

pass: [*:0]const u8
salt: [*:0]const u8

std.c.openbsd.bcrypt_checkpass

函数

第 93 行

pub extern "c" fn bcrypt_checkpass(pass: [*:0]const u8, goodhash: [*:0]const u8) c_int

参数

pass: [*:0]const u8
goodhash: [*:0]const u8

std.c.openbsd.bcrypt_gensalt

函数

第 90 行

pub extern "c" fn bcrypt_gensalt(log_rounds: u8) [*:0]const u8

参数

log_rounds: u8

std.c.openbsd.bcrypt_newhash

函数

第 92 行

pub extern "c" fn bcrypt_newhash(pass: [*:0]const u8, log_rounds: c_int, hash: [*]u8, hashlen: usize) c_int

参数

pass: [*:0]const u8
log_rounds: c_int
hash: [*]u8
hashlen: usize

std.c.openbsd.BI

命名空间

第 106 行

std.c.openbsd.BI.AUTH

常量

第 107 行

std.c.openbsd.BI.CHALLENGE

常量

第 109 行

std.c.openbsd.BI.EXPIRED

常量

第 117 行

std.c.openbsd.BI.FDPASS

常量

第 119 行

std.c.openbsd.BI.PWEXPIRED

常量

第 118 行

std.c.openbsd.BI.REJECT

常量

第 108 行

std.c.openbsd.BI.REMOVE

常量

第 111 行

std.c.openbsd.BI.ROOTOKAY

常量

第 112 行

std.c.openbsd.BI.SECURE

常量

第 113 行

std.c.openbsd.BI.SETENV

常量

第 114 行

std.c.openbsd.BI.SILENT

常量

第 110 行

std.c.openbsd.BI.UNSETENV

常量

第 115 行

std.c.openbsd.BI.VALUE

常量

第 116 行

std.c.openbsd.builtin

常量

第 4 行

std.c.openbsd.caddr_t

别名

第 5 行

别名目标 std.c.caddr_t

std.c.openbsd.E

容器

第 147 行

字段

SUCCESS = 0

未发生错误。

PERM = 1
NOENT = 2
SRCH = 3
INTR = 4
IO = 5
NXIO = 6
@"2BIG" = 7
NOEXEC = 8
BADF = 9
CHILD = 10
DEADLK = 11
NOMEM = 12
ACCES = 13
FAULT = 14
NOTBLK = 15
BUSY = 16
EXIST = 17
XDEV = 18
NODEV = 19
NOTDIR = 20
ISDIR = 21
INVAL = 22
NFILE = 23
MFILE = 24
NOTTY = 25
TXTBSY = 26
FBIG = 27
NOSPC = 28
SPIPE = 29
ROFS = 30
MLINK = 31
PIPE = 32
DOM = 33
RANGE = 34
AGAIN = 35
INPROGRESS = 36
ALREADY = 37
NOTSOCK = 38
DESTADDRREQ = 39
MSGSIZE = 40
PROTOTYPE = 41
NOPROTOOPT = 42
PROTONOSUPPORT = 43
SOCKTNOSUPPORT = 44
OPNOTSUPP = 45
PFNOSUPPORT = 46
AFNOSUPPORT = 47
ADDRINUSE = 48
ADDRNOTAVAIL = 49
NETDOWN = 50
NETUNREACH = 51
NETRESET = 52
CONNABORTED = 53
CONNRESET = 54
NOBUFS = 55
ISCONN = 56
NOTCONN = 57
SHUTDOWN = 58
TOOMANYREFS = 59
TIMEDOUT = 60
CONNREFUSED = 61
LOOP = 62
NAMETOOLONG = 63
HOSTDOWN = 64
HOSTUNREACH = 65
NOTEMPTY = 66
PROCLIM = 67
USERS = 68
DQUOT = 69
STALE = 70
REMOTE = 71
BADRPC = 72
RPCMISMATCH = 73
PROGUNAVAIL = 74
PROGMISMATCH = 75
PROCUNAVAIL = 76
NOLCK = 77
NOSYS = 78
FTYPE = 79
AUTH = 80
NEEDAUTH = 81
IPSEC = 82
NOATTR = 83
ILSEQ = 84
NOMEDIUM = 85
MEDIUMTYPE = 86
OVERFLOW = 87
CANCELED = 88
IDRM = 89
NOMSG = 90
NOTSUP = 91
BADMSG = 92
NOTRECOVERABLE = 93
OWNERDEAD = 94
PROTO = 95
_

std.c.openbsd.futex

函数

第 33 行

pub extern "c" fn futex(uaddr: ?*const volatile u32, op: c_int, val: c_int, timeout: ?*const timespec, uaddr2: ?*const volatile u32) c_int

参数

uaddr: ?*const volatile u32
op: c_int
val: c_int
timeout: ?*const timespec
uaddr2: ?*const volatile u32

std.c.openbsd.FUTEX

命名空间

第 27 行

std.c.openbsd.FUTEX.PRIVATE_FLAG

常量

第 31 行

std.c.openbsd.FUTEX.REQUEUE

常量

第 30 行

std.c.openbsd.FUTEX.WAIT

常量

第 28 行

std.c.openbsd.FUTEX.WAKE

常量

第 29 行

std.c.openbsd.getpwnam_shadow

函数

第 86 行

pub extern "c" fn getpwnam_shadow(name: [*:0]const u8) ?*passwd

参数

name: [*:0]const u8

std.c.openbsd.getpwuid_shadow

函数

第 85 行

pub extern "c" fn getpwuid_shadow(uid: uid_t) ?*passwd

参数

uid: uid_t

std.c.openbsd.getthrid

函数

第 25 行

pub extern "c" fn getthrid() pid_t

std.c.openbsd.iovec

别名

第 6 行

别名目标 std.posix.iovec

std.c.openbsd.iovec_const

别名

第 7 行

别名目标 std.posix.iovec_const

std.c.openbsd.IP

命名空间

第 283 行

std.c.openbsd.IP.ADD_MEMBERSHIP

常量

第 295 行

std.c.openbsd.IP.AUTH_LEVEL

常量

第 298 行

std.c.openbsd.IP.DEFAULT_MULTICAST_LOOP

常量

第 319 行

std.c.openbsd.IP.DEFAULT_MULTICAST_TTL

常量

第 318 行

std.c.openbsd.IP.DROP_MEMBERSHIP

常量

第 296 行

std.c.openbsd.IP.ESP_NETWORK_LEVEL

常量

第 300 行

std.c.openbsd.IP.ESP_TRANS_LEVEL

常量

第 299 行

std.c.openbsd.IP.HDRINCL

常量

第 285 行

std.c.openbsd.IP.IPCOMP_LEVEL

常量

第 307 行

std.c.openbsd.IP.IPDEFTTL

常量

第 315 行

std.c.openbsd.IP.IPSEC_LOCAL_AUTH

常量

第 305 行

std.c.openbsd.IP.IPSEC_LOCAL_CRED

常量

第 303 行

std.c.openbsd.IP.IPSEC_LOCAL_ID

常量

第 301 行

std.c.openbsd.IP.IPSEC_REMOTE_AUTH

常量

第 306 行

std.c.openbsd.IP.IPSEC_REMOTE_CRED

常量

第 304 行

std.c.openbsd.IP.IPSEC_REMOTE_ID

常量

第 302 行

std.c.openbsd.IP.IPSECFLOWINFO

常量

第 314 行

std.c.openbsd.IP.MAX_MEMBERSHIPS

常量

第 321 行

std.c.openbsd.IP.MIN_MEMBERSHIPS

常量

第 320 行

std.c.openbsd.IP.MINTTL

常量

第 310 行

std.c.openbsd.IP.MULTICAST_IF

常量

第 292 行

std.c.openbsd.IP.MULTICAST_LOOP

常量

第 294 行

std.c.openbsd.IP.MULTICAST_TTL

常量

第 293 行

std.c.openbsd.IP.OPTIONS

常量

第 284 行

std.c.openbsd.IP.PIPEX

常量

第 312 行

std.c.openbsd.IP.PORTRANGE

常量

第 297 行

std.c.openbsd.IP.PORTRANGE_DEFAULT

常量

第 322 行

std.c.openbsd.IP.PORTRANGE_HIGH

常量

第 323 行

std.c.openbsd.IP.PORTRANGE_LOW

常量

第 324 行

std.c.openbsd.IP.RECVDSTADDR

常量

第 290 行

std.c.openbsd.IP.RECVDSTPORT

常量

第 311 行

std.c.openbsd.IP.RECVIF

常量

第 308 行

std.c.openbsd.IP.RECVOPTS

常量

第 288 行

std.c.openbsd.IP.RECVRETOPTS

常量

第 289 行

std.c.openbsd.IP.RECVRTABLE

常量

第 313 行

std.c.openbsd.IP.RECVTTL

常量

第 309 行

std.c.openbsd.IP.RETOPTS

常量

第 291 行

std.c.openbsd.IP.RTABLE

常量

第 317 行

std.c.openbsd.IP.SENDSRCADDR

别名

第 316 行

别名目标 std.c.openbsd.IP.RECVDSTADDR

std.c.openbsd.IP.TOS

常量

第 286 行

std.c.openbsd.IP.TTL

常量

第 287 行

std.c.openbsd.IPTOS

命名空间

第 375 行

std.c.openbsd.IPTOS.CE

常量

第 379 行

std.c.openbsd.IPTOS.DSCP_AF11

常量

第 392 行

std.c.openbsd.IPTOS.DSCP_AF12

常量

第 393 行

std.c.openbsd.IPTOS.DSCP_AF13

常量

第 394 行

std.c.openbsd.IPTOS.DSCP_AF21

常量

第 396 行

std.c.openbsd.IPTOS.DSCP_AF22

常量

第 397 行

std.c.openbsd.IPTOS.DSCP_AF23

常量

第 398 行

std.c.openbsd.IPTOS.DSCP_AF31

常量

第 400 行

std.c.openbsd.IPTOS.DSCP_AF32

常量

第 401 行

std.c.openbsd.IPTOS.DSCP_AF33

常量

第 402 行

std.c.openbsd.IPTOS.DSCP_AF41

常量

第 404 行

std.c.openbsd.IPTOS.DSCP_AF42

常量

第 405 行

std.c.openbsd.IPTOS.DSCP_AF43

常量

第 406 行

std.c.openbsd.IPTOS.DSCP_CS0

常量

第 389 行

std.c.openbsd.IPTOS.DSCP_CS1

常量

第 391 行

std.c.openbsd.IPTOS.DSCP_CS2

常量

第 395 行

std.c.openbsd.IPTOS.DSCP_CS3

常量

第 399 行

std.c.openbsd.IPTOS.DSCP_CS4

常量

第 403 行

std.c.openbsd.IPTOS.DSCP_CS5

常量

第 407 行

std.c.openbsd.IPTOS.DSCP_CS6

常量

第 409 行

std.c.openbsd.IPTOS.DSCP_CS7

常量

第 410 行

std.c.openbsd.IPTOS.DSCP_EF

常量

第 408 行

std.c.openbsd.IPTOS.DSCP_LE

常量

第 390 行

std.c.openbsd.IPTOS.ECN_CE

常量

第 414 行

std.c.openbsd.IPTOS.ECN_ECT0

常量

第 413 行

std.c.openbsd.IPTOS.ECN_ECT1

常量

第 412 行

std.c.openbsd.IPTOS.ECN_MASK

常量

第 415 行

std.c.openbsd.IPTOS.ECN_NOTECT

常量

第 411 行

std.c.openbsd.IPTOS.ECT

常量

第 380 行

std.c.openbsd.IPTOS.LOWDELAY

常量

第 376 行

std.c.openbsd.IPTOS.PREC_CRITIC_ECP

常量

第 383 行

std.c.openbsd.IPTOS.PREC_FLASH

常量

第 385 行

std.c.openbsd.IPTOS.PREC_FLASHOVERRIDE

常量

第 384 行

std.c.openbsd.IPTOS.PREC_IMMEDIATE

常量

第 386 行

std.c.openbsd.IPTOS.PREC_INTERNETCONTROL

常量

第 382 行

std.c.openbsd.IPTOS.PREC_NETCONTROL

常量

第 381 行

std.c.openbsd.IPTOS.PREC_PRIORITY

常量

第 387 行

std.c.openbsd.IPTOS.PREC_ROUTINE

常量

第 388 行

std.c.openbsd.IPTOS.RELIABILITY

常量

第 378 行

std.c.openbsd.IPTOS.THROUGHPUT

常量

第 377 行

std.c.openbsd.IPV6

命名空间

第 328 行

std.c.openbsd.IPV6.AUTH_LEVEL

常量

第 353 行

std.c.openbsd.IPV6.AUTOFLOWLABEL

常量

第 357 行

std.c.openbsd.IPV6.CHECKSUM

常量

第 336 行

std.c.openbsd.IPV6.DEFAULT_MULTICAST_HOPS

常量

第 367 行

std.c.openbsd.IPV6.DEFAULT_MULTICAST_LOOP

常量

第 368 行

std.c.openbsd.IPV6.DONTFRAG

常量

第 360 行

std.c.openbsd.IPV6.DSTOPTS

常量

第 351 行

std.c.openbsd.IPV6.ESP_NETWORK_LEVEL

常量

第 355 行

std.c.openbsd.IPV6.ESP_TRANS_LEVEL

常量

第 354 行

std.c.openbsd.IPV6.HOPLIMIT

常量

第 348 行

std.c.openbsd.IPV6.HOPOPTS

常量

第 350 行

std.c.openbsd.IPV6.IPCOMP_LEVEL

常量

第 358 行

std.c.openbsd.IPV6.JOIN_GROUP

常量

第 333 行

std.c.openbsd.IPV6.LEAVE_GROUP

常量

第 334 行

std.c.openbsd.IPV6.MINHOPCOUNT

常量

第 363 行

std.c.openbsd.IPV6.MULTICAST_HOPS

常量

第 331 行

std.c.openbsd.IPV6.MULTICAST_IF

常量

第 330 行

std.c.openbsd.IPV6.MULTICAST_LOOP

常量

第 332 行

std.c.openbsd.IPV6.NEXTHOP

常量

第 349 行

std.c.openbsd.IPV6.PATHMTU

常量

第 346 行

std.c.openbsd.IPV6.PIPEX

常量

第 361 行

std.c.openbsd.IPV6.PKTINFO

常量

第 347 行

std.c.openbsd.IPV6.PORTRANGE

常量

第 335 行

std.c.openbsd.IPV6.PORTRANGE_DEFAULT

常量

第 369 行

std.c.openbsd.IPV6.PORTRANGE_HIGH

常量

第 370 行

std.c.openbsd.IPV6.PORTRANGE_LOW

常量

第 371 行

std.c.openbsd.IPV6.RECVDSTOPTS

常量

第 343 行

std.c.openbsd.IPV6.RECVDSTPORT

常量

第 362 行

std.c.openbsd.IPV6.RECVHOPLIMIT

常量

第 340 行

std.c.openbsd.IPV6.RECVHOPOPTS

常量

第 342 行

std.c.openbsd.IPV6.RECVPATHMTU

常量

第 345 行

std.c.openbsd.IPV6.RECVPKTINFO

常量

第 339 行

std.c.openbsd.IPV6.RECVRTHDR

常量

第 341 行

std.c.openbsd.IPV6.RECVTCLASS

常量

第 356 行

std.c.openbsd.IPV6.RTABLE

常量

第 364 行

std.c.openbsd.IPV6.RTHDR

常量

第 352 行

std.c.openbsd.IPV6.RTHDR_LOOSE

常量

第 365 行

std.c.openbsd.IPV6.RTHDR_TYPE_0

常量

第 366 行

std.c.openbsd.IPV6.RTHDRDSTOPTS

常量

第 338 行

std.c.openbsd.IPV6.TCLASS

常量

第 359 行

std.c.openbsd.IPV6.UNICAST_HOPS

常量

第 329 行

std.c.openbsd.IPV6.USE_MIN_MTU

常量

第 344 行

std.c.openbsd.IPV6.V6ONLY

常量

第 337 行

std.c.openbsd.login_cap_t

容器

第 35 行

字段

class: ?[*:0]const u8
cap: ?[*:0]const u8
style: ?[*:0]const u8

std.c.openbsd.login_close

函数

第 48 行

pub extern "c" fn login_close(lc: *login_cap_t) void

参数

std.c.openbsd.login_getcapbool

函数

第 43 行

pub extern "c" fn login_getcapbool(lc: *login_cap_t, cap: [*:0]const u8, def: c_int) c_int

参数

lc: *login_cap_t
cap: [*:0]const u8
def: c_int

std.c.openbsd.login_getcapnum

函数

第 44 行

pub extern "c" fn login_getcapnum(lc: *login_cap_t, cap: [*:0]const u8, def: i64, err: i64) i64

参数

lc: *login_cap_t
cap: [*:0]const u8
def: i64
err: i64

std.c.openbsd.login_getcapsize

函数

第 45 行

pub extern "c" fn login_getcapsize(lc: *login_cap_t, cap: [*:0]const u8, def: i64, err: i64) i64

参数

lc: *login_cap_t
cap: [*:0]const u8
def: i64
err: i64

std.c.openbsd.login_getcapstr

函数

第 46 行

pub extern "c" fn login_getcapstr(lc: *login_cap_t, cap: [*:0]const u8, def: [*:0]const u8, err: [*:0]const u8) [*:0]const u8

参数

lc: *login_cap_t
cap: [*:0]const u8
def: [*:0]const u8
err: [*:0]const u8

std.c.openbsd.login_getcaptime

函数

第 47 行

pub extern "c" fn login_getcaptime(lc: *login_cap_t, cap: [*:0]const u8, def: i64, err: i64) i64

参数

lc: *login_cap_t
cap: [*:0]const u8
def: i64
err: i64

std.c.openbsd.login_getclass

函数

第 41 行

pub extern "c" fn login_getclass(class: ?[*:0]const u8) ?*login_cap_t

参数

class: ?[*:0]const u8

std.c.openbsd.login_getstyle

函数

第 42 行

pub extern "c" fn login_getstyle(lc: *login_cap_t, style: ?[*:0]const u8, atype: ?[*:0]const u8) ?[*:0]const u8

参数

lc: *login_cap_t
style: ?[*:0]const u8
atype: ?[*:0]const u8

std.c.openbsd.MAX_PAGE_SHIFT

常量

第 271 行

std.c.openbsd.maxInt

别名

第 3 行

别名目标 std.math.maxInt

std.c.openbsd.passwd

别名

第 8 行

别名目标 std.c.passwd

std.c.openbsd.pid_t

别名

第 11 行

别名目标 std.c.pid_t

std.c.openbsd.pledge

函数

第 23 行

pub extern "c" fn pledge(promises: ?[*:0]const u8, execpromises: ?[*:0]const u8) c_int

参数

promises: ?[*:0]const u8
execpromises: ?[*:0]const u8

std.c.openbsd.pthread_spinlock_t

容器

第 19 行

字段

inner: ?*anyopaque = null

std.c.openbsd.PTHREAD_STACK_MIN

常量

第 276 行

std.c.openbsd.ptrace

函数

第 17 行

pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: caddr_t, data: c_int) c_int

参数

request: c_int
pid: pid_t
addr: caddr_t
data: c_int

std.c.openbsd.pw_dup

函数

第 94 行

pub extern "c" fn pw_dup(pw: *const passwd) ?*passwd

参数

pw: *const passwd

std.c.openbsd.setclasscontext

函数

第 49 行

pub extern "c" fn setclasscontext(class: [*:0]const u8, flags: c_uint) c_int

参数

class: [*:0]const u8
flags: c_uint

std.c.openbsd.setpassent

函数

第 87 行

pub extern "c" fn setpassent(stayopen: c_int) c_int

参数

stayopen: c_int

std.c.openbsd.setusercontext

函数

第 50 行

pub extern "c" fn setusercontext(lc: *login_cap_t, pwd: *passwd, uid: uid_t, flags: c_uint) c_int

参数

lc: *login_cap_t
pwd: *passwd
uid: uid_t
flags: c_uint

std.c.openbsd.std

别名

第 1 行

别名目标 std

std.c.openbsd.TCFLUSH

容器

第 133 行

字段

none = 0
I = 1
O = 2
IO = 3

std.c.openbsd.TCIO

容器

第 140 行

字段

OOFF = 1
OON = 2
IOFF = 3
ION = 4

std.c.openbsd.TCP

命名空间

第 419 行

std.c.openbsd.TCP.INFO

常量

第 424 行

std.c.openbsd.TCP.MAXSEG

常量

第 421 行

std.c.openbsd.TCP.MD5SIG

常量

第 422 行

std.c.openbsd.TCP.NODELAY

常量

第 420 行

std.c.openbsd.TCP.NOPUSH

常量

第 425 行

std.c.openbsd.TCP.SACK_ENABLE

常量

第 423 行

std.c.openbsd.timespec

别名

第 9 行

别名目标 std.c.timespec

std.c.openbsd.uid_from_user

函数

第 88 行

pub extern "c" fn uid_from_user(name: [*:0]const u8, uid: *uid_t) c_int

参数

name: [*:0]const u8
uid: *uid_t

std.c.openbsd.uid_t

别名

第 10 行

别名目标 std.c.uid_t

std.c.openbsd.unveil

函数

第 24 行

pub extern "c" fn unveil(path: ?[*:0]const u8, permissions: ?[*:0]const u8) c_int

参数

path: ?[*:0]const u8
permissions: ?[*:0]const u8

std.c.openbsd.user_from_uid

函数

第 89 行

pub extern "c" fn user_from_uid(uid: uid_t, noname: c_int) ?[*:0]const u8

参数

uid: uid_t
noname: c_int
源码

std/c/openbsd.zig

const std = @import("../std.zig");
const assert = std.debug.assert;
const maxInt = std.math.maxInt;
const builtin = @import("builtin");
const caddr_t = std.c.caddr_t;
const iovec = std.posix.iovec;
const iovec_const = std.posix.iovec_const;
const passwd = std.c.passwd;
const timespec = std.c.timespec;
const uid_t = std.c.uid_t;
const pid_t = std.c.pid_t;

comptime {
    assert(builtin.os.tag == .openbsd); // 防止在错误的操作系统上访问 std.c 符号。
}

pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: caddr_t, data: c_int) c_int;

pub const pthread_spinlock_t = extern struct {
    inner: ?*anyopaque = null,
};

pub extern "c" fn pledge(promises: ?[*:0]const u8, execpromises: ?[*:0]const u8) c_int;
pub extern "c" fn unveil(path: ?[*:0]const u8, permissions: ?[*:0]const u8) c_int;
pub extern "c" fn getthrid() pid_t;

pub const FUTEX = struct {
    pub const WAIT = 1;
    pub const WAKE = 2;
    pub const REQUEUE = 3;
    pub const PRIVATE_FLAG = 128;
};
pub extern "c" fn futex(uaddr: ?*const volatile u32, op: c_int, val: c_int, timeout: ?*const timespec, uaddr2: ?*const volatile u32) c_int;

pub const login_cap_t = extern struct {
    class: ?[*:0]const u8,
    cap: ?[*:0]const u8,
    style: ?[*:0]const u8,
};

pub extern "c" fn login_getclass(class: ?[*:0]const u8) ?*login_cap_t;
pub extern "c" fn login_getstyle(lc: *login_cap_t, style: ?[*:0]const u8, atype: ?[*:0]const u8) ?[*:0]const u8;
pub extern "c" fn login_getcapbool(lc: *login_cap_t, cap: [*:0]const u8, def: c_int) c_int;
pub extern "c" fn login_getcapnum(lc: *login_cap_t, cap: [*:0]const u8, def: i64, err: i64) i64;
pub extern "c" fn login_getcapsize(lc: *login_cap_t, cap: [*:0]const u8, def: i64, err: i64) i64;
pub extern "c" fn login_getcapstr(lc: *login_cap_t, cap: [*:0]const u8, def: [*:0]const u8, err: [*:0]const u8) [*:0]const u8;
pub extern "c" fn login_getcaptime(lc: *login_cap_t, cap: [*:0]const u8, def: i64, err: i64) i64;
pub extern "c" fn login_close(lc: *login_cap_t) void;
pub extern "c" fn setclasscontext(class: [*:0]const u8, flags: c_uint) c_int;
pub extern "c" fn setusercontext(lc: *login_cap_t, pwd: *passwd, uid: uid_t, flags: c_uint) c_int;

pub const auth_session_t = opaque {};

pub extern "c" fn auth_userokay(name: [*:0]const u8, style: ?[*:0]const u8, arg_type: ?[*:0]const u8, password: ?[*:0]const u8) c_int;
pub extern "c" fn auth_approval(as: ?*auth_session_t, ?*login_cap_t, name: ?[*:0]const u8, type: ?[*:0]const u8) c_int;
pub extern "c" fn auth_userchallenge(name: [*:0]const u8, style: ?[*:0]const u8, arg_type: ?[*:0]const u8, chappengep: *?[*:0]const u8) ?*auth_session_t;
pub extern "c" fn auth_userresponse(as: *auth_session_t, response: [*:0]const u8, more: c_int) c_int;
pub extern "c" fn auth_usercheck(name: [*:0]const u8, style: ?[*:0]const u8, arg_type: ?[*:0]const u8, password: ?[*:0]const u8) ?*auth_session_t;
pub extern "c" fn auth_open() ?*auth_session_t;
pub extern "c" fn auth_close(as: *auth_session_t) c_int;
pub extern "c" fn auth_setdata(as: *auth_session_t, ptr: *anyopaque, len: usize) c_int;
pub extern "c" fn auth_setitem(as: *auth_session_t, item: auth_item_t, value: [*:0]const u8) c_int;
pub extern "c" fn auth_getitem(as: *auth_session_t, item: auth_item_t) ?[*:0]const u8;
pub extern "c" fn auth_setoption(as: *auth_session_t, n: [*:0]const u8, v: [*:0]const u8) c_int;
pub extern "c" fn auth_setstate(as: *auth_session_t, s: c_int) void;
pub extern "c" fn auth_getstate(as: *auth_session_t) c_int;
pub extern "c" fn auth_clean(as: *auth_session_t) void;
pub extern "c" fn auth_clrenv(as: *auth_session_t) void;
pub extern "c" fn auth_clroption(as: *auth_session_t, option: [*:0]const u8) void;
pub extern "c" fn auth_clroptions(as: *auth_session_t) void;
pub extern "c" fn auth_setenv(as: *auth_session_t) void;
pub extern "c" fn auth_getvalue(as: *auth_session_t, what: [*:0]const u8) ?[*:0]const u8;
pub extern "c" fn auth_verify(as: ?*auth_session_t, style: ?[*:0]const u8, name: ?[*:0]const u8, ...) ?*auth_session_t;
pub extern "c" fn auth_call(as: *auth_session_t, path: [*:0]const u8, ...) c_int;
pub extern "c" fn auth_challenge(as: *auth_session_t) [*:0]const u8;
pub extern "c" fn auth_check_expire(as: *auth_session_t) i64;
pub extern "c" fn auth_check_change(as: *auth_session_t) i64;
pub extern "c" fn auth_getpwd(as: *auth_session_t) ?*passwd;
pub extern "c" fn auth_setpwd(as: *auth_session_t, pwd: *passwd) c_int;
pub extern "c" fn auth_mkvalue(value: [*:0]const u8) ?[*:0]const u8;
pub extern "c" fn auth_cat(file: [*:0]const u8) c_int;
pub extern "c" fn auth_checknologin(lc: *login_cap_t) void;
// TODO: auth_set_va_list 需要 Zig 支持 va_list 类型(#515)

pub extern "c" fn getpwuid_shadow(uid: uid_t) ?*passwd;
pub extern "c" fn getpwnam_shadow(name: [*:0]const u8) ?*passwd;
pub extern "c" fn setpassent(stayopen: c_int) c_int;
pub extern "c" fn uid_from_user(name: [*:0]const u8, uid: *uid_t) c_int;
pub extern "c" fn user_from_uid(uid: uid_t, noname: c_int) ?[*:0]const u8;
pub extern "c" fn bcrypt_gensalt(log_rounds: u8) [*:0]const u8;
pub extern "c" fn bcrypt(pass: [*:0]const u8, salt: [*:0]const u8) ?[*:0]const u8;
pub extern "c" fn bcrypt_newhash(pass: [*:0]const u8, log_rounds: c_int, hash: [*]u8, hashlen: usize) c_int;
pub extern "c" fn bcrypt_checkpass(pass: [*:0]const u8, goodhash: [*:0]const u8) c_int;
pub extern "c" fn pw_dup(pw: *const passwd) ?*passwd;

pub const auth_item_t = enum(c_int) {
    ALL = 0,
    CHALLENGE = 1,
    CLASS = 2,
    NAME = 3,
    SERVICE = 4,
    STYLE = 5,
    INTERACTIVE = 6,
};

pub const BI = struct {
    pub const AUTH = "authorize"; // 已接受身份验证
    pub const REJECT = "reject"; // 认证被拒绝
    pub const CHALLENGE = "reject challenge"; // 以质询方式拒绝
    pub const SILENT = "reject silent"; // 静默拒绝
    pub const REMOVE = "remove"; // 发生错误时移除文件
    pub const ROOTOKAY = "authorize root"; // 根已认证
    pub const SECURE = "authorize secure"; // 在不安全线路上可正常工作
    pub const SETENV = "setenv"; // 设置环境变量
    pub const UNSETENV = "unsetenv"; // 取消设置环境变量
    pub const VALUE = "value"; // 设置局部变量
    pub const EXPIRED = "reject expired"; // 账户已过期
    pub const PWEXPIRED = "reject pwexpired"; // 密码已过期
    pub const FDPASS = "fd"; // 子进程正在传递文件描述符
};

pub const AUTH = struct {
    pub const OKAY: c_int = 0x01; // 用户已认证
    pub const ROOTOKAY: c_int = 0x02; // 已通过身份验证并以 root 运行
    pub const SECURE: c_int = 0x04; // 安全登录
    pub const SILENT: c_int = 0x08; // 静默拒绝
    pub const CHALLENGE: c_int = 0x10; // 已给出挑战
    pub const EXPIRED: c_int = 0x20; // 账户已过期
    pub const PWEXPIRED: c_int = 0x40; // 密码已过期
    pub const ALLOW: c_int = (OKAY | ROOTOKAY | SECURE);
};

pub const TCFLUSH = enum(u32) {
    none = 0,
    I = 1,
    O = 2,
    IO = 3,
};

pub const TCIO = enum(u32) {
    OOFF = 1,
    OON = 2,
    IOFF = 3,
    ION = 4,
};

pub const E = enum(u16) {
    /// 未发生错误。
    SUCCESS = 0,
    PERM = 1, // 操作不被允许
    NOENT = 2, // 没有此文件或目录
    SRCH = 3, // 无此进程
    INTR = 4, // 系统调用被中断
    IO = 5, // 输入/输出错误
    NXIO = 6, // 设备未配置
    @"2BIG" = 7, // 参数列表过长
    NOEXEC = 8, // 可执行文件格式错误
    BADF = 9, // 文件描述符错误
    CHILD = 10, // 没有子进程
    DEADLK = 11, // 避免资源死锁
    // 11 曾为 AGAIN
    NOMEM = 12, // 无法分配内存
    ACCES = 13, // 权限被拒绝
    FAULT = 14, // 错误的地址
    NOTBLK = 15, // 需要块设备
    BUSY = 16, // 设备忙
    EXIST = 17, // 文件已存在
    XDEV = 18, // 跨设备链接
    NODEV = 19, // 设备不支持此操作
    NOTDIR = 20, // 不是目录
    ISDIR = 21, // 是一个目录
    INVAL = 22, // 参数无效
    NFILE = 23, // 系统中打开的文件过多
    MFILE = 24, // 打开的文件过多
    NOTTY = 25, // 此设备不适用该 ioctl
    TXTBSY = 26, // 文本文件忙
    FBIG = 27, // 文件过大
    NOSPC = 28, // 设备上没有剩余空间
    SPIPE = 29, // 非法寻址
    ROFS = 30, // 只读文件系统
    MLINK = 31, // 链接过多
    PIPE = 32, // 管道破裂

    // 数学软件
    DOM = 33, // 数值参数超出定义域
    RANGE = 34, // 结果过大或过小

    // 非阻塞和中断 I/O
    // 另有:WOULDBLOCK:操作会阻塞
    AGAIN = 35, // 资源暂时不可用
    INPROGRESS = 36, // 操作正在进行中
    ALREADY = 37, // 操作已在进行中

    // IPC/网络软件——参数错误
    NOTSOCK = 38, // 对非套接字执行了套接字操作
    DESTADDRREQ = 39, // 需要目标地址
    MSGSIZE = 40, // 消息过长
    PROTOTYPE = 41, // 套接字的协议类型错误
    NOPROTOOPT = 42, // 协议选项不可用
    PROTONOSUPPORT = 43, // 不支持此协议
    SOCKTNOSUPPORT = 44, // 不支持的套接字类型
    OPNOTSUPP = 45, // 操作不受支持
    PFNOSUPPORT = 46, // 不支持此协议族
    AFNOSUPPORT = 47, // 地址族不受协议族支持
    ADDRINUSE = 48, // 地址已被使用
    ADDRNOTAVAIL = 49, // 无法分配请求的地址

    // 进程间通信或网络软件——运行错误
    NETDOWN = 50, // 网络已关闭
    NETUNREACH = 51, // 网络不可达
    NETRESET = 52, // 网络因重置而断开连接
    CONNABORTED = 53, // 软件导致连接中止
    CONNRESET = 54, // 连接被对端重置
    NOBUFS = 55, // 没有可用的缓冲区空间
    ISCONN = 56, // 套接字已连接
    NOTCONN = 57, // 套接字未连接
    SHUTDOWN = 58, // 套接字关闭后无法发送
    TOOMANYREFS = 59, // 引用过多:无法拼接
    TIMEDOUT = 60, // 操作超时
    CONNREFUSED = 61, // 连接被拒绝

    LOOP = 62, // 遇到过多层符号链接
    NAMETOOLONG = 63, // 文件名过长

    // 应重新排列
    HOSTDOWN = 64, // 主机已关闭
    HOSTUNREACH = 65, // 无到主机的路由
    NOTEMPTY = 66, // 目录非空

    // 配额及杂项
    PROCLIM = 67, // 进程过多
    USERS = 68, // 用户过多
    DQUOT = 69, // 超出磁盘配额

    // 网络文件系统
    STALE = 70, // 失效的 NFS 文件句柄
    REMOTE = 71, // 路径中的远程层级过多
    BADRPC = 72, // RPC 结构错误
    RPCMISMATCH = 73, // RPC 版本错误
    PROGUNAVAIL = 74, // RPC 程序不可用
    PROGMISMATCH = 75, // 程序版本错误
    PROCUNAVAIL = 76, // 程序的过程错误

    NOLCK = 77, // 没有可用的锁
    NOSYS = 78, // 函数未实现

    FTYPE = 79, // 文件类型或格式不合适
    AUTH = 80, // 身份验证错误
    NEEDAUTH = 81, // 需要身份验证器
    IPSEC = 82, // IPsec 处理失败
    NOATTR = 83, // 找不到属性

    // 宽字符/多字节字符处理,ISO/IEC 9899/AMD1:1995
    ILSEQ = 84, // 非法字节序列

    NOMEDIUM = 85, // 未找到介质
    MEDIUMTYPE = 86, // 介质类型错误
    OVERFLOW = 87, // 值过大,无法存入数据类型
    CANCELED = 88, // 操作已取消
    IDRM = 89, // 标识符已移除
    NOMSG = 90, // 没有所需类型的消息
    NOTSUP = 91, // 不支持
    BADMSG = 92, // 消息错误或已损坏
    NOTRECOVERABLE = 93, // 状态不可恢复
    OWNERDEAD = 94, // 前一所有者已终止
    PROTO = 95, // 协议错误

    _,
};

pub const MAX_PAGE_SHIFT = switch (builtin.cpu.arch) {
    .x86 => 12,
    .sparc64 => 13,
};

pub const PTHREAD_STACK_MIN = switch (builtin.cpu.arch) {
    .sparc64 => 1 << 13,
    .mips64 => 1 << 14,
    else => 1 << 12,
};

// https://github.com/openbsd/src/blob/718a31b40d39fc6064de6355eb144e74633133fc/sys/netinet/in.h#L283
pub const IP = struct {
    pub const OPTIONS = 1;
    pub const HDRINCL = 2;
    pub const TOS = 3;
    pub const TTL = 4;
    pub const RECVOPTS = 5;
    pub const RECVRETOPTS = 6;
    pub const RECVDSTADDR = 7;
    pub const RETOPTS = 8;
    pub const MULTICAST_IF = 9;
    pub const MULTICAST_TTL = 10;
    pub const MULTICAST_LOOP = 11;
    pub const ADD_MEMBERSHIP = 12;
    pub const DROP_MEMBERSHIP = 13;
    pub const PORTRANGE = 19;
    pub const AUTH_LEVEL = 20;
    pub const ESP_TRANS_LEVEL = 21;
    pub const ESP_NETWORK_LEVEL = 22;
    pub const IPSEC_LOCAL_ID = 23;
    pub const IPSEC_REMOTE_ID = 24;
    pub const IPSEC_LOCAL_CRED = 25;
    pub const IPSEC_REMOTE_CRED = 26;
    pub const IPSEC_LOCAL_AUTH = 27;
    pub const IPSEC_REMOTE_AUTH = 28;
    pub const IPCOMP_LEVEL = 29;
    pub const RECVIF = 30;
    pub const RECVTTL = 31;
    pub const MINTTL = 32;
    pub const RECVDSTPORT = 33;
    pub const PIPEX = 34;
    pub const RECVRTABLE = 35;
    pub const IPSECFLOWINFO = 36;
    pub const IPDEFTTL = 37;
    pub const SENDSRCADDR = RECVDSTADDR;
    pub const RTABLE = 0x1021;
    pub const DEFAULT_MULTICAST_TTL = 1;
    pub const DEFAULT_MULTICAST_LOOP = 1;
    pub const MIN_MEMBERSHIPS = 15;
    pub const MAX_MEMBERSHIPS = 4095;
    pub const PORTRANGE_DEFAULT = 0;
    pub const PORTRANGE_HIGH = 1;
    pub const PORTRANGE_LOW = 2;
};

// https://github.com/openbsd/src/blob/718a31b40d39fc6064de6355eb144e74633133fc/sys/netinet6/in6.h#L284
pub const IPV6 = struct {
    pub const UNICAST_HOPS = 4;
    pub const MULTICAST_IF = 9;
    pub const MULTICAST_HOPS = 10;
    pub const MULTICAST_LOOP = 11;
    pub const JOIN_GROUP = 12;
    pub const LEAVE_GROUP = 13;
    pub const PORTRANGE = 14;
    pub const CHECKSUM = 26;
    pub const V6ONLY = 27;
    pub const RTHDRDSTOPTS = 35;
    pub const RECVPKTINFO = 36;
    pub const RECVHOPLIMIT = 37;
    pub const RECVRTHDR = 38;
    pub const RECVHOPOPTS = 39;
    pub const RECVDSTOPTS = 40;
    pub const USE_MIN_MTU = 42;
    pub const RECVPATHMTU = 43;
    pub const PATHMTU = 44;
    pub const PKTINFO = 46;
    pub const HOPLIMIT = 47;
    pub const NEXTHOP = 48;
    pub const HOPOPTS = 49;
    pub const DSTOPTS = 50;
    pub const RTHDR = 51;
    pub const AUTH_LEVEL = 53;
    pub const ESP_TRANS_LEVEL = 54;
    pub const ESP_NETWORK_LEVEL = 55;
    pub const RECVTCLASS = 57;
    pub const AUTOFLOWLABEL = 59;
    pub const IPCOMP_LEVEL = 60;
    pub const TCLASS = 61;
    pub const DONTFRAG = 62;
    pub const PIPEX = 63;
    pub const RECVDSTPORT = 64;
    pub const MINHOPCOUNT = 65;
    pub const RTABLE = 0x1021;
    pub const RTHDR_LOOSE = 0;
    pub const RTHDR_TYPE_0 = 0;
    pub const DEFAULT_MULTICAST_HOPS = 1;
    pub const DEFAULT_MULTICAST_LOOP = 1;
    pub const PORTRANGE_DEFAULT = 0;
    pub const PORTRANGE_HIGH = 1;
    pub const PORTRANGE_LOW = 2;
};

// https://github.com/openbsd/src/blob/718a31b40d39fc6064de6355eb144e74633133fc/sys/netinet/ip.h#L73
pub const IPTOS = struct {
    pub const LOWDELAY = 0x10;
    pub const THROUGHPUT = 0x08;
    pub const RELIABILITY = 0x04;
    pub const CE = 0x01;
    pub const ECT = 0x02;
    pub const PREC_NETCONTROL = 0xe0;
    pub const PREC_INTERNETCONTROL = 0xc0;
    pub const PREC_CRITIC_ECP = 0xa0;
    pub const PREC_FLASHOVERRIDE = 0x80;
    pub const PREC_FLASH = 0x60;
    pub const PREC_IMMEDIATE = 0x40;
    pub const PREC_PRIORITY = 0x20;
    pub const PREC_ROUTINE = 0x00;
    pub const DSCP_CS0 = 0x00;
    pub const DSCP_LE = 0x04;
    pub const DSCP_CS1 = 0x20;
    pub const DSCP_AF11 = 0x28;
    pub const DSCP_AF12 = 0x30;
    pub const DSCP_AF13 = 0x38;
    pub const DSCP_CS2 = 0x40;
    pub const DSCP_AF21 = 0x48;
    pub const DSCP_AF22 = 0x50;
    pub const DSCP_AF23 = 0x58;
    pub const DSCP_CS3 = 0x60;
    pub const DSCP_AF31 = 0x68;
    pub const DSCP_AF32 = 0x70;
    pub const DSCP_AF33 = 0x78;
    pub const DSCP_CS4 = 0x80;
    pub const DSCP_AF41 = 0x88;
    pub const DSCP_AF42 = 0x90;
    pub const DSCP_AF43 = 0x98;
    pub const DSCP_CS5 = 0xa0;
    pub const DSCP_EF = 0xb8;
    pub const DSCP_CS6 = 0xc0;
    pub const DSCP_CS7 = 0xe0;
    pub const ECN_NOTECT = 0x00;
    pub const ECN_ECT1 = 0x01;
    pub const ECN_ECT0 = 0x02;
    pub const ECN_CE = 0x03;
    pub const ECN_MASK = 0x03;
};

// https://github.com/openbsd/src/blob/5761484065d1eed341f812f818ecf3f79138e7c6/sys/netinet/tcp.h#L215
pub const TCP = struct {
    pub const NODELAY = 0x01;
    pub const MAXSEG = 0x02;
    pub const MD5SIG = 0x04;
    pub const SACK_ENABLE = 0x08;
    pub const INFO = 0x09;
    pub const NOPUSH = 0x10;
};