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 diff is collapsed.
*
!.gitignore
\ No newline at end of file
FROM gcc:5
MAINTAINER Andreas Schmidt <schmidt@nt.uni-saarland.de>
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y cmake
COPY CMakeLists.txt /prrt/
COPY prrt /prrt/prrt
COPY tests /prrt/tests
COPY docker/entrypoint.sh /
WORKDIR /prrt
RUN cmake . \
&& make
ENV PATH /prrt/bin:$PATH
WORKDIR /prrt/bin
VOLUME /output
ENTRYPOINT ["/entrypoint.sh"]
#!/bin/bash
dev=eth0
command=$1
shift
if [[ "$command" == "sender" || "$command" == "receiver" ]]; then
:
else
echo "Command should be either sender or receiver."
exit 0;
fi
NETEM=()
PRRT=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-t|--target|-p|--port|-r|--rounds)
PRRT+=("$1 $2")
shift
shift
;;
*) # unknown option
NETEM+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
PRRT_PARAMS="${PRRT[@]}"
NETEM_PARAMS="${NETEM[@]}"
echo "Running PRRT with command: \"$command $PRRT_PARAMS\" and link parameters: \"$NETEM_PARAMS\""
tc qdisc add dev $dev root netem $NETEM_PARAMS
/prrt/bin/$command $PRRT_PARAMS -o /output/log.csv
tc qdisc del dev $dev root
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
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")
option (DEBUG "Enable debug output.")
if (DEBUG)
add_definitions(-DDEBUG)
endif()
option(XLAP "Run XLAP to trace packets." OFF)
if (XLAP)
add_definitions(-DXLAP)
endif()
add_subdirectory(proto)
add_subdirectory(util)
add_executable(sender sender.c)
add_executable(receiver receiver.c)
target_link_libraries(sender LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(receiver LINK_PUBLIC PRRT UTIL ${CMAKE_THREAD_LIBS_INIT})
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
from libc.stdint cimport uint32_t, uint16_t, uint8_t, int32_t
from libc.string cimport const_char
cdef extern from "pthread.h" nogil:
ctypedef struct pthread_t:
pass
ctypedef struct pthread_mutex_t:
pass
ctypedef struct pthread_cond_t:
pass
cdef extern from "proto/vdmcode/block_code.h":
cdef struct prrtCoder:
pass
ctypedef prrtCoder PrrtCoder
cdef extern from "proto/channelStateInformation.h":
cdef struct prrtChannelStateInformation:
pass
ctypedef prrtChannelStateInformation PrrtChannelStateInformation
cdef extern from "proto/codingParams.h":
cdef struct prrtCodingParams:
uint8_t k;
uint8_t r;
uint8_t n;
uint8_t n_p;
ctypedef prrtCodingParams PrrtCodingParams
cdef extern from "util/list.h":
cdef struct list:
pass
ctypedef list List
cdef struct listNode:
pass
ctypedef listNode ListNode
void List_push(List *list, const void *value)
void *List_pop(const List *list)
void List_unshift(List *list, const void *value)
void *List_shift(const List *list)
void *List_remove(List *list, const ListNode *node)
cdef extern from "proto/block.h":
cdef struct prrtBlock:
uint32_t data_count
uint32_t redundancy_count
PrrtCodingParams coding_params
uint32_t largest_data_length
uint16_t baseSequenceNumber
List* data_blocks
List* redundancy_blocks
uint8_t is_coded
ctypedef prrtBlock PrrtBlock
cdef extern from "proto/packet.h":
cdef struct prrtPacket:
uint8_t type_priority;
uint8_t index;
uint16_t sequenceNumber;
void* payload;
uint32_t payloadLength;
ctypedef prrtPacket PrrtPacket
cdef extern from "proto/receiver.h":
ctypedef struct PrrtReceiver:
const char* host_name
uint16_t port
PrrtReceiver*