feat: fixed pcap linking and added nix packages
This commit is contained in:
@@ -17,15 +17,18 @@
|
||||
name = "pcap-sys"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "AGPL-3.0-only"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
errno = "0.3.10"
|
||||
futures = "0.3.25"
|
||||
libc = "0.2.169"
|
||||
tokio = { version = "1.21.2", features = ["net", "rt", "macros", "rt-multi-thread" ] }
|
||||
tokio = { version = "1.21.2", features = [
|
||||
"net",
|
||||
"rt",
|
||||
"macros",
|
||||
"rt-multi-thread",
|
||||
] }
|
||||
tokio-stream = "0.1.14"
|
||||
packets = { path = "../packets" }
|
||||
|
||||
[build-dependencies]
|
||||
cmake = "0.1"
|
||||
fs_extra = "1.3.0"
|
||||
|
||||
@@ -13,10 +13,8 @@
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use fs_extra::dir::{copy, CopyOptions};
|
||||
|
||||
fn main() {
|
||||
include!("../build_freebsd.rs");
|
||||
include!("../build_common.rs");
|
||||
|
||||
if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "windows" {
|
||||
let libdir = std::env::var("SPARSE_BUILD_WINPCAP_LIBS").unwrap();
|
||||
@@ -27,8 +25,12 @@ fn main() {
|
||||
let libdir = std::env::var("SPARSE_BUILD_LIBPCAP_FREEBSD").unwrap();
|
||||
println!("cargo:rustc-link-search=native={libdir}/lib");
|
||||
println!("cargo:rustc-link-lib=static=pcap");
|
||||
} else {
|
||||
let libdir = std::env::var("SPARSE_BUILD_LIBPCAP_LINUX").unwrap();
|
||||
} else if std::env::var("CARGO_CFG_TARGET_ENV").unwrap() == "musl" {
|
||||
let libdir = std::env::var("SPARSE_BUILD_LIBPCAP_LINUX_MUSL").unwrap();
|
||||
println!("cargo:rustc-link-search=native={libdir}/lib");
|
||||
println!("cargo:rustc-link-lib=static=pcap");
|
||||
} else if std::env::var("CARGO_CFG_TARGET_ENV").unwrap() == "gnu" {
|
||||
let libdir = std::env::var("SPARSE_BUILD_LIBPCAP_LINUX_GNU").unwrap();
|
||||
println!("cargo:rustc-link-search=native={libdir}/lib");
|
||||
println!("cargo:rustc-link-lib=static=pcap");
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
use std::{
|
||||
ffi::{CStr, CString},
|
||||
ptr, slice
|
||||
ptr, slice,
|
||||
};
|
||||
|
||||
pub mod error;
|
||||
@@ -410,7 +410,9 @@ impl<T: NotListening> Interface<T> {
|
||||
|
||||
Ok(stream::InterfaceStream {
|
||||
inner: tokio::io::unix::AsyncFd::with_interest(
|
||||
stream::InternalInterfaceStream::<DevActivated>::new(unsafe { std::mem::transmute(self) })?,
|
||||
stream::InternalInterfaceStream::<DevActivated>::new(unsafe {
|
||||
std::mem::transmute(self)
|
||||
})?,
|
||||
tokio::io::Interest::READABLE,
|
||||
)?,
|
||||
})
|
||||
|
||||
@@ -24,7 +24,10 @@ use futures::{ready, StreamExt};
|
||||
use tokio::io::unix::AsyncFd;
|
||||
use tokio_stream::StreamMap;
|
||||
|
||||
use super::{error, ffi, packets, Activated, NotListening, Disabled, State, Interface, DevActivated, DevDisabled, PcapDevIterator};
|
||||
use super::{
|
||||
error, ffi, packets, Activated, DevActivated, DevDisabled, Disabled, Interface, NotListening,
|
||||
PcapDevIterator, State,
|
||||
};
|
||||
|
||||
pub(crate) struct InternalInterfaceStream<T: Activated> {
|
||||
interface: Interface<T>,
|
||||
|
||||
Reference in New Issue
Block a user