Skip to content

Commit d7fd5ab

Browse files
authored
Add more AddressFamily constants. (#697)
1 parent f36363c commit d7fd5ab

File tree

2 files changed

+57
-20
lines changed

2 files changed

+57
-20
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ once_cell = { version = "1.5.2", optional = true }
4040
[target.'cfg(all(not(rustix_use_libc), not(miri), target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "powerpc64", target_arch = "riscv64", target_arch = "mips", target_arch = "mips64", target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64"))))'.dependencies]
4141
linux-raw-sys = { version = "0.4.3", default-features = false, features = ["general", "errno", "ioctl", "no_std"] }
4242
libc_errno = { package = "errno", version = "0.3.1", default-features = false, optional = true }
43-
libc = { version = "0.2.144", features = ["extra_traits"], optional = true }
43+
libc = { version = "0.2.146", features = ["extra_traits"], optional = true }
4444

4545
# Dependencies for platforms where only libc is supported:
4646
#
4747
# On all other Unix-family platforms, and under Miri, we always use the libc
4848
# backend, so enable its dependencies unconditionally.
4949
[target.'cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = "linux", target_endian = "little", any(target_arch = "arm", all(target_arch = "aarch64", target_pointer_width = "64"), target_arch = "powerpc64", target_arch = "riscv64", target_arch = "mips", target_arch = "mips64", target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "64")))))))'.dependencies]
5050
libc_errno = { package = "errno", version = "0.3.1", default-features = false }
51-
libc = { version = "0.2.144", features = ["extra_traits"] }
51+
libc = { version = "0.2.146", features = ["extra_traits"] }
5252

5353
# Additional dependencies for Linux with the libc backend:
5454
#
@@ -76,7 +76,7 @@ default-features = false
7676

7777
[dev-dependencies]
7878
tempfile = "3.5.0"
79-
libc = "0.2.144"
79+
libc = "0.2.146"
8080
libc_errno = { package = "errno", version = "0.3.1", default-features = false }
8181
serial_test = "2.0.0"
8282
memoffset = "0.9.0"

src/net/types.rs

Lines changed: 54 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -301,131 +301,168 @@ impl AddressFamily {
301301
/// `AF_802`
302302
#[cfg(solarish)]
303303
pub const EIGHT_ZERO_TWO: Self = Self(c::AF_802 as _);
304-
/* // fixme
304+
#[cfg(target_os = "fuchsia")]
305305
/// `AF_ALG`
306306
pub const ALG: Self = Self(c::AF_ALG as _);
307+
#[cfg(any(target_os = "freebsd", target_os = "netbsd", target_os = "nto"))]
307308
/// `AF_ARP`
308309
pub const ARP: Self = Self(c::AF_ARP as _);
309310
/// `AF_ATM`
311+
#[cfg(freebsdlike)]
310312
pub const ATM: Self = Self(c::AF_ATM as _);
311313
/// `AF_CAIF`
314+
#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia"))]
312315
pub const CAIF: Self = Self(c::AF_CAIF as _);
313316
/// `AF_CCITT`
317+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "nto"))]
314318
pub const CCITT: Self = Self(c::AF_CCITT as _);
315319
/// `AF_CHAOS`
320+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "nto"))]
316321
pub const CHAOS: Self = Self(c::AF_CHAOS as _);
317322
/// `AF_CNT`
323+
#[cfg(any(bsd, target_os = "nto"))]
318324
pub const CNT: Self = Self(c::AF_CNT as _);
319325
/// `AF_COIP`
326+
#[cfg(any(bsd, target_os = "nto"))]
320327
pub const COIP: Self = Self(c::AF_COIP as _);
321328
/// `AF_DATAKIT`
329+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "nto"))]
322330
pub const DATAKIT: Self = Self(c::AF_DATAKIT as _);
323331
/// `AF_DLI`
332+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "haiku", target_os = "nto"))]
324333
pub const DLI: Self = Self(c::AF_DLI as _);
325334
/// `AF_E164`
335+
#[cfg(any(bsd, target_os = "nto"))]
326336
pub const E164: Self = Self(c::AF_E164 as _);
327337
/// `AF_ECMA`
338+
#[cfg(any(apple, freebsdlike, solarish, target_os = "aix", target_os = "nto", target_os = "openbsd"))]
328339
pub const ECMA: Self = Self(c::AF_ECMA as _);
329340
/// `AF_ENCAP`
341+
#[cfg(target_os = "openbsd")]
330342
pub const ENCAP: Self = Self(c::AF_ENCAP as _);
331343
/// `AF_FILE`
344+
#[cfg(solarish)]
332345
pub const FILE: Self = Self(c::AF_FILE as _);
333346
/// `AF_GOSIP`
347+
#[cfg(solarish)]
334348
pub const GOSIP: Self = Self(c::AF_GOSIP as _);
335349
/// `AF_HYLINK`
350+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "nto"))]
336351
pub const HYLINK: Self = Self(c::AF_HYLINK as _);
337352
/// `AF_IB`
353+
#[cfg(any(target_os = "emscripten", target_os = "fuchsia"))]
338354
pub const IB: Self = Self(c::AF_IB as _);
339355
/// `AF_IMPLINK`
356+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "nto"))]
340357
pub const IMPLINK: Self = Self(c::AF_IMPLINK as _);
341358
/// `AF_IEEE80211`
359+
#[cfg(any(apple, freebsdlike, linuxlike, target_os = "netbsd"))]
342360
pub const IEEE80211: Self = Self(c::AF_IEEE80211 as _);
343361
/// `AF_INET6_SDP`
362+
#[cfg(target_os = "freebsd")]
344363
pub const INET6_SDP: Self = Self(c::AF_INET6_SDP as _);
345364
/// `AF_INET_OFFLOAD`
365+
#[cfg(solarish)]
346366
pub const INET_OFFLOAD: Self = Self(c::AF_INET_OFFLOAD as _);
347367
/// `AF_INET_SDP`
368+
#[cfg(target_os = "freebsd")]
348369
pub const INET_SDP: Self = Self(c::AF_INET_SDP as _);
349370
/// `AF_INTF`
371+
#[cfg(target_os = "aix")]
350372
pub const INTF: Self = Self(c::AF_INTF as _);
351373
/// `AF_ISO`
374+
#[cfg(any(bsd, target_os = "aix", target_os = "nto"))]
352375
pub const ISO: Self = Self(c::AF_ISO as _);
353-
/// `AF_KCM`
354-
pub const KCM: Self = Self(c::AF_KCM as _);
355376
/// `AF_LAT`
377+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "nto"))]
356378
pub const LAT: Self = Self(c::AF_LAT as _);
357379
/// `AF_LINK`
380+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "haiku", target_os = "nto"))]
358381
pub const LINK: Self = Self(c::AF_LINK as _);
359-
/// `AF_LOCAL`
360-
pub const LOCAL: Self = Self(c::AF_LOCAL as _);
361-
/// `AF_MIPC`
362-
pub const MIPC: Self = Self(c::AF_MIPC as _);
363-
/// `AF_MIPC_SAFE`
364-
pub const MIPC_SAFE: Self = Self(c::AF_MIPC_SAFE as _);
365382
/// `AF_MPLS`
383+
#[cfg(any(netbsdlike, target_os = "dragonfly", target_os = "emscripten", target_os = "fuchsia"))]
366384
pub const MPLS: Self = Self(c::AF_MPLS as _);
367385
/// `AF_NATM`
386+
#[cfg(any(bsd, target_os = "aix", target_os = "nto"))]
368387
pub const NATM: Self = Self(c::AF_NATM as _);
369388
/// `AF_NBS`
389+
#[cfg(solarish)]
370390
pub const NBS: Self = Self(c::AF_NBS as _);
371391
/// `AF_NCA`
392+
#[cfg(solarish)]
372393
pub const NCA: Self = Self(c::AF_NCA as _);
373394
/// `AF_NDD`
395+
#[cfg(target_os = "aix")]
374396
pub const NDD: Self = Self(c::AF_NDD as _);
375397
/// `AF_NDRV`
398+
#[cfg(apple)]
376399
pub const NDRV: Self = Self(c::AF_NDRV as _);
377400
/// `AF_NETBIOS`
401+
#[cfg(any(apple, freebsdlike))]
378402
pub const NETBIOS: Self = Self(c::AF_NETBIOS as _);
379403
/// `AF_NETGRAPH`
404+
#[cfg(freebsdlike)]
380405
pub const NETGRAPH: Self = Self(c::AF_NETGRAPH as _);
381406
/// `AF_NIT`
407+
#[cfg(solarish)]
382408
pub const NIT: Self = Self(c::AF_NIT as _);
383409
/// `AF_NOTIFY`
410+
#[cfg(target_os = "haiku")]
384411
pub const NOTIFY: Self = Self(c::AF_NOTIFY as _);
385412
/// `AF_NFC`
413+
#[cfg(any(target_os = "emscripten", target_os = "fuchsia"))]
386414
pub const NFC: Self = Self(c::AF_NFC as _);
387415
/// `AF_NS`
416+
#[cfg(any(apple, solarish, netbsdlike, target_os = "aix", target_os = "nto"))]
388417
pub const NS: Self = Self(c::AF_NS as _);
389418
/// `AF_OROUTE`
419+
#[cfg(target_os = "netbsd")]
390420
pub const OROUTE: Self = Self(c::AF_OROUTE as _);
391421
/// `AF_OSI`
422+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "nto"))]
392423
pub const OSI: Self = Self(c::AF_OSI as _);
393424
/// `AF_OSINET`
425+
#[cfg(solarish)]
394426
pub const OSINET: Self = Self(c::AF_OSINET as _);
395427
/// `AF_POLICY`
428+
#[cfg(solarish)]
396429
pub const POLICY: Self = Self(c::AF_POLICY as _);
397430
/// `AF_PPP`
431+
#[cfg(apple)]
398432
pub const PPP: Self = Self(c::AF_PPP as _);
399433
/// `AF_PUP`
434+
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "nto"))]
400435
pub const PUP: Self = Self(c::AF_PUP as _);
401-
/// `AF_QIPCRTR`
402-
pub const QIPCRTR: Self = Self(c::AF_QIPCRTR as _);
403436
/// `AF_RIF`
437+
#[cfg(target_os = "aix")]
404438
pub const RIF: Self = Self(c::AF_RIF as _);
405439
/// `AF_ROUTE`
440+
#[cfg(any(bsd, solarish, target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "haiku", target_os = "nto"))]
406441
pub const ROUTE: Self = Self(c::AF_ROUTE as _);
407442
/// `AF_SCLUSTER`
443+
#[cfg(target_os = "freebsd")]
408444
pub const SCLUSTER: Self = Self(c::AF_SCLUSTER as _);
409445
/// `AF_SIP`
446+
#[cfg(any(apple, target_os = "freebsd", target_os = "opensbd"))]
410447
pub const SIP: Self = Self(c::AF_SIP as _);
411448
/// `AF_SLOW`
449+
#[cfg(target_os = "freebsd")]
412450
pub const SLOW: Self = Self(c::AF_SLOW as _);
413-
/// `AF_SOCKDEV`
414-
pub const SOCKDEV: Self = Self(c::AF_SOCKDEV as _);
415451
/// `AF_SYS_CONTROL`
452+
#[cfg(apple)]
416453
pub const SYS_CONTROL: Self = Self(c::AF_SYS_CONTROL as _);
417454
/// `AF_SYSTEM`
455+
#[cfg(apple)]
418456
pub const SYSTEM: Self = Self(c::AF_SYSTEM as _);
419457
/// `AF_TRILL`
458+
#[cfg(solarish)]
420459
pub const TRILL: Self = Self(c::AF_TRILL as _);
421460
/// `AF_UTUN`
461+
#[cfg(apple)]
422462
pub const UTUN: Self = Self(c::AF_UTUN as _);
423463
/// `AF_VSOCK`
464+
#[cfg(any(apple, target_os = "emscripten", target_os = "fuchsia"))]
424465
pub const VSOCK: Self = Self(c::AF_VSOCK as _);
425-
/// `AF_XDP`
426-
pub const XDP: Self = Self(c::AF_XDP as _);
427-
*/
428-
429466

430467
/// Constructs a `AddressFamily` from a raw integer.
431468
#[inline]

0 commit comments

Comments
 (0)