pf_rs/
lib.rs

1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2021 Aleksandr Morozov, RELKOM s.r.o
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 *    - Redistributions of source code must retain the above copyright
12 *      notice, this list of conditions and the following disclaimer.
13 *    - Redistributions in binary form must reproduce the above
14 *      copyright notice, this list of conditions and the following
15 *      disclaimer in the documentation and/or other materials provided
16 *      with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33//! Pf-RS
34//! 
35//! <img src="https://cdn.4neko.org/pf_1.webp" width="280"/> <img src="https://cdn.4neko.org/source_avail.webp" width="280"/> <img src="https://cdn.4neko.org/bds2_2.webp" width="280"/>
36//! 
37//! Provides a userspace interface to the /sev/pf FreeBSD port of the OpenBSD's PF
38//!
39//! Supports:
40//! - Add, Test, Delete multiple IP/IPv6/DNS
41//! - Add, Test, Delete from file (directly)
42//! - Kill state by source IP or by source and destination IP
43//! 
44//! This crate supports only FreeBSD 13.
45//!
46//! This is experimantal crate!
47//!
48//! The crate version is decoded:
49//! - major version - is a FreeBSD major version
50//! - minor version - is a FreebSd minor version
51//! - build - is a patch of the crate
52//! 
53//! Files:
54//! - pf.rs contains library code
55//! - pf_tokenizer.rs a ip/domain list parser and tokenizer
56//! - common.rs shared code
57//! - portable - all portable and shared code is there
58
59#![allow(dead_code)]
60
61extern crate nix;
62
63pub mod pf;
64mod pf_tokenizer;
65mod portable;
66mod ioctl;
67mod pfr_buffer;
68mod pfr_addr;
69mod pfr_table;
70mod lbox;
71
72#[macro_use] pub mod common;
73#[macro_use] pub mod runtime_exception;
74
75