vpp-plugin 0.3.0

A framework for writing high-performance, reliable VPP plugins in Rust.
Documentation
#![warn(
    missing_docs,
    missing_copy_implementations,
    clippy::undocumented_unsafe_blocks
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

//! # Framework for writing high-performance VPP plugins in Rust
//!
//! [VPP](https://wiki.fd.io/view/VPP/What_is_VPP%3F) is a high performance packet processing
//! with support for a large number of features, and enables writing plugins to extend its
//! functionality.
//!
//! This crate provides the core functionality for writing VPP plugins in Rust. It includes
//! bindings to the VPP C API, as well as abstractions for writing VPP nodes, with the goal of
//! having performance parity with C plugins for fast path packet processing.
//!
//! # Features
//!
//! The following features are available:
//! - `process-node`: Enables infrastructure for using process nodes (using async/await) in VPP
//!   plugins.
//! - `experimental`: Used for functionality and types that aren't tested or are not part of the
//!   stable API yet as aspects of them might still be under consideration. APIs conditional on
//!   this feature may be added, changed or removed without the semantic versioning reflecting
//!   this.

pub mod bindings;
#[doc(hidden)]
pub mod macro_support;
pub mod vlib;
pub mod vlibapi;
pub mod vnet;
pub mod vppinfra;

// Re-export macros for convenience
#[cfg(feature = "process-node")]
pub use vpp_plugin_macros::vlib_process_node;
pub use vpp_plugin_macros::{
    ErrorCounters, NextNodes, vlib_cli_command, vlib_init_function, vlib_node,
    vlib_plugin_register, vnet_feature_init,
};

/// Re-exported for use by code generated by vpp-plugin-api-gen
pub extern crate bitflags;

/// `VPP_BUILD_VER` of the VPP whose headers this crate was built against.
///
/// Intended for `vlib_plugin_register!`'s `version_required`. VPP's loader compares by prefix: it
/// refuses the plugin unless its own build version *starts with* this string, so a build whose
/// version merely extends it (e.g. `26.06-release-octeon9` for a plugin built against
/// `26.06-release`) still loads it. A plugin that needs the exact build can also compare this
/// with the running VPP's `vlib_plugin_app_version` at init. Empty when the crate was built from
/// the pre-generated bindings (no VPP headers available), which VPP treats as no requirement.
pub const VPP_BUILD_VER: &str = env!("VPP_PLUGIN_VPP_BUILD_VER");