Skip to content

Commit 18b87d4

Browse files
committed
Added many socket-related constants to BSD
1 parent ac56c6d commit 18b87d4

File tree

6 files changed

+323
-5
lines changed

6 files changed

+323
-5
lines changed

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,34 @@ pub const NOTE_TRACK: ::uint32_t = 0x00000001;
344344
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
345345
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
346346

347-
pub const MSG_PEEK: ::c_int = 0x2;
348-
pub const MSG_NOSIGNAL: ::c_int = 0x400;
347+
pub const SO_SNDSPACE: ::c_int = 0x100a;
348+
pub const SO_CPUHINT: ::c_int = 0x1030;
349+
350+
pub const AF_BLUETOOTH: ::c_int = 33;
351+
pub const AF_MPLS: ::c_int = 34;
352+
pub const AF_IEEE80211: ::c_int = 35;
353+
pub const AF_MAX: ::c_int = 36;
354+
355+
pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
356+
pub const PF_MAX: ::c_int = AF_MAX;
357+
358+
pub const NET_RT_DUMP: ::c_int = 1;
359+
pub const NET_RT_FLAGS: ::c_int = 2;
360+
pub const NET_RT_IFLIST: ::c_int = 3;
361+
pub const NET_RT_MAXID: ::c_int = 4;
362+
363+
pub const SOMAXOPT_SIZE: ::c_int = 65536;
364+
365+
#[doc(hidden)]
366+
pub const NET_MAXID: ::c_int = AF_MAX;
367+
368+
pub const MSG_UNUSED09: ::c_int = 0x00000200;
369+
pub const MSG_NOSIGNAL: ::c_int = 0x00000400;
370+
pub const MSG_SYNC: ::c_int = 0x00000800;
371+
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00001000;
372+
pub const MSG_FBLOCKING: ::c_int = 0x00010000;
373+
pub const MSG_FNONBLOCKING: ::c_int = 0x00020000;
374+
pub const MSG_FMASK: ::c_int = 0xFFFF0000;
349375

350376
pub const EMPTY: ::c_short = 0;
351377
pub const RUN_LVL: ::c_short = 1;

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,11 +344,59 @@ pub const JAIL_SYS_DISABLE: ::c_int = 0;
344344
pub const JAIL_SYS_NEW: ::c_int = 1;
345345
pub const JAIL_SYS_INHERIT: ::c_int = 2;
346346

347+
pub const SO_BINTIME: ::c_int = 0x2000;
348+
pub const SO_NO_OFFLOAD: ::c_int = 0x4000;
349+
pub const SO_NO_DDP: ::c_int = 0x8000;
350+
pub const SO_LABEL: ::c_int = 0x1009;
351+
pub const SO_PEERLABEL: ::c_int = 0x1010;
352+
pub const SO_LISTENQLIMIT: ::c_int = 0x1011;
353+
pub const SO_LISTENQLEN: ::c_int = 0x1012;
354+
pub const SO_LISTENINCQLEN: ::c_int = 0x1013;
355+
pub const SO_SETFIB: ::c_int = 0x1014;
356+
pub const SO_USER_COOKIE: ::c_int = 0x1015;
357+
pub const SO_PROTOCOL: ::c_int = 0x1016;
358+
pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL;
359+
// pub const SO_TS_CLOCK: ::c_int = 0x1017;
360+
// pub const SO_MAX_PACING_RATE: ::c_int = 0x1018;
361+
// pub const SO_TS_REALTIME_MICRO: ::c_int = 0;
362+
// pub const SO_TS_BINTIME: ::c_int = 1;
363+
// pub const SO_TS_REALTIME: ::c_int = 2;
364+
// pub const SO_TS_MONOTONIC: ::c_int = 3;
365+
// pub const SO_TS_DEFAULT: ::c_int = SO_TS_REALTIME_MICRO;
366+
// pub const SO_TS_CLOCK_MAX: ::c_int = SO_TS_MONOTONIC;
367+
pub const SO_VENDOR: ::c_int = 0x80000000;
368+
369+
pub const AF_SLOW: ::c_int = 33;
370+
pub const AF_SCLUSTER: ::c_int = 34;
371+
pub const AF_ARP: ::c_int = 35;
372+
pub const AF_BLUETOOTH: ::c_int = 36;
373+
pub const AF_IEEE80211: ::c_int = 37;
374+
pub const AF_INET_SDP: ::c_int = 40;
375+
pub const AF_INET6_SDP: ::c_int = 42;
376+
pub const AF_MAX: ::c_int = 42;
377+
378+
pub const PF_SLOW: ::c_int = AF_SLOW;
379+
pub const PF_SCLUSTER: ::c_int = AF_SCLUSTER;
380+
pub const PF_ARP: ::c_int = AF_ARP;
381+
pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
382+
pub const PF_IEEE80211: ::c_int = AF_IEEE80211;
383+
pub const PF_INET_SDP: ::c_int = AF_INET_SDP;
384+
pub const PF_INET6_SDP: ::c_int = AF_INET6_SDP;
385+
pub const PF_MAX: ::c_int = AF_MAX;
386+
387+
pub const NET_RT_DUMP: ::c_int = 1;
388+
pub const NET_RT_FLAGS: ::c_int = 2;
389+
pub const NET_RT_IFLIST: ::c_int = 3;
390+
pub const NET_RT_IFMALIST: ::c_int = 4;
391+
pub const NET_RT_IFLISTL: ::c_int = 5;
392+
347393
// The *_MAXID constants never should've been used outside of the
348394
// FreeBSD base system. And with the exception of CTL_P1003_1B_MAXID,
349395
// they were all removed in svn r262489. They remain here for backwards
350396
// compatibility only, and are scheduled to be removed in libc 1.0.0.
351397
#[doc(hidden)]
398+
pub const NET_MAXID: ::c_int = AF_MAX;
399+
#[doc(hidden)]
352400
pub const CTL_MAXID: ::c_int = 10;
353401
#[doc(hidden)]
354402
pub const KERN_MAXID: ::c_int = 38;
@@ -359,7 +407,11 @@ pub const USER_MAXID: ::c_int = 21;
359407
#[doc(hidden)]
360408
pub const CTL_P1003_1B_MAXID: ::c_int = 26;
361409

362-
pub const MSG_PEEK: ::c_int = 0x2;
410+
pub const MSG_NOTIFICATION: ::c_int = 0x00002000;
411+
pub const MSG_NBIO: ::c_int = 0x00004000;
412+
pub const MSG_COMPAT: ::c_int = 0x00008000;
413+
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00040000;
414+
// pub const MSG_WAITFORONE: ::c_int = 0x00080000;
363415
pub const MSG_NOSIGNAL: ::c_int = 0x20000;
364416

365417
pub const EMPTY: ::c_short = 0;

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,98 @@ pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8;
540540
pub const MINCORE_MODIFIED_OTHER: ::c_int = 0x10;
541541
pub const MINCORE_SUPER: ::c_int = 0x20;
542542

543+
pub const AF_UNSPEC: ::c_int = 0;
544+
pub const AF_LOCAL: ::c_int = 1;
545+
pub const AF_UNIX: ::c_int = AF_LOCAL;
543546
pub const AF_INET: ::c_int = 2;
547+
pub const AF_IMPLINK: ::c_int = 3;
548+
pub const AF_PUP: ::c_int = 4;
549+
pub const AF_CHAOS: ::c_int = 5;
550+
pub const AF_NETBIOS: ::c_int = 6;
551+
pub const AF_ISO: ::c_int = 7;
552+
pub const AF_OSI: ::c_int = AF_ISO;
553+
pub const AF_ECMA: ::c_int = 8;
554+
pub const AF_DATAKIT: ::c_int = 9;
555+
pub const AF_CCITT: ::c_int = 10;
556+
pub const AF_SNA: ::c_int = 11;
557+
pub const AF_DECnet: ::c_int = 12;
558+
pub const AF_DLI: ::c_int = 13;
559+
pub const AF_LAT: ::c_int = 14;
560+
pub const AF_HYLINK: ::c_int = 15;
561+
pub const AF_APPLETALK: ::c_int = 16;
562+
pub const AF_ROUTE: ::c_int = 17;
563+
pub const AF_LINK: ::c_int = 18;
564+
pub const pseudo_AF_XTP: ::c_int = 19;
565+
pub const AF_COIP: ::c_int = 20;
566+
pub const AF_CNT: ::c_int = 21;
567+
pub const pseudo_AF_RTIP: ::c_int = 22;
568+
pub const AF_IPX: ::c_int = 23;
569+
pub const AF_SIP: ::c_int = 24;
570+
pub const pseudo_AF_PIP: ::c_int = 25;
571+
pub const AF_ISDN: ::c_int = 26;
572+
pub const AF_E164: ::c_int = AF_ISDN;
573+
pub const pseudo_AF_KEY: ::c_int = 27;
544574
pub const AF_INET6: ::c_int = 28;
545-
pub const AF_UNIX: ::c_int = 1;
575+
pub const AF_NATM: ::c_int = 29;
576+
pub const AF_ATM: ::c_int = 30;
577+
pub const pseudo_AF_HDRCMPLT: ::c_int = 31;
578+
pub const AF_NETGRAPH: ::c_int = 32;
579+
580+
pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
581+
pub const PF_LOCAL: ::c_int = AF_LOCAL;
582+
pub const PF_UNIX: ::c_int = PF_LOCAL;
583+
pub const PF_INET: ::c_int = AF_INET;
584+
pub const PF_IMPLINK: ::c_int = AF_IMPLINK;
585+
pub const PF_PUP: ::c_int = AF_PUP;
586+
pub const PF_CHAOS: ::c_int = AF_CHAOS;
587+
pub const PF_NETBIOS: ::c_int = AF_NETBIOS;
588+
pub const PF_ISO: ::c_int = AF_ISO;
589+
pub const PF_OSI: ::c_int = AF_ISO;
590+
pub const PF_ECMA: ::c_int = AF_ECMA;
591+
pub const PF_DATAKIT: ::c_int = AF_DATAKIT;
592+
pub const PF_CCITT: ::c_int = AF_CCITT;
593+
pub const PF_SNA: ::c_int = AF_SNA;
594+
pub const PF_DECnet: ::c_int = AF_DECnet;
595+
pub const PF_DLI: ::c_int = AF_DLI;
596+
pub const PF_LAT: ::c_int = AF_LAT;
597+
pub const PF_HYLINK: ::c_int = AF_HYLINK;
598+
pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
599+
pub const PF_ROUTE: ::c_int = AF_ROUTE;
600+
pub const PF_LINK: ::c_int = AF_LINK;
601+
pub const PF_XTP: ::c_int = pseudo_AF_XTP;
602+
pub const PF_COIP: ::c_int = AF_COIP;
603+
pub const PF_CNT: ::c_int = AF_CNT;
604+
pub const PF_SIP: ::c_int = AF_SIP;
605+
pub const PF_IPX: ::c_int = AF_IPX;
606+
pub const PF_RTIP: ::c_int = pseudo_AF_RTIP;
607+
pub const PF_PIP: ::c_int = pseudo_AF_PIP;
608+
pub const PF_ISDN: ::c_int = AF_ISDN;
609+
pub const PF_KEY: ::c_int = pseudo_AF_KEY;
610+
pub const PF_INET6: ::c_int = AF_INET6;
611+
pub const PF_NATM: ::c_int = AF_NATM;
612+
pub const PF_ATM: ::c_int = AF_ATM;
613+
pub const PF_NETGRAPH: ::c_int = AF_NETGRAPH;
614+
615+
pub const SOMAXCONN: ::c_int = 128;
616+
617+
pub const MSG_OOB: ::c_int = 0x00000001;
618+
pub const MSG_PEEK: ::c_int = 0x00000002;
619+
pub const MSG_DONTROUTE: ::c_int = 0x00000004;
620+
pub const MSG_EOR: ::c_int = 0x00000008;
621+
pub const MSG_TRUNC: ::c_int = 0x00000010;
622+
pub const MSG_CTRUNC: ::c_int = 0x00000020;
623+
pub const MSG_WAITALL: ::c_int = 0x00000040;
624+
pub const MSG_DONTWAIT: ::c_int = 0x00000080;
625+
pub const MSG_EOF: ::c_int = 0x00000100;
626+
546627
pub const SOCK_STREAM: ::c_int = 1;
547628
pub const SOCK_DGRAM: ::c_int = 2;
548629
pub const SOCK_RAW: ::c_int = 3;
630+
pub const SOCK_RDM: ::c_int = 4;
549631
pub const SOCK_SEQPACKET: ::c_int = 5;
632+
pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
633+
pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
634+
pub const SOCK_MAXADDRLEN: ::c_int = 255;
550635
pub const IPPROTO_ICMP: ::c_int = 1;
551636
pub const IPPROTO_ICMPV6: ::c_int = 58;
552637
pub const IPPROTO_TCP: ::c_int = 6;
@@ -574,6 +659,9 @@ pub const SO_USELOOPBACK: ::c_int = 0x0040;
574659
pub const SO_LINGER: ::c_int = 0x0080;
575660
pub const SO_OOBINLINE: ::c_int = 0x0100;
576661
pub const SO_REUSEPORT: ::c_int = 0x0200;
662+
pub const SO_TIMESTAMP: ::c_int = 0x0400;
663+
pub const SO_NOSIGPIPE: ::c_int = 0x0800;
664+
pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
577665
pub const SO_SNDBUF: ::c_int = 0x1001;
578666
pub const SO_RCVBUF: ::c_int = 0x1002;
579667
pub const SO_SNDLOWAT: ::c_int = 0x1003;

src/unix/bsd/netbsdlike/mod.rs

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,65 @@ pub const MADV_WILLNEED : ::c_int = 3;
356356
pub const MADV_DONTNEED : ::c_int = 4;
357357
pub const MADV_FREE : ::c_int = 6;
358358

359-
pub const AF_UNIX: ::c_int = 1;
359+
pub const AF_UNSPEC: ::c_int = 0;
360+
pub const AF_LOCAL: ::c_int = 1;
361+
pub const AF_UNIX: ::c_int = AF_LOCAL;
360362
pub const AF_INET: ::c_int = 2;
363+
pub const AF_IMPLINK: ::c_int = 3;
364+
pub const AF_PUP: ::c_int = 4;
365+
pub const AF_CHAOS: ::c_int = 5;
366+
pub const AF_NS: ::c_int = 6;
367+
pub const AF_ISO: ::c_int = 7;
368+
pub const AF_OSI: ::c_int = AF_ISO;
369+
pub const AF_DATAKIT: ::c_int = 9;
370+
pub const AF_CCITT: ::c_int = 10;
371+
pub const AF_SNA: ::c_int = 11;
372+
pub const AF_DECnet: ::c_int = 12;
373+
pub const AF_DLI: ::c_int = 13;
374+
pub const AF_LAT: ::c_int = 14;
375+
pub const AF_HYLINK: ::c_int = 15;
376+
pub const AF_APPLETALK: ::c_int = 16;
377+
pub const AF_LINK: ::c_int = 18;
378+
pub const pseudo_AF_XTP: ::c_int = 19;
379+
pub const AF_COIP: ::c_int = 20;
380+
pub const AF_CNT: ::c_int = 21;
381+
pub const pseudo_AF_RTIP: ::c_int = 22;
382+
pub const AF_IPX: ::c_int = 23;
361383
pub const AF_INET6: ::c_int = 24;
384+
pub const pseudo_AF_PIP: ::c_int = 25;
385+
pub const AF_ISDN: ::c_int = 26;
386+
pub const AF_E164: ::c_int = AF_ISDN;
387+
pub const AF_NATM: ::c_int = 27;
388+
389+
pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
390+
pub const PF_LOCAL: ::c_int = AF_LOCAL;
391+
pub const PF_UNIX: ::c_int = PF_LOCAL;
392+
pub const PF_INET: ::c_int = AF_INET;
393+
pub const PF_IMPLINK: ::c_int = AF_IMPLINK;
394+
pub const PF_PUP: ::c_int = AF_PUP;
395+
pub const PF_CHAOS: ::c_int = AF_CHAOS;
396+
pub const PF_NS: ::c_int = AF_NS;
397+
pub const PF_ISO: ::c_int = AF_ISO;
398+
pub const PF_OSI: ::c_int = AF_ISO;
399+
pub const PF_DATAKIT: ::c_int = AF_DATAKIT;
400+
pub const PF_CCITT: ::c_int = AF_CCITT;
401+
pub const PF_SNA: ::c_int = AF_SNA;
402+
pub const PF_DECnet: ::c_int = AF_DECnet;
403+
pub const PF_DLI: ::c_int = AF_DLI;
404+
pub const PF_LAT: ::c_int = AF_LAT;
405+
pub const PF_HYLINK: ::c_int = AF_HYLINK;
406+
pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
407+
pub const PF_LINK: ::c_int = AF_LINK;
408+
pub const PF_XTP: ::c_int = pseudo_AF_XTP;
409+
pub const PF_COIP: ::c_int = AF_COIP;
410+
pub const PF_CNT: ::c_int = AF_CNT;
411+
pub const PF_IPX: ::c_int = AF_IPX;
412+
pub const PF_INET6: ::c_int = AF_INET6;
413+
pub const PF_RTIP: ::c_int = pseudo_AF_RTIP;
414+
pub const PF_PIP: ::c_int = pseudo_AF_PIP;
415+
pub const PF_ISDN: ::c_int = AF_ISDN;
416+
pub const PF_NATM: ::c_int = AF_NATM;
417+
362418
pub const SOCK_STREAM: ::c_int = 1;
363419
pub const SOCK_DGRAM: ::c_int = 2;
364420
pub const SOCK_RAW: ::c_int = 3;
@@ -394,8 +450,22 @@ pub const SO_RCVLOWAT: ::c_int = 0x1004;
394450
pub const SO_ERROR: ::c_int = 0x1007;
395451
pub const SO_TYPE: ::c_int = 0x1008;
396452

453+
pub const SOMAXCONN: ::c_int = 128;
454+
455+
pub const MSG_OOB: ::c_int = 0x1;
397456
pub const MSG_PEEK: ::c_int = 0x2;
457+
pub const MSG_DONTROUTE: ::c_int = 0x4;
458+
pub const MSG_EOR: ::c_int = 0x8;
459+
pub const MSG_TRUNC: ::c_int = 0x10;
460+
pub const MSG_CTRUNC: ::c_int = 0x20;
461+
pub const MSG_WAITALL: ::c_int = 0x40;
462+
pub const MSG_DONTWAIT: ::c_int = 0x80;
463+
pub const MSG_BCAST: ::c_int = 0x100;
464+
pub const MSG_MCAST: ::c_int = 0x200;
398465
pub const MSG_NOSIGNAL: ::c_int = 0x400;
466+
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800;
467+
468+
pub const SCM_RIGHTS: ::c_int = 0x01;
399469

400470
pub const IFF_LOOPBACK: ::c_int = 0x8;
401471

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,50 @@ pub const F_MAXFD: ::c_int = 11;
291291
pub const IPV6_JOIN_GROUP: ::c_int = 12;
292292
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
293293

294+
pub const SOCK_CONN_DGRAM: ::c_int = 6;
295+
pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM;
296+
pub const SOCK_NOSIGPIPE: ::c_int = 0x40000000;
297+
pub const SOCK_FLAGS_MASK: ::c_int = 0xf0000000;
298+
294299
pub const SO_SNDTIMEO: ::c_int = 0x100b;
295300
pub const SO_RCVTIMEO: ::c_int = 0x100c;
301+
pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
302+
pub const SO_TIMESTAMP: ::c_int = 0x2000;
303+
pub const SO_OVERFLOWED: ::c_int = 0x1009;
304+
pub const SO_NOHEADER: ::c_int = 0x100a;
305+
306+
pub const AF_OROUTE: ::c_int = 17;
307+
pub const AF_ARP: ::c_int = 28;
308+
pub const pseudo_AF_KEY: ::c_int = 29;
309+
pub const pseudo_AF_HDRCMPLT: ::c_int = 30;
310+
pub const AF_BLUETOOTH: ::c_int = 31;
311+
pub const AF_IEEE80211: ::c_int = 32;
312+
pub const AF_MPLS: ::c_int = 33;
313+
pub const AF_ROUTE: ::c_int = 34;
314+
pub const AF_MAX: ::c_int = 35;
315+
316+
pub const NET_MAXID: ::c_int = AF_MAX;
317+
pub const NET_RT_DUMP: ::c_int = 1;
318+
pub const NET_RT_FLAGS: ::c_int = 2;
319+
pub const NET_RT_OOIFLIST: ::c_int = 3;
320+
pub const NET_RT_OIFLIST: ::c_int = 4;
321+
pub const NET_RT_IFLIST: ::c_int = 5;
322+
pub const NET_RT_MAXID: ::c_int = 6;
323+
324+
pub const PF_OROUTE: ::c_int = AF_OROUTE;
325+
pub const PF_ARP: ::c_int = AF_ARP;
326+
pub const PF_KEY: ::c_int = pseudo_AF_KEY;
327+
pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
328+
pub const PF_MPLS: ::c_int = AF_MPLS;
329+
pub const PF_ROUTE: ::c_int = AF_ROUTE;
330+
pub const PF_MAX: ::c_int = AF_MAX;
331+
332+
pub const MSG_NBIO: ::c_int = 0x1000;
333+
pub const MSG_WAITFORONE: ::c_int = 0x2000;
334+
pub const MSG_NOTIFICATION: ::c_int = 0x4000;
335+
336+
pub const SCM_TIMESTAMP: ::c_int = 0x08;
337+
pub const SCM_CREDS: ::c_int = 0x10;
296338

297339
pub const O_DSYNC : ::c_int = 0x10000;
298340

0 commit comments

Comments
 (0)