跳转到内容

std.c.dragonfly

标准库Zig 0.17.0官方原文
源码std/c/dragonfly.zig

第 1 行

std.c.dragonfly.BADSIG

常量

第 119 行

std.c.dragonfly.caddr_t

别名

第 4 行

别名目标 std.c.caddr_t

std.c.dragonfly.cmsgcred

容器

第 123 行

字段

pid: pid_t
uid: uid_t
euid: uid_t
gid: gid_t
ngroups: c_short
groups: [16]gid_t

std.c.dragonfly.E

容器

第 16 行

字段

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

此代码也用于 WOULDBLOCK。

INPROGRESS = 36
ALREADY = 37
NOTSOCK = 38
DESTADDRREQ = 39
MSGSIZE = 40
PROTOTYPE = 41
NOPROTOOPT = 42
PROTONOSUPPORT = 43
SOCKTNOSUPPORT = 44
OPNOTSUPP = 45

此代码也用于 NOTSUP。

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
IDRM = 82
NOMSG = 83
OVERFLOW = 84
CANCELED = 85
ILSEQ = 86
NOATTR = 87
DOOFUS = 88
BADMSG = 89
MULTIHOP = 90
NOLINK = 91
PROTO = 92
NOMEDIUM = 93
ASYNC = 99
_

std.c.dragonfly.gid_t

别名

第 5 行

别名目标 std.c.gid_t

std.c.dragonfly.iovec

别名

第 6 行

别名目标 std.c.iovec

std.c.dragonfly.IP

命名空间

第 149 行

std.c.dragonfly.IP.ADD_MEMBERSHIP

常量

第 162 行

std.c.dragonfly.IP.DEFAULT_MULTICAST_LOOP

常量

第 195 行

std.c.dragonfly.IP.DEFAULT_MULTICAST_TTL

常量

第 194 行

std.c.dragonfly.IP.DROP_MEMBERSHIP

常量

第 163 行

std.c.dragonfly.IP.DUMMYNET_CONFIGURE

常量

第 186 行

std.c.dragonfly.IP.DUMMYNET_DEL

常量

第 187 行

std.c.dragonfly.IP.DUMMYNET_FLUSH

常量

第 188 行

std.c.dragonfly.IP.DUMMYNET_GET

常量

第 189 行

std.c.dragonfly.IP.FW_ADD

常量

第 180 行

std.c.dragonfly.IP.FW_DEL

常量

第 181 行

std.c.dragonfly.IP.FW_FLUSH

常量

第 182 行

std.c.dragonfly.IP.FW_GET

常量

第 184 行

std.c.dragonfly.IP.FW_RESETLOG

常量

第 185 行

std.c.dragonfly.IP.FW_TBL_ADD

常量

第 173 行

std.c.dragonfly.IP.FW_TBL_CREATE

常量

第 171 行

std.c.dragonfly.IP.FW_TBL_DEL

常量

第 174 行

std.c.dragonfly.IP.FW_TBL_DESTROY

常量

第 172 行

std.c.dragonfly.IP.FW_TBL_EXPIRE

常量

第 178 行

std.c.dragonfly.IP.FW_TBL_FLUSH

常量

第 175 行

std.c.dragonfly.IP.FW_TBL_GET

常量

第 176 行

std.c.dragonfly.IP.FW_TBL_ZERO

常量

第 177 行

std.c.dragonfly.IP.FW_X

常量

第 179 行

std.c.dragonfly.IP.FW_ZERO

常量

第 183 行

std.c.dragonfly.IP.HDRINCL

常量

第 151 行

std.c.dragonfly.IP.MAX_MEMBERSHIPS

常量

第 196 行

std.c.dragonfly.IP.MINTTL

常量

第 191 行

std.c.dragonfly.IP.MULTICAST_IF

常量

第 159 行

std.c.dragonfly.IP.MULTICAST_LOOP

常量

第 161 行

std.c.dragonfly.IP.MULTICAST_TTL

常量

第 160 行

std.c.dragonfly.IP.MULTICAST_VIF

常量

第 164 行

std.c.dragonfly.IP.OPTIONS

常量

第 150 行

std.c.dragonfly.IP.PORTRANGE

常量

第 169 行

std.c.dragonfly.IP.PORTRANGE_DEFAULT

常量

第 197 行

std.c.dragonfly.IP.PORTRANGE_HIGH

常量

第 198 行

std.c.dragonfly.IP.PORTRANGE_LOW

常量

第 199 行

std.c.dragonfly.IP.RECVDSTADDR

常量

第 156 行

std.c.dragonfly.IP.RECVIF

常量

第 170 行

std.c.dragonfly.IP.RECVOPTS

常量

第 154 行

std.c.dragonfly.IP.RECVRETOPTS

常量

第 155 行

std.c.dragonfly.IP.RECVTOS

常量

第 192 行

std.c.dragonfly.IP.RECVTTL

常量

第 190 行

std.c.dragonfly.IP.RETOPTS

常量

第 158 行

std.c.dragonfly.IP.RSVP_OFF

常量

第 166 行

std.c.dragonfly.IP.RSVP_ON

常量

第 165 行

std.c.dragonfly.IP.RSVP_VIF_OFF

常量

第 168 行

std.c.dragonfly.IP.RSVP_VIF_ON

常量

第 167 行

std.c.dragonfly.IP.SENDSRCADDR

别名

第 157 行

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

std.c.dragonfly.IP.TOS

常量

第 152 行

std.c.dragonfly.IP.TTL

常量

第 153 行

std.c.dragonfly.IPTOS

命名空间

第 262 行

std.c.dragonfly.IPTOS.CE

常量

第 267 行

std.c.dragonfly.IPTOS.DSCP_AF11

常量

第 279 行

std.c.dragonfly.IPTOS.DSCP_AF12

常量

第 280 行

std.c.dragonfly.IPTOS.DSCP_AF13

常量

第 281 行

std.c.dragonfly.IPTOS.DSCP_AF21

常量

第 283 行

std.c.dragonfly.IPTOS.DSCP_AF22

常量

第 284 行

std.c.dragonfly.IPTOS.DSCP_AF23

常量

第 285 行

std.c.dragonfly.IPTOS.DSCP_AF31

常量

第 287 行

std.c.dragonfly.IPTOS.DSCP_AF32

常量

第 288 行

std.c.dragonfly.IPTOS.DSCP_AF33

常量

第 289 行

std.c.dragonfly.IPTOS.DSCP_AF41

常量

第 291 行

std.c.dragonfly.IPTOS.DSCP_AF42

常量

第 292 行

std.c.dragonfly.IPTOS.DSCP_AF43

常量

第 293 行

std.c.dragonfly.IPTOS.DSCP_CS0

常量

第 277 行

std.c.dragonfly.IPTOS.DSCP_CS1

常量

第 278 行

std.c.dragonfly.IPTOS.DSCP_CS2

常量

第 282 行

std.c.dragonfly.IPTOS.DSCP_CS3

常量

第 286 行

std.c.dragonfly.IPTOS.DSCP_CS4

常量

第 290 行

std.c.dragonfly.IPTOS.DSCP_CS5

常量

第 294 行

std.c.dragonfly.IPTOS.DSCP_CS6

常量

第 297 行

std.c.dragonfly.IPTOS.DSCP_CS7

常量

第 298 行

std.c.dragonfly.IPTOS.DSCP_EF

常量

第 296 行

std.c.dragonfly.IPTOS.DSCP_VA

常量

第 295 行

std.c.dragonfly.IPTOS.ECN_CE

常量

第 302 行

std.c.dragonfly.IPTOS.ECN_ECT0

常量

第 301 行

std.c.dragonfly.IPTOS.ECN_ECT1

常量

第 300 行

std.c.dragonfly.IPTOS.ECN_MASK

常量

第 303 行

std.c.dragonfly.IPTOS.ECN_NOTECT

常量

第 299 行

std.c.dragonfly.IPTOS.ECT

常量

第 268 行

std.c.dragonfly.IPTOS.LOWDELAY

常量

第 263 行

std.c.dragonfly.IPTOS.MINCOST

常量

第 266 行

std.c.dragonfly.IPTOS.PREC_CRITIC_ECP

别名

第 274 行

别名目标 std.c.dragonfly.IPTOS.DSCP_CS5

std.c.dragonfly.IPTOS.PREC_FLASH

别名

第 272 行

别名目标 std.c.dragonfly.IPTOS.DSCP_CS3

std.c.dragonfly.IPTOS.PREC_FLASHOVERRIDE

别名

第 273 行

别名目标 std.c.dragonfly.IPTOS.DSCP_CS4

std.c.dragonfly.IPTOS.PREC_IMMEDIATE

别名

第 271 行

别名目标 std.c.dragonfly.IPTOS.DSCP_CS2

std.c.dragonfly.IPTOS.PREC_INTERNETCONTROL

别名

第 275 行

别名目标 std.c.dragonfly.IPTOS.DSCP_CS6

std.c.dragonfly.IPTOS.PREC_NETCONTROL

别名

第 276 行

别名目标 std.c.dragonfly.IPTOS.DSCP_CS7

std.c.dragonfly.IPTOS.PREC_PRIORITY

别名

第 270 行

别名目标 std.c.dragonfly.IPTOS.DSCP_CS1

std.c.dragonfly.IPTOS.PREC_ROUTINE

别名

第 269 行

别名目标 std.c.dragonfly.IPTOS.DSCP_CS0

std.c.dragonfly.IPTOS.RELIABILITY

常量

第 265 行

std.c.dragonfly.IPTOS.THROUGHPUT

常量

第 264 行

std.c.dragonfly.IPV6

命名空间

第 203 行

std.c.dragonfly.IPV6.@"2292DSTOPTS"

常量

第 215 行

std.c.dragonfly.IPV6.@"2292HOPLIMIT"

常量

第 212 行

std.c.dragonfly.IPV6.@"2292HOPOPTS"

常量

第 214 行

std.c.dragonfly.IPV6.@"2292NEXTHOP"

常量

第 213 行

std.c.dragonfly.IPV6.@"2292PKTINFO"

常量

第 211 行

std.c.dragonfly.IPV6.@"2292PKTOPTIONS"

常量

第 217 行

std.c.dragonfly.IPV6.@"2292RTHDR"

常量

第 216 行

std.c.dragonfly.IPV6.AUTOFLOWLABEL

常量

第 245 行

std.c.dragonfly.IPV6.BINDV6ONLY

别名

第 220 行

别名目标 std.c.dragonfly.IPV6.V6ONLY

std.c.dragonfly.IPV6.CHECKSUM

常量

第 218 行

std.c.dragonfly.IPV6.DEFAULT_MULTICAST_HOPS

常量

第 254 行

std.c.dragonfly.IPV6.DEFAULT_MULTICAST_LOOP

常量

第 255 行

std.c.dragonfly.IPV6.DONTFRAG

常量

第 247 行

std.c.dragonfly.IPV6.DSTOPTS

常量

第 241 行

std.c.dragonfly.IPV6.FW_ADD

常量

第 221 行

std.c.dragonfly.IPV6.FW_DEL

常量

第 222 行

std.c.dragonfly.IPV6.FW_FLUSH

常量

第 223 行

std.c.dragonfly.IPV6.FW_GET

常量

第 225 行

std.c.dragonfly.IPV6.FW_ZERO

常量

第 224 行

std.c.dragonfly.IPV6.HOPLIMIT

常量

第 238 行

std.c.dragonfly.IPV6.HOPOPTS

常量

第 240 行

std.c.dragonfly.IPV6.JOIN_GROUP

常量

第 208 行

std.c.dragonfly.IPV6.LEAVE_GROUP

常量

第 209 行

std.c.dragonfly.IPV6.MSFILTER

常量

第 249 行

std.c.dragonfly.IPV6.MULTICAST_HOPS

常量

第 206 行

std.c.dragonfly.IPV6.MULTICAST_IF

常量

第 205 行

std.c.dragonfly.IPV6.MULTICAST_LOOP

常量

第 207 行

std.c.dragonfly.IPV6.NEXTHOP

常量

第 239 行

std.c.dragonfly.IPV6.PATHMTU

常量

第 235 行

std.c.dragonfly.IPV6.PKTINFO

常量

第 237 行

std.c.dragonfly.IPV6.PKTOPTIONS

常量

第 243 行

std.c.dragonfly.IPV6.PORTRANGE

常量

第 210 行

std.c.dragonfly.IPV6.PORTRANGE_DEFAULT

常量

第 256 行

std.c.dragonfly.IPV6.PORTRANGE_HIGH

常量

第 257 行

std.c.dragonfly.IPV6.PORTRANGE_LOW

常量

第 258 行

std.c.dragonfly.IPV6.PREFER_TEMPADDR

常量

第 248 行

std.c.dragonfly.IPV6.REACHCONF

常量

第 236 行

std.c.dragonfly.IPV6.RECVDSTOPTS

常量

第 231 行

std.c.dragonfly.IPV6.RECVHOPLIMIT

常量

第 228 行

std.c.dragonfly.IPV6.RECVHOPOPTS

常量

第 230 行

std.c.dragonfly.IPV6.RECVPATHMTU

常量

第 234 行

std.c.dragonfly.IPV6.RECVPKTINFO

常量

第 227 行

std.c.dragonfly.IPV6.RECVRTHDR

常量

第 229 行

std.c.dragonfly.IPV6.RECVRTHDRDSTOPTS

常量

第 232 行

std.c.dragonfly.IPV6.RECVTCLASS

常量

第 244 行

std.c.dragonfly.IPV6.RTHDR

常量

第 242 行

std.c.dragonfly.IPV6.RTHDR_LOOSE

常量

第 251 行

std.c.dragonfly.IPV6.RTHDR_STRICT

常量

第 252 行

std.c.dragonfly.IPV6.RTHDR_TYPE_0

常量

第 253 行

std.c.dragonfly.IPV6.RTHDRDSTOPTS

常量

第 226 行

std.c.dragonfly.IPV6.TCLASS

常量

第 246 行

std.c.dragonfly.IPV6.UNICAST_HOPS

常量

第 204 行

std.c.dragonfly.IPV6.USE_MIN_MTU

常量

第 233 行

std.c.dragonfly.IPV6.V6ONLY

常量

第 219 行

std.c.dragonfly.lwp_gettid

函数

第 11 行

pub extern "c" fn lwp_gettid() c_int

std.c.dragonfly.MS_ASYNC

常量

第 139 行

std.c.dragonfly.MS_INVALIDATE

常量

第 140 行

std.c.dragonfly.MS_SYNC

常量

第 138 行

std.c.dragonfly.pid_t

别名

第 7 行

别名目标 std.c.pid_t

std.c.dragonfly.POSIX_MADV_DONTNEED

常量

第 144 行

std.c.dragonfly.POSIX_MADV_NORMAL

常量

第 145 行

std.c.dragonfly.POSIX_MADV_RANDOM

常量

第 143 行

std.c.dragonfly.POSIX_MADV_SEQUENTIAL

常量

第 142 行

std.c.dragonfly.POSIX_MADV_WILLNEED

常量

第 146 行

std.c.dragonfly.ptrace

函数

第 12 行

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.dragonfly.sf_hdtr

容器

第 131 行

字段

headers: [*]iovec
hdr_cnt: c_int
trailers: [*]iovec
trl_cnt: c_int

std.c.dragonfly.SIG

别名

第 3 行

别名目标 std.c.SIG

std.c.dragonfly.sig_t

类型

第 121 行

std.c.dragonfly.socklen_t

别名

第 8 行

别名目标 std.c.socklen_t

std.c.dragonfly.std

别名

第 1 行

别名目标 std

std.c.dragonfly.TCP

命名空间

第 307 行

std.c.dragonfly.TCP.FASTKEEP

常量

第 314 行

std.c.dragonfly.TCP.KEEPCNT

常量

第 317 行

std.c.dragonfly.TCP.KEEPIDLE

常量

第 315 行

std.c.dragonfly.TCP.KEEPINIT

常量

第 313 行

std.c.dragonfly.TCP.KEEPINTVL

常量

第 316 行

std.c.dragonfly.TCP.MAXSEG

常量

第 309 行

std.c.dragonfly.TCP.NODELAY

常量

第 308 行

std.c.dragonfly.TCP.NOOPT

常量

第 311 行

std.c.dragonfly.TCP.NOPUSH

常量

第 310 行

std.c.dragonfly.TCP.SIGNATURE_ENABLE

常量

第 312 行

std.c.dragonfly.uid_t

别名

第 9 行

别名目标 std.c.uid_t

std.c.dragonfly.umtx_sleep

函数

第 13 行

pub extern "c" fn umtx_sleep(ptr: *const volatile c_int, value: c_int, timeout: c_int) c_int

参数

ptr: *const volatile c_int
value: c_int
timeout: c_int

std.c.dragonfly.umtx_wakeup

函数

第 14 行

pub extern "c" fn umtx_wakeup(ptr: *const volatile c_int, count: c_int) c_int

参数

ptr: *const volatile c_int
count: c_int
源码

std/c/dragonfly.zig

const std = @import("../std.zig");

const SIG = std.c.SIG;
const caddr_t = std.c.caddr_t;
const gid_t = std.c.gid_t;
const iovec = std.c.iovec;
const pid_t = std.c.pid_t;
const socklen_t = std.c.socklen_t;
const uid_t = std.c.uid_t;

pub extern "c" fn lwp_gettid() c_int;
pub extern "c" fn ptrace(request: c_int, pid: pid_t, addr: caddr_t, data: c_int) c_int;
pub extern "c" fn umtx_sleep(ptr: *const volatile c_int, value: c_int, timeout: c_int) c_int;
pub extern "c" fn umtx_wakeup(ptr: *const volatile c_int, count: c_int) c_int;

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,
    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,
    /// 此代码也用于 `WOULDBLOCK`。
    AGAIN = 35,
    INPROGRESS = 36,
    ALREADY = 37,
    NOTSOCK = 38,
    DESTADDRREQ = 39,
    MSGSIZE = 40,
    PROTOTYPE = 41,
    NOPROTOOPT = 42,
    PROTONOSUPPORT = 43,
    SOCKTNOSUPPORT = 44,
    /// 此代码也用于 `NOTSUP`。
    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,
    IDRM = 82,
    NOMSG = 83,
    OVERFLOW = 84,
    CANCELED = 85,
    ILSEQ = 86,
    NOATTR = 87,
    DOOFUS = 88,
    BADMSG = 89,
    MULTIHOP = 90,
    NOLINK = 91,
    PROTO = 92,
    NOMEDIUM = 93,
    ASYNC = 99,
    _,
};

pub const BADSIG = SIG.ERR;

pub const sig_t = *const fn (i32) callconv(.c) void;

pub const cmsgcred = extern struct {
    pid: pid_t,
    uid: uid_t,
    euid: uid_t,
    gid: gid_t,
    ngroups: c_short,
    groups: [16]gid_t,
};
pub const sf_hdtr = extern struct {
    headers: [*]iovec,
    hdr_cnt: c_int,
    trailers: [*]iovec,
    trl_cnt: c_int,
};

pub const MS_SYNC = 0;
pub const MS_ASYNC = 1;
pub const MS_INVALIDATE = 2;

pub const POSIX_MADV_SEQUENTIAL = 2;
pub const POSIX_MADV_RANDOM = 1;
pub const POSIX_MADV_DONTNEED = 4;
pub const POSIX_MADV_NORMAL = 0;
pub const POSIX_MADV_WILLNEED = 3;

// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/netinet/ip.h#L94
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 SENDSRCADDR = RECVDSTADDR;
    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 MULTICAST_VIF = 14;
    pub const RSVP_ON = 15;
    pub const RSVP_OFF = 16;
    pub const RSVP_VIF_ON = 17;
    pub const RSVP_VIF_OFF = 18;
    pub const PORTRANGE = 19;
    pub const RECVIF = 20;
    pub const FW_TBL_CREATE = 40;
    pub const FW_TBL_DESTROY = 41;
    pub const FW_TBL_ADD = 42;
    pub const FW_TBL_DEL = 43;
    pub const FW_TBL_FLUSH = 44;
    pub const FW_TBL_GET = 45;
    pub const FW_TBL_ZERO = 46;
    pub const FW_TBL_EXPIRE = 47;
    pub const FW_X = 49;
    pub const FW_ADD = 50;
    pub const FW_DEL = 51;
    pub const FW_FLUSH = 52;
    pub const FW_ZERO = 53;
    pub const FW_GET = 54;
    pub const FW_RESETLOG = 55;
    pub const DUMMYNET_CONFIGURE = 60;
    pub const DUMMYNET_DEL = 61;
    pub const DUMMYNET_FLUSH = 62;
    pub const DUMMYNET_GET = 64;
    pub const RECVTTL = 65;
    pub const MINTTL = 66;
    pub const RECVTOS = 68;
    // 命名空间相同,但这些是参数,而不是选项名称
    pub const DEFAULT_MULTICAST_TTL = 1;
    pub const DEFAULT_MULTICAST_LOOP = 1;
    pub const MAX_MEMBERSHIPS = 20;
    pub const PORTRANGE_DEFAULT = 0;
    pub const PORTRANGE_HIGH = 1;
    pub const PORTRANGE_LOW = 2;
};

// https://github.com/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/netinet6/in6.h#L448
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 @"2292PKTINFO" = 19;
    pub const @"2292HOPLIMIT" = 20;
    pub const @"2292NEXTHOP" = 21;
    pub const @"2292HOPOPTS" = 22;
    pub const @"2292DSTOPTS" = 23;
    pub const @"2292RTHDR" = 24;
    pub const @"2292PKTOPTIONS" = 25;
    pub const CHECKSUM = 26;
    pub const V6ONLY = 27;
    pub const BINDV6ONLY = V6ONLY;
    pub const FW_ADD = 30;
    pub const FW_DEL = 31;
    pub const FW_FLUSH = 32;
    pub const FW_ZERO = 33;
    pub const FW_GET = 34;
    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 RECVRTHDRDSTOPTS = 41;
    pub const USE_MIN_MTU = 42;
    pub const RECVPATHMTU = 43;
    pub const PATHMTU = 44;
    pub const REACHCONF = 45;
    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 PKTOPTIONS = 52;
    pub const RECVTCLASS = 57;
    pub const AUTOFLOWLABEL = 59;
    pub const TCLASS = 61;
    pub const DONTFRAG = 62;
    pub const PREFER_TEMPADDR = 63;
    pub const MSFILTER = 74;
    // 命名空间相同,但这些是参数,而不是选项名称
    pub const RTHDR_LOOSE = 0;
    pub const RTHDR_STRICT = 1;
    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/DragonFlyBSD/DragonFlyBSD/blob/6098912863ed4c7b3f70d7483910ce2956cf4ed3/sys/netinet/ip.h#L94
pub const IPTOS = struct {
    pub const LOWDELAY = 0x10;
    pub const THROUGHPUT = 0x08;
    pub const RELIABILITY = 0x04;
    pub const MINCOST = 0x02;
    pub const CE = 0x01;
    pub const ECT = 0x02;
    pub const PREC_ROUTINE = DSCP_CS0;
    pub const PREC_PRIORITY = DSCP_CS1;
    pub const PREC_IMMEDIATE = DSCP_CS2;
    pub const PREC_FLASH = DSCP_CS3;
    pub const PREC_FLASHOVERRIDE = DSCP_CS4;
    pub const PREC_CRITIC_ECP = DSCP_CS5;
    pub const PREC_INTERNETCONTROL = DSCP_CS6;
    pub const PREC_NETCONTROL = DSCP_CS7;
    pub const DSCP_CS0 = 0x00;
    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_VA = 0xb0;
    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/DragonFlyBSD/DragonFlyBSD/blob/8410ea0817ce17438e0a10fc4ba6c9697281048a/sys/netinet/tcp.h#L156
pub const TCP = struct {
    pub const NODELAY = 0x01;
    pub const MAXSEG = 0x02;
    pub const NOPUSH = 0x04;
    pub const NOOPT = 0x08;
    pub const SIGNATURE_ENABLE = 0x10;
    pub const KEEPINIT = 0x20;
    pub const FASTKEEP = 0x80;
    pub const KEEPIDLE = 0x100;
    pub const KEEPINTVL = 0x200;
    pub const KEEPCNT = 0x400;
};