Giter Site home page Giter Site logo

eoan-ermine / tftp_common Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 1.65 MB

A simple header-only Trivial File Transfer Protocol (TFTP) packets parsing and serialization library

Home Page: https://eoanermine.com/tftp_common/

License: The Unlicense

C++ 85.34% CMake 12.56% Meson 0.74% Python 1.37%
header-only tftp tftp-protocol

tftp_common's Introduction

TFTP Common

A simple header-only Trivial File Transfer Protocol (TFTP) packets parsing and serialization library.

RFC 1350 (TFTP Protocol Revision 2) compilant, RFC 2347 (TFTP Option Extension) support.

C++ Standard

Supported platforms

Platform name Windows Linux MacOS
Minimum required version 98 --- ---

Dependencies

Dependency name Minimum required version Ubuntu 22.04
C++ C++17 sudo apt-get install build-essential
Doxygen (optional) --- sudo apt-get install doxygen
ClangFormat (development, optional) --- sudo apt-get install clang-format

Quick start

  1. Download and install CMake. Version 3.12.0 is the minimum required.
  2. Open a shell. Your development tools must be reachable from this shell through the PATH environment variable.
  3. Create a build directory, go to this directory:
mkdir build
cd build
  1. Execute this command in the shell replacing path/to/tftp_common/source/root with the path to the root of your tftp_common source tree:
cmake path/to/tftp_common/source/root
  1. After CMake has finished running, proceed to use IDE project files, or start the build from the build directory:
cmake --build .

The --build option tells cmake to invoke the underlying build tool (make, ninja, xcodebuild, msbuild, etc.)

The underlying build tool can be invoked directly, of course, but the --build option is portable.

  1. After tftp_common has finished building, install it from the build directory:
cmake --build . --target install

The --target option with install parameter in addition to the --build option tells cmake to build the install target.

Options and variables

Variables customize how the build will be generated. Options are boolean variables, with possible values ON/OFF. Options and variables are defined on the CMake command line like this:

cmake -DVARIABLE=value path/to/tftp_common/source

CMake variables

  • BUILD_TESTS: BOOL

Adds test build targets as a dependencies of the default build target. Defaults to OFF.

  • BUILD_EXAMPLES: BOOL

Adds examples build targets as a dependencies of the default build target. Defaults to OFF.

CMake targets

  • The format target (i.e ninja format) will run clang-format on all project files
  • The check-format target (i.e ninja check-format) will verify that project's code follows formatting conventions
  • The docs target (i.e ninja docs) will generate documentation using doxygen

tftp_common's People

Contributors

eoan-ermine avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

tftp_common's Issues

Build packages

As soon as we have stable release, we should build deb, rpm packages and release it somehow.

Make parse functions free

There actually no state in parser class. Current step can be stored as local variable in every parse function.

Change signature of parse methods

Return all arguments by value, for example, with something like this:

struct ParseResult {
    bool success;
    size_t bytes_read;
};

With all methods to support structured bindings.

Absence of no-options rvalue constructor in request class

Request(Type Type, std::string_view Filename, std::string_view Mode)
: Type_(Type), Filename(Filename.begin(), Filename.end() + 1), Mode(Mode.begin(), Mode.end() + 1) {
assert(Type == Type::ReadRequest || Type == Type::WriteRequest);
assert(Filename[Filename.size()] == '\0');
assert(Mode[Mode.size()] == '\0');
}
Request(Type Type, std::string_view Filename, std::string_view Mode, const std::vector<std::string> &OptionsNames,
const std::vector<std::string> &OptionsValues)
: Request(Type, Filename, Mode) {
this->OptionsNames = OptionsNames;
this->OptionsValues = OptionsValues;
}
Request(Type Type, std::string &&Filename, std::string &&Mode, std::vector<std::string> &&OptionsNames,
std::vector<std::string> &&OptionsValues)
: Type_(Type), Filename(std::make_move_iterator(Filename.begin()), std::make_move_iterator(Filename.end())),
Mode(std::make_move_iterator(Mode.begin()), std::make_move_iterator(Mode.end())),
OptionsNames(std::move(OptionsNames)), OptionsValues(std::move(OptionsValues)) {}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.