Skip to content
Implementation of 9P2000 protocol
C++ CMake Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

libstyxe C++ standard License

TravisCI Codecov Coverity Coverage Status LGTM

A library for parsing 9P2000 protocol messages.

library: a collection of types, functions, classes, etc. implementing a set of facilities (abstractions) meant to be potentially used as part of more that one program. From Cpp Code guidelines gloassay

It also includes 9P2000.e extension. To learn more about the extension please see

Using this library

To create 9P message:

The library is using Solace::ByteWriter / Solace::ByteReader to read/write byte streams. Note that this adaptors do not allocate memory. So the user is responsible for creating a buffer of appropriate size to write the resulting message to. Note that the size of the target buffer should be no more then negotiated message size for the current session.

#include <styxe/styxe.hpp>

Solace::ByteWriter buffer{...};

// Write TVersion request into the beffer
// Write TOpen request into the given destination buffer
            .open(42, styxe::OpenMode::READ));

Parsing 9P message from a byte buffer:

Parsing of 9P protocol messages differ slightly depending on if you are implementing server - expecting request type messages - or a client - parsing server responses.

Parsing requests (server side):

styxe::Parser parser{...};
Solace::ByteReader buffer{...};
    .then([&](styxe::MessageHeader&& header) {
        return parser.parseRequest(header, buffer)
    .orElse([](Error&& err) {
        std::cerr << "Error parsing request: " << err << std::endl;

Parsing response (client side):

styxe::Parser parser{...};
    .then([&](styxe::MessageHeader&& header) {
        return parser.parseResponse(header, buffer)
    .orElse([](Error&& err) {
        std::cerr << "Error parsing response: " << err << std::endl;

See examples for other example usage of this library.


This library depends on libsolace for low level data manipulation primitives such as ByteReader/ByteWriter and Result<> type. Since it is only a 9P protocol parser - there is dependency on the IO. It is library users responsibility to provide data stream.


Note test framework used is gtest and it is managed via git modules. Don't forget to do git submodule update --init --recursive on a new checkout to pull sub-module dependencies.


Build tool dependencies

In order to build this project following tools must be present in the system:

  • git (to check out project and it’s external modules, see dependencies section)
  • doxygen (for documentation)
  • cppcheck (static code analysis, latest version from git is used as part of the 'codecheck' step)
  • cpplint (for static code analysis in addition to cppcheck)
  • valgrind (for runtime code quality verification)

This project is using C++17 features extensively. The minimal tested/required version of gcc is gcc-7. CI is using clang-6 and gcc-7. To install build tools on Debian based Linux distribution:

sudo apt-get update -qq
sudo apt-get install git doxygen python-pip valgrind ggcov
sudo pip install cpplint

The library has one external dependency: libsolace which is managed via conan. Please make sure conan is installed on your system if you want to build this project.

Building the project

# In the project check-out directory:
# To build debug version with sanitizer enabled (recommended for development)
./configure --enable-debug --enable-sanitizer

# To build the library it self

# To build and run unit tests:
make test

# To run valgrind on test suit:
# Note: `valgrind` doesn’t work with ./configure --enable-sanitize option
make verify

# To build API documentation using doxygen:
make doc

To install locally for testing:

make --prefix=/user/home/<username>/test/lib install

To install system wide (as root):

make install

To run code quality check before submission of a patch:

# Verify code quality before submission
make codecheck

Contributing changes

The framework is work in progress and contributions are very welcomed. Please see for details on how to contribute to this project.

Please note that in order to maintain code quality a set of static code analysis tools is used as part of the build process. Thus all contributions must be verified by this tools before PR can be accepted.


The library available under Apache License 2.0 Please see LICENSE for details.


Please see AUTHORS file for the list of contributors.

You can’t perform that action at this time.