Struct aya::programs::SocketFilter [−][src]
pub struct SocketFilter { /* fields omitted */ }
Expand description
A program used to inspect and filter incoming packets on a socket.
SocketFilter
programs are attached on sockets and can be used to inspect
and filter incoming packets.
Minimum kernel version
The minimum kernel version required to use this feature is 4.0.
Examples
use std::convert::TryInto;
use std::net::TcpStream;
use std::os::unix::io::AsRawFd;
use aya::programs::SocketFilter;
let mut client = TcpStream::connect("127.0.0.1:1234")?;
let prog: &mut SocketFilter = bpf.program_mut("filter_packets")?.try_into()?;
prog.load()?;
prog.attach(client.as_raw_fd())?;
Implementations
Loads the program inside the kernel.
See also Program::load
.
Trait Implementations
type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
Performs the conversion.
type Error = ProgramError
type Error = ProgramError
The type returned in the event of a conversion error.
Performs the conversion.