Merge pull request #281 from dave-tucker/export

aya: Export program modules
pull/283/head
Dave Tucker 3 years ago committed by GitHub
commit 7d8365c351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,4 @@
//! Cgroup skb programs.
use std::{ use std::{
hash::Hash, hash::Hash,
os::unix::prelude::{AsRawFd, RawFd}, os::unix::prelude::{AsRawFd, RawFd},

@ -1,3 +1,4 @@
//! Cgroup socket address programs.
use thiserror::Error; use thiserror::Error;
use crate::generated::bpf_attach_type; use crate::generated::bpf_attach_type;

@ -1,3 +1,4 @@
//! Cgroup socket option programs.
use thiserror::Error; use thiserror::Error;
use std::{ use std::{

@ -1,3 +1,4 @@
//! Cgroup sysctl programs.
use std::{ use std::{
hash::Hash, hash::Hash,
os::unix::prelude::{AsRawFd, RawFd}, os::unix::prelude::{AsRawFd, RawFd},

@ -1,3 +1,4 @@
//! Extension programs.
use std::os::unix::prelude::{AsRawFd, RawFd}; use std::os::unix::prelude::{AsRawFd, RawFd};
use thiserror::Error; use thiserror::Error;

@ -1,4 +1,4 @@
//! fentry programs. //! Fentry programs.
use crate::{ use crate::{
generated::{bpf_attach_type::BPF_TRACE_FENTRY, bpf_prog_type::BPF_PROG_TYPE_TRACING}, generated::{bpf_attach_type::BPF_TRACE_FENTRY, bpf_prog_type::BPF_PROG_TYPE_TRACING},

@ -1,4 +1,4 @@
//! fexit programs. //! Fexit programs.
use crate::{ use crate::{
generated::{bpf_attach_type::BPF_TRACE_FEXIT, bpf_prog_type::BPF_PROG_TYPE_TRACING}, generated::{bpf_attach_type::BPF_TRACE_FEXIT, bpf_prog_type::BPF_PROG_TYPE_TRACING},

@ -1,3 +1,4 @@
//! Program links.
use libc::{close, dup}; use libc::{close, dup};
use std::{ use std::{
@ -9,7 +10,7 @@ use std::{
use crate::{generated::bpf_attach_type, programs::ProgramError, sys::bpf_prog_detach}; use crate::{generated::bpf_attach_type, programs::ProgramError, sys::bpf_prog_detach};
/// A Link /// A Link.
pub trait Link: std::fmt::Debug + 'static { pub trait Link: std::fmt::Debug + 'static {
/// Unique Id /// Unique Id
type Id: std::fmt::Debug + std::hash::Hash + Eq + PartialEq; type Id: std::fmt::Debug + std::hash::Hash + Eq + PartialEq;
@ -91,11 +92,13 @@ impl<T: Link> Drop for LinkMap<T> {
} }
} }
/// The identifier of an `FdLink`.
#[derive(Debug, Hash, Eq, PartialEq)] #[derive(Debug, Hash, Eq, PartialEq)]
pub(crate) struct FdLinkId(pub(crate) RawFd); pub struct FdLinkId(pub(crate) RawFd);
/// A file descriptor link.
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct FdLink { pub struct FdLink {
pub(crate) fd: RawFd, pub(crate) fd: RawFd,
} }
@ -118,11 +121,13 @@ impl Link for FdLink {
} }
} }
/// The identifier of a `ProgAttachLink`.
#[derive(Debug, Hash, Eq, PartialEq)] #[derive(Debug, Hash, Eq, PartialEq)]
pub(crate) struct ProgAttachLinkId(RawFd, RawFd, bpf_attach_type); pub struct ProgAttachLinkId(RawFd, RawFd, bpf_attach_type);
/// The Link type used by programs that are attached with `bpf_prog_attach`.
#[derive(Debug)] #[derive(Debug)]
pub(crate) struct ProgAttachLink { pub struct ProgAttachLink {
prog_fd: RawFd, prog_fd: RawFd,
target_fd: RawFd, target_fd: RawFd,
attach_type: bpf_attach_type, attach_type: bpf_attach_type,

@ -1,3 +1,4 @@
//! Lirc programs.
use std::os::unix::prelude::{AsRawFd, RawFd}; use std::os::unix::prelude::{AsRawFd, RawFd};
use crate::{ use crate::{

@ -36,31 +36,31 @@
//! [`Bpf::program`]: crate::Bpf::program //! [`Bpf::program`]: crate::Bpf::program
//! [`Bpf::program_mut`]: crate::Bpf::program_mut //! [`Bpf::program_mut`]: crate::Bpf::program_mut
//! [`maps`]: crate::maps //! [`maps`]: crate::maps
mod cgroup_skb; pub mod cgroup_skb;
mod cgroup_sock_addr; pub mod cgroup_sock_addr;
mod cgroup_sockopt; pub mod cgroup_sockopt;
mod cgroup_sysctl; pub mod cgroup_sysctl;
mod extension; pub mod extension;
mod fentry; pub mod fentry;
mod fexit; pub mod fexit;
mod kprobe; pub mod kprobe;
mod links; pub mod links;
mod lirc_mode2; pub mod lirc_mode2;
mod lsm; pub mod lsm;
mod perf_attach; pub mod perf_attach;
pub mod perf_event; pub mod perf_event;
mod probe; mod probe;
mod raw_trace_point; pub mod raw_trace_point;
mod sk_msg; pub mod sk_msg;
mod sk_skb; pub mod sk_skb;
mod sock_ops; pub mod sock_ops;
mod socket_filter; pub mod socket_filter;
pub mod tc; pub mod tc;
mod tp_btf; pub mod tp_btf;
mod trace_point; pub mod trace_point;
mod uprobe; pub mod uprobe;
mod utils; mod utils;
mod xdp; pub mod xdp;
use libc::ENOSPC; use libc::ENOSPC;
use std::{ use std::{

@ -1,3 +1,4 @@
//! Perf attach links.
use libc::close; use libc::close;
use std::os::unix::io::RawFd; use std::os::unix::io::RawFd;
@ -7,9 +8,11 @@ use crate::{
PERF_EVENT_IOC_DISABLE, PERF_EVENT_IOC_ENABLE, PERF_EVENT_IOC_SET_BPF, PERF_EVENT_IOC_DISABLE, PERF_EVENT_IOC_ENABLE, PERF_EVENT_IOC_SET_BPF,
}; };
/// The identifer of a PerfLink.
#[derive(Debug, Hash, Eq, PartialEq)] #[derive(Debug, Hash, Eq, PartialEq)]
pub struct PerfLinkId(RawFd); pub struct PerfLinkId(RawFd);
/// The attachment type of PerfEvent programs.
#[derive(Debug)] #[derive(Debug)]
pub struct PerfLink { pub struct PerfLink {
perf_fd: RawFd, perf_fd: RawFd,

@ -1,3 +1,4 @@
//! Skmsg programs.
use crate::{ use crate::{
generated::{bpf_attach_type::BPF_SK_MSG_VERDICT, bpf_prog_type::BPF_PROG_TYPE_SK_MSG}, generated::{bpf_attach_type::BPF_SK_MSG_VERDICT, bpf_prog_type::BPF_PROG_TYPE_SK_MSG},
maps::sock::SocketMap, maps::sock::SocketMap,

@ -1,3 +1,4 @@
//! Skskb programs.
use crate::{ use crate::{
generated::{ generated::{
bpf_attach_type::{BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT}, bpf_attach_type::{BPF_SK_SKB_STREAM_PARSER, BPF_SK_SKB_STREAM_VERDICT},

@ -1,3 +1,4 @@
//! Socket option programs.
use std::os::unix::io::AsRawFd; use std::os::unix::io::AsRawFd;
use crate::{ use crate::{

@ -1,3 +1,4 @@
//! Socket filter programs.
use libc::{setsockopt, SOL_SOCKET}; use libc::{setsockopt, SOL_SOCKET};
use std::{ use std::{
io, mem, io, mem,

@ -1,3 +1,4 @@
//! Tracepoint programs.
use std::{fs, io}; use std::{fs, io};
use thiserror::Error; use thiserror::Error;

@ -1,3 +1,4 @@
//! eXpress Data Path (XDP) programs.
use bitflags; use bitflags;
use libc::if_nametoindex; use libc::if_nametoindex;
use std::{ffi::CString, hash::Hash, io, os::unix::io::RawFd}; use std::{ffi::CString, hash::Hash, io, os::unix::io::RawFd};

Loading…
Cancel
Save