vpp_plugin/lib.rs
1#![warn(
2 missing_docs,
3 missing_copy_implementations,
4 clippy::undocumented_unsafe_blocks
5)]
6#![cfg_attr(docsrs, feature(doc_cfg))]
7
8//! # Framework for writing high-performance VPP plugins in Rust
9//!
10//! [VPP](https://wiki.fd.io/view/VPP/What_is_VPP%3F) is a high performance packet processing
11//! with support for a large number of features, and enables writing plugins to extend its
12//! functionality.
13//!
14//! This crate provides the core functionality for writing VPP plugins in Rust. It includes
15//! bindings to the VPP C API, as well as abstractions for writing VPP nodes, with the goal of
16//! having performance parity with C plugins for fast path packet processing.
17//!
18//! # Features
19//!
20//! The following features are available:
21//! - `process-node`: Enables infrastructure for using process nodes (using async/await) in VPP
22//! plugins.
23//! - `experimental`: Used for functionality and types that aren't tested or are not part of the
24//! stable API yet as aspects of them might still be under consideration. APIs conditional on
25//! this feature may be added, changed or removed without the semantic versioning reflecting
26//! this.
27
28pub mod bindings;
29#[doc(hidden)]
30pub mod macro_support;
31pub mod vlib;
32pub mod vlibapi;
33pub mod vnet;
34pub mod vppinfra;
35
36// Re-export macros for convenience
37#[cfg(feature = "process-node")]
38pub use vpp_plugin_macros::vlib_process_node;
39pub use vpp_plugin_macros::{
40 ErrorCounters, NextNodes, vlib_cli_command, vlib_init_function, vlib_node,
41 vlib_plugin_register, vnet_feature_init,
42};
43
44/// Re-exported for use by code generated by vpp-plugin-api-gen
45pub extern crate bitflags;
46
47/// `VPP_BUILD_VER` of the VPP whose headers this crate was built against.
48///
49/// Intended for `vlib_plugin_register!`'s `version_required`. VPP's loader compares by prefix: it
50/// refuses the plugin unless its own build version *starts with* this string, so a build whose
51/// version merely extends it (e.g. `26.06-release-octeon9` for a plugin built against
52/// `26.06-release`) still loads it. A plugin that needs the exact build can also compare this
53/// with the running VPP's `vlib_plugin_app_version` at init. Empty when the crate was built from
54/// the pre-generated bindings (no VPP headers available), which VPP treats as no requirement.
55pub const VPP_BUILD_VER: &str = env!("VPP_PLUGIN_VPP_BUILD_VER");