Skip to content

Commit ea922cc

Browse files
authored
Merge pull request #41 from drrlvn/patch-1
Add packet domain (AF_PACKET)
2 parents b07cae6 + 386e6d5 commit ea922cc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/socket.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,15 @@ impl Domain {
798798
pub fn unix() -> Domain {
799799
Domain(c::AF_UNIX)
800800
}
801+
802+
/// Domain for low-level packet interface, corresponding to `AF_PACKET`.
803+
///
804+
/// This function is only available on Linux when the `unix` feature is
805+
/// activated.
806+
#[cfg(all(unix, feature = "unix", target_os = "linux"))]
807+
pub fn packet() -> Domain {
808+
Domain(c::AF_PACKET)
809+
}
801810
}
802811

803812
impl From<i32> for Domain {

0 commit comments

Comments
 (0)