Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
Prepare for tagging first public release (#11)
Browse files Browse the repository at this point in the history
* README.md: use shields.io for badges

* README.md: fix appveyor badge

* README.md: further fix appveyor badge

* CMakeLists.txt: install in a nested location

Since this library is meant to be used by MK only, it does not make
much sense to install it in an easily reachable location.

* libndt.hpp: bump patch version so we can tag

* README.md: provide info on the repository

* Tweak wording

* Tweak wording

* Tweak wording
  • Loading branch information
bassosimone authored May 13, 2018
1 parent 5d04324 commit af3cdac
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ install(
TARGETS
ndt
DESTINATION
lib
lib/measurement_kit/
)
if("${WIN32}" OR "${MINGW}")
target_link_libraries(ndt ws2_32 "${_EXTRA_LIBS}")
Expand Down
105 changes: 103 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,106 @@
# Measurement Kit NDT engine

[![Build Status](https://travis-ci.org/measurement-kit/libndt.svg?branch=master)](https://travis-ci.org/measurement-kit/libndt) [![Coverage Status](https://coveralls.io/repos/github/measurement-kit/libndt/badge.svg?branch=master)](https://coveralls.io/github/measurement-kit/libndt?branch=master) [![Build status](https://ci.appveyor.com/api/projects/status/3m2tt3ru8qbhck2w/branch/master?svg=true)](https://ci.appveyor.com/project/bassosimone/libndt/branch/master)
[![GitHub license](https://img.shields.io/github/license/measurement-kit/libndt.svg)](https://raw.githubusercontent.com/measurement-kit/libndt/master/LICENSE) [![Github Releases](https://img.shields.io/github/release/measurement-kit/libndt.svg)](https://github.com/measurement-kit/libndt/releases) [![Build Status](https://img.shields.io/travis/measurement-kit/libndt/master.svg)](https://travis-ci.org/measurement-kit/libndt) [![Coverage Status](https://img.shields.io/coveralls/measurement-kit/libndt/master.svg)](https://coveralls.io/github/measurement-kit/libndt?branch=master) [![Build status](https://img.shields.io/appveyor/ci/bassosimone/libndt/master.svg)](https://ci.appveyor.com/project/bassosimone/libndt/branch/master)

Still experimental code. Do not use.
This repository compiles a NDT engine that is meant to be integrated into
the build of Measurement Kit.

## Synopsis

```C++
#include "libndt.hpp"

namespace measurement_kit {
namespace libndt {

constexpr uint64_t api_major = 0;
constexpr uint64_t api_minor = 20;
constexpr uint64_t api_patch = 1;

constexpr uint8_t nettest_middlebox = 1 << 0;
constexpr uint8_t nettest_upload = 1 << 1;
constexpr uint8_t nettest_download = 1 << 2;
constexpr uint8_t nettest_simple_firewall = 1 << 3;
constexpr uint8_t nettest_status = 1 << 4;
constexpr uint8_t nettest_meta = 1 << 5;
constexpr uint8_t nettest_upload_ext = 1 << 6;
constexpr uint8_t nettest_download_ext = 1 << 7;

constexpr const char *ndt_version_compat = "v3.7.0";

constexpr uint64_t verbosity_quiet = 0;
constexpr uint64_t verbosity_warning = 1;
constexpr uint64_t verbosity_info = 2;
constexpr uint64_t verbosity_debug = 3;

constexpr double default_max_runtime = 14.0 /* seconds */;

enum class NdtProtocol {
proto_legacy = 0,
proto_json = 1
};

class NdtSettings {
public:
std::string mlabns_url = "https://mlab-ns.appspot.com/ndt";
long curl_timeout = 3 /* seconds */;
std::string hostname;
std::string port = "3001";
uint8_t test_suite = 0;
uint64_t verbosity = verbosity_info;
std::map<std::string, std::string> metadata{
{"client.version", ndt_version_compat},
{"client.application", "measurement-kit/libndt"},
};
NdtProtocol proto = NdtProtocol::proto_legacy;
double max_runtime = default_max_runtime;
};

class Client {
public:
NdtSettings settings;

bool run() noexcept;

virtual void on_warning(const std::string &s) noexcept;

virtual void on_info(const std::string &s) noexcept;

virtual void on_debug(const std::string &s) noexcept;

virtual void on_performance(uint8_t tid, uint8_t nflows,
uint64_t measured_bytes,
double measurement_interval, double elapsed,
double max_runtime) noexcept;

virtual void on_result(std::string scope, std::string name,
std::string value) noexcept;

virtual void on_server_busy(std::string msg) noexcept;

virtual int select(int numfd, fd_set *readset, fd_set *writeset,
fd_set *exceptset, timeval *timeout) noexcept;
};

} // namespace libndt
} // namespace measurement_kit
```
To run a NDT test, create a `Client` instance, configure its `settings`, and
then call `run()`. Measurement Kit will override the `virtual` methods
above to gather logs, and results, and allow to interrupt tests. See
[example_client.cpp](example_client.cpp).
## Clone
```
git clone --recursive https://github.com/measurement-kit/libndt
```
## Build and test
```
cmake .
cmake --build .
ctest -a --output-on-failure .
```
2 changes: 1 addition & 1 deletion libndt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace libndt {

constexpr uint64_t api_major = 0;
constexpr uint64_t api_minor = 20;
constexpr uint64_t api_patch = 0;
constexpr uint64_t api_patch = 1;

constexpr uint8_t nettest_middlebox = 1 << 0;
constexpr uint8_t nettest_upload = 1 << 1;
Expand Down

0 comments on commit af3cdac

Please sign in to comment.