Commit da79909d authored by Andreas Schmidt's avatar Andreas Schmidt

Merge branch 'develop'

parents 123f6356 381508c7
Pipeline #1606 passed with stages
in 1 minute and 30 seconds
prrt/_version.py export-subst
_version.py export-subst
*.cbp
*.pyc
.vagrant/
cython_debug/
dist/
prrt.egg-info/
prrt/__pycache__/
tests/__pycache__/
MANIFEST
prrt.cpython*.so
prrt.so
variables:
PYPI_USER: SECURE
PYPI_PASSWORD: SECURE
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build
- test
- deploy
- clean
build:prrt:
stage: build
tags:
- cmake
artifacts:
name: "$CI_BUILD_REF_NAME$"
untracked: true
expire_in: "1h"
script:
- rm -vf ~/.pypirc
- which cmake
- which gcc
- which g++
- pip3 list | grep Cython
- pip3 list | grep numpy
- CC=gcc-5 CXX=g++-5 cmake . -DPRRT_TESTS=1
- make
build:container:
stage: build
tags:
- docker
script:
- export DOCKER_TAG=$(echo "$CI_BUILD_REF_NAME" | sed 's#/#_#' | sed 's#^master$#latest#')
- docker build -t $CI_REGISTRY_IMAGE:$DOCKER_TAG --build-arg http_proxy=http://www-proxy.uni-saarland.de:3128 -f docker/Dockerfile .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE:$DOCKER_TAG
- docker rmi $CI_REGISTRY_IMAGE:$DOCKER_TAG
test:prrt_mem:
stage: test
dependencies:
- build:prrt
tags:
- valgrind
script:
- bash tests/memtest.sh
test:prrt_functional:
stage: test
dependencies:
- build:prrt
tags:
- bash
script:
- exec ./bin/prrtTests
test:prrt_python_bindings:
stage: test
tags:
- bash
- python3
script:
- sh tests/build.sh
deploy:pypi:
stage: deploy
tags:
- python3
script:
- echo "[distutils]" >> ~/.pypirc
- echo "index-servers =" >> ~/.pypirc
- echo " on" >> ~/.pypirc
- echo " " >> ~/.pypirc
- echo "[on]" >> ~/.pypirc
- echo "repository=http://git.nt.uni-saarland.de:5678" >> ~/.pypirc
- echo "username=$PYPI_USER" >> ~/.pypirc
- echo "password=$PYPI_PASSWORD" >> ~/.pypirc
- python3 setup.py check sdist bdist upload -r on
- rm -vf ~/.pypirc
\ No newline at end of file
[submodule "prrt/xlap"]
path = prrt/xlap
url = ../../as/X-Lap.git
cmake_minimum_required (VERSION 2.8.11)
project (PRRT)
option(PRRT_TESTS "Build tests" OFF)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_C_FLAGS "-O2 -Wall -std=gnu11 -D_GNU_SOURCE" )
set(CMAKE_CXX_FLAGS "-fstack-protector -fstack-protector-all -Wall -std=gnu++11 -D_GNU_SOURCE" )
set(CMAKE_CXX_FLAGS_DEBUG "-O2 -Wall -ggdb" )
set(CMAKE_CXX_FLAGS_RELEASE "-Os -Wall" )
find_package (Threads)
find_library(M_LIB m)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(prrt)
if(PRRT_TESTS)
enable_testing()
add_subdirectory(tests)
add_custom_target(funtest COMMAND ./bin/prrtTests)
endif()
add_custom_target(perftest COMMAND python3 tests/eval.py)
add_custom_target(memtest COMMAND bash ./memtest.sh DEPENDS sender receiver)
include requirements.txt
recursive-include src *
recursive-include prrt *
include versioneer.py
include prrt/_version.py
include _version.py
# Predictable Reliable Realtime Transport
# Predictably Reliable Real-Time (PRRT)
**PRRT** is a transport protocol that aims to provide predictable reliability and latency. [http://larn.systems]()
## Features
* Forward Error Correction (FEC) using systematic Vandermonde codes
* Clock synchronization between sending stack and receiving stack
* Applications can specify packet-level expiration times
* Different receive modes for ASAP and time-synchronized operation
* Packet-level timing analysis using [X-Lap](http://xlap.larn.systems)
* [Hardware timestamping support](https://git.nt.uni-saarland.de/LARN/PRRT/wikis/hardware-timestamping)
## Installation
*See [Installing PRRT](https://git.nt.uni-saarland.de/LARN/PRRT/wikis/installation#python) for instructions on how to install it on your system for using it with C/C++ or Python.*
#### *Try PRRT on your system*
A [minimal receiver](examples/receiver.py), which takes the bind port as an argument, is created as follows:
```python
import sys
import prrt
port = int(sys.argv[1])
s = prrt.PrrtSocket(port=port, isSender=False)
while True:
d = s.recv()
if d != "Close":
print d
else:
break
```
A [minimal sender](sender.py) is created as follows:
```python
import sys
import prrt
host = sys.argv[1]
port = int(sys.argv[2])
s = prrt.PrrtSocket(port=port, isSender=True)
s.connect(host, port)
for i in range(10):
s.send("Packet {}".format(i))
s.send("Close")
```
Start the receiver by:
```bash
python receiver.py 5000
```
In a separate terminal, run:
```bash
python sender.py 127.0.0.1 5000
```
This should generate the following output in the receiver console:
```terminal
Packet 0
Packet 1
...
Packet 9
```
## For more information
* [PRRT Wiki](https://git.nt.uni-saarland.de/LARN/PRRT/wikis)
* [LARN Project Website](http://larn.systems)
## License
[MIT Licence](LICENSE)
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = false
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.name = "prrt"
v.memory = "2048"
v.cpus = "2"
end
config.vm.provision "shell", inline: <<-SHELL
sudo sed -i 's@http://archive.ubuntu.com/ubuntu@http://ftp.uni-kl.de/pub/linux/ubuntu/@' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y python-dev python-pip
SHELL
end
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains the computed version number.
# This file is released into the public domain. Generated by
# versioneer-0.18 (https://github.com/warner/python-versioneer)
"""Git implementation of _version.py."""
import errno
import os
import re
import subprocess
import sys
def get_keywords():
"""Get the keywords needed to look up the version information."""
# these strings will be replaced by git during git-archive.
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
git_refnames = "$Format:%d$"
git_full = "$Format:%H$"
git_date = "$Format:%ci$"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
class VersioneerConfig:
"""Container for Versioneer configuration parameters."""
def get_config():
"""Create, populate and return the VersioneerConfig() object."""
# these strings are filled in when 'setup.py versioneer' creates
# _version.py
cfg = VersioneerConfig()
cfg.VCS = "git"
cfg.style = "pep440"
cfg.tag_prefix = "prrt-"
cfg.parentdir_prefix = "None"
cfg.versionfile_source = "_version.py"
cfg.verbose = False
return cfg
class NotThisMethod(Exception):
"""Exception raised if a method is not valid for the current scenario."""
LONG_VERSION_PY = {}
HANDLERS = {}
def register_vcs_handler(vcs, method): # decorator
"""Decorator to mark a method as the handler for a particular VCS."""
def decorate(f):
"""Store f in HANDLERS[vcs][method]."""
if vcs not in HANDLERS:
HANDLERS[vcs] = {}
HANDLERS[vcs][method] = f
return f
return decorate
def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None):
"""Call the given command(s)."""
assert isinstance(commands, list)
p = None
for c in commands:
try:
dispcmd = str([c] + args)
# remember shell=False, so use git.cmd on windows, not just git
p = subprocess.Popen([c] + args, cwd=cwd, env=env,
stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr
else None))
break
except EnvironmentError:
e = sys.exc_info()[1]
if e.errno == errno.ENOENT:
continue
if verbose:
print("unable to run %s" % dispcmd)
print(e)
return None, None
else:
if verbose:
print("unable to find command, tried %s" % (commands,))
return None, None
stdout = p.communicate()[0].strip()
if sys.version_info[0] >= 3:
stdout = stdout.decode()
if p.returncode != 0:
if verbose:
print("unable to run %s (error)" % dispcmd)
print("stdout was %s" % stdout)
return None, p.returncode
return stdout, p.returncode
def versions_from_parentdir(parentdir_prefix, root, verbose):
"""Try to determine the version from the parent directory name.
Source tarballs conventionally unpack into a directory that includes both
the project name and a version string. We will also support searching up
two directory levels for an appropriately named parent directory
"""
rootdirs = []
for i in range(3):
dirname = os.path.basename(root)
if dirname.startswith(parentdir_prefix):
return {"version": dirname[len(parentdir_prefix):],
"full-revisionid": None,
"dirty": False, "error": None, "date": None}
else:
rootdirs.append(root)
root = os.path.dirname(root) # up a level
if verbose:
print("Tried directories %s but none started with prefix %s" %
(str(rootdirs), parentdir_prefix))
raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
@register_vcs_handler("git", "get_keywords")
def git_get_keywords(versionfile_abs):
"""Extract version information from the given file."""