MCPcopy Index your code
hub / github.com/capsule-rs/capsule

github.com/capsule-rs/capsule @v0.1.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.5 ↗ · + Follow
2,232 symbols 4,448 edges 91 files 196 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Crates.io Documentation Apache-2.0 licensed CI-Github Actions Codecov Code of Conduct Discord

Capsule

A framework for network function development. Written in Rust, inspired by NetBricks and built on Intel's Data Plane Development Kit.

Table of Contents

Overview

The goal of Capsule is to offer an ergonomic framework for network function development that traditionally has high barriers of entry for developers. We've created a tool to efficiently manipulate network packets while being type-safe, memory-safe, and thread-safe. Building on DPDK and Rust, Capsule offers

  • a fast packet processor that uses minimum number of CPU cycles.
  • a rich packet type system that guarantees memory-safety and thread-safety.
  • a declarative programming model that emphasizes simplicity.
  • an extendable and testable framework that is easy to develop and maintain.

Quick Start

The easiest way to start developing Capsule applications is to use the Vagrant virtual machine and the Docker sandbox provided by our team. The sandbox is preconfigured with all the necessary tools and libraries for Capsule development, including:

First install Vagrant and VirtualBox on your system. Also install the following Vagrant plugins,

host$ vagrant plugin install vagrant-reload vagrant-disksize vagrant-vbguest

Then clone our sandbox repository, start and ssh into the Vagrant VM,

host$ git clone https://github.com/capsule-rs/sandbox.git
host$ cd sandbox
host$ vagrant up
host$ vagrant ssh

Once inside the created Debian VM with Docker installed, run the sandbox with the command,

vagrant$ docker run -it --rm \
    --privileged \
    --network=host \
    --name sandbox \
    --cap-add=SYS_PTRACE \
    --security-opt seccomp=unconfined \
    -v /lib/modules:/lib/modules \
    -v /dev/hugepages:/dev/hugepages \
    getcapsule/sandbox:19.11.6-1.50 /bin/bash

Remember to also mount the working directory of your project as a volume for the sandbox. Then you can use Cargo commands inside the container as normal.

Add Capsule as a dependency to your Cargo.toml and start writing your application,

[dependencies]
capsule = "0.1"

If you want to develop Capsule without using Docker in Vagrant, please check out our sandbox repo for instructions on running our Vagrant VM environment, as well as others options not using either Vagrant or Docker.

Contributing

Thanks for your help improving the project! We have a contributing guide to help you get involved with the Capsule project.

Code of Conduct

This project and everyone participating in it are governed by the Capsule Code Of Conduct. By participating, you agree to this Code. Please report any violations to the code of conduct to capsule-dev@googlegroups.com.

Contact

You can contact us either through Discord or email.

Maintainers

The current maintainers with roles to merge PRs are:

Read More About Capsule

License

This project is licensed under the Apache-2.0 license.

Extension points exported contracts — how you extend this code

SizeOf (Interface)
A trait for returning the size of a type in bytes. Size of the structs are used for bound checks when reading and writi [8 …
core/src/dpdk/mbuf.rs
Icmpv6Message (Interface)
A trait all ICMPv6 messages must implement. The trait is used for conversion between the generic [ICMPv6] packet and th [10 …
core/src/packets/icmp/v6/mod.rs
Batch (Interface)
Common behaviors to apply on batches of packets. [10 implementers]
core/src/batch/mod.rs
NdpPacket (Interface)
A trait for common NDP accessors. [5 implementers]
core/src/packets/icmp/v6/ndp/mod.rs
Packet (Interface)
(no doc) [11 implementers]
core/src/packets/mod.rs

Core symbols most depended-on inside this repo

set
called by 204
ffi/src/bindings_rustdoc.rs
get
called by 104
ffi/src/bindings_rustdoc.rs
map
called by 66
core/src/batch/mod.rs
payload_offset
called by 61
core/src/packets/mod.rs
finish
called by 56
core/src/dpdk/kni.rs
len
called by 54
core/src/packets/mod.rs
mbuf
called by 41
core/src/packets/mod.rs
mbuf_mut
called by 40
core/src/packets/mod.rs

Shape

Method 1,116
Function 633
Class 448
Interface 22
Enum 13

Languages

Rust100%
C1%
C++1%

Modules by API surface

ffi/src/bindings_rustdoc.rs796 symbols
core/src/packets/tcp.rs71 symbols
core/src/packets/ip/v4.rs56 symbols
core/src/dpdk/mbuf.rs52 symbols
core/src/packets/ip/v6/srh.rs44 symbols
core/src/packets/ip/v6/mod.rs43 symbols
core/src/packets/ethernet.rs43 symbols
core/src/packets/arp.rs43 symbols
core/src/packets/ip/v6/fragment.rs37 symbols
core/src/batch/mod.rs36 symbols
core/src/packets/icmp/v6/ndp/mod.rs35 symbols
core/src/packets/udp.rs34 symbols

For agents

$ claude mcp add capsule \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page