Skip to content

Commit

Permalink
[initial]
Browse files Browse the repository at this point in the history
- initial copy of code from the Virtual Vehicle Research GmbH internal gitlab
  • Loading branch information
MrMushroom committed Jan 10, 2023
0 parents commit b06424a
Show file tree
Hide file tree
Showing 6,459 changed files with 472,156 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

# editor backup files
*~
\#*\#

# Eclipse
.cproject
.project
.pydevproject
.settings/

# Visual Studio Code
.vscode/
*.code-workspace

# CLion
.idea/
cmake-build-*/

# Don't ignore src/ because full-text search won't work.
47 changes: 47 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Authors:
# - Christoph Pilz ([email protected])
#

cmake_minimum_required(VERSION 3.16)

# set the project name
project(cpp_receiver VERSION 0.1 DESCRIPTION "cpp receiver for the V2X Routing Platform")

# specify the C++ standard
set(CMAKE_CXX_STANDARD 20)

# add targets
add_subdirectory(vcits)

# add include directories
include_directories(.)
include_directories(vcits/asn1c) #vcits lib headers reference this

# add the executable
add_executable(cppReceiver main.cpp)

# set target properties - CMake does not know without source files
set_target_properties(cppReceiver
PROPERTIES
COMPILE_FLAGS "-Wall -Wextra -fno-strict-aliasing -pipe -pthread -lrt -lm -lzmq"
LINK_FLAGS "-Wall -Wextra -fno-strict-aliasing -pipe -pthread -lrt -lm -lzmq"
VERSION ${PROJECT_VERSION}
)

# ZeroMQ configuration
include(FindZeroMQ.cmake)
#message("ZeroMQ_INCLUDE_DIR: ${ZEROMQ_INCLUDE_DIR}")
#message("ZeroMQ_LIBRARY: ${ZEROMQ_LIBRARIES}")

# specify header locations
target_include_directories(cppReceiver
PUBLIC
${ZEROMQ_INCLUDE_DIR}
)

# link libraries
target_link_libraries(cppReceiver
PUBLIC
vcits
${ZEROMQ_LIBRARIES}
)
69 changes: 69 additions & 0 deletions Dockerfiles/Dockerfile.demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Demo for cpp_receiver
#
# Authors:
# - Christoph Pilz
#

FROM ubuntu:20.04

RUN DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get -y install tzdata

RUN apt-get update \
&& apt-get install -y ssh \
build-essential \
gcc \
g++ \
gdb \
clang \
cmake \
rsync \
tar \
python \
&& apt-get clean

# ZMQ Setup
RUN apt-get update -qq \
&& apt-get install -qq --yes --no-install-recommends \
autoconf \
automake \
build-essential \
git \
libkrb5-dev \
libsodium-dev \
libtool \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

# libzmq
WORKDIR /opt
RUN git clone https://github.com/zeromq/libzmq.git
WORKDIR /opt/libzmq
RUN git checkout v4.3.4
RUN ./autogen.sh \
&& ./configure --prefix=/usr/local --with-libsodium --with-libgssapi_krb5 \
&& make \
&& make check \
&& make install
RUN apt-get update -qq \
&& apt-get install -qq --yes --no-install-recommends \
libkrb5-dev \
libsodium23 \
&& rm -rf /var/lib/apt/lists/*
RUN ldconfig && ldconfig -p | grep libzmq

# cppzmq
WORKDIR /opt
RUN git clone https://github.com/zeromq/cppzmq.git
WORKDIR /opt/cppzmq
RUN git checkout v4.8.0
WORKDIR /opt/cppzmq/build
RUN cmake .. \
&& make install
# ZMQ Setup - done

# install the demo
WORKDIR /tmp/demo
RUN rm -rf *
COPY . .
WORKDIR /tmp/demo/build
RUN cmake .. && make
83 changes: 83 additions & 0 deletions Dockerfiles/Dockerfile.remote-cpp-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# CLion remote docker environment (How to build docker container, run and stop it)
#
# Build and run:
# docker build -t clion/lw_remote_cpp_env:0.1 -f Dockerfiles/Dockerfile.remote_cpp_env .
# docker run -d --cap-add sys_ptrace -p127.0.0.1:2222:22 --name cpp_receiver clion/lw_remote_cpp_env:0.1
# ssh-keygen -f "$HOME/.ssh/known_hosts" -R "[localhost]:2222"
#
# stop:
# docker stop clion_remote_env
#
# ssh credentials (test user):
# user@password

FROM ubuntu:20.04

RUN DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get -y install tzdata

RUN apt-get update \
&& apt-get install -y ssh \
build-essential \
gcc \
g++ \
gdb \
clang \
cmake \
rsync \
tar \
python \
&& apt-get clean

# ZMQ Setup
RUN apt-get update -qq \
&& apt-get install -qq --yes --no-install-recommends \
autoconf \
automake \
build-essential \
git \
libkrb5-dev \
libsodium-dev \
libtool \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

# libzmq
WORKDIR /opt
RUN git clone https://github.com/zeromq/libzmq.git
WORKDIR /opt/libzmq
RUN git checkout v4.3.4
RUN ./autogen.sh \
&& ./configure --prefix=/usr/local --with-libsodium --with-libgssapi_krb5 \
&& make \
&& make check \
&& make install
RUN apt-get update -qq \
&& apt-get install -qq --yes --no-install-recommends \
libkrb5-dev \
libsodium23 \
&& rm -rf /var/lib/apt/lists/*
RUN ldconfig && ldconfig -p | grep libzmq

WORKDIR /opt
RUN git clone https://github.com/zeromq/cppzmq.git
WORKDIR /opt/cppzmq
RUN git checkout v4.8.0
WORKDIR /opt/cppzmq/build
RUN cmake .. \
&& make install
# ZMQ Setup - done

RUN ( \
echo 'LogLevel DEBUG2'; \
echo 'PermitRootLogin yes'; \
echo 'PasswordAuthentication yes'; \
echo 'Subsystem sftp /usr/lib/openssh/sftp-server'; \
) > /etc/ssh/sshd_config_test_clion \
&& mkdir /run/sshd

RUN useradd -m user \
&& yes password | passwd user

RUN usermod -s /bin/bash user

CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config_test_clion"]
36 changes: 36 additions & 0 deletions FindZeroMQ.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ZeroMQ.cmake from http://lists.gforge.inria.fr/pipermail/simgrid-devel/2012-July/001513.html

SET (ZEROMQ_FIND_QUIETLY TRUE)
SET (ZEROMQ_FIND_REQUIRED FALSE)

IF (NOT ZEROMQ_FOUND)
# Search user environment for headers, then default paths
FIND_PATH (ZEROMQ_INCLUDE_DIR zmq.hpp
PATHS ${ZEROMQROOT}/include $ENV{ZEROMQROOT}/include /usr/local/include
NO_DEFAULT_PATH)
FIND_PATH (ZEROMQ_INCLUDE_DIR zmq.hpp)
GET_FILENAME_COMPONENT (ZEROMQROOT ${ZEROMQ_INCLUDE_DIR} PATH)

# Search user environment for libraries, then default paths
FIND_LIBRARY (ZEROMQ_LIBRARIES zmq
PATHS ${ZEROMQROOT}/lib $ENV{ZEROMQROOT}/lib /usr/local/lib
NO_DEFAULT_PATH)
FIND_LIBRARY (ZEROMQ_LIBRARIES zmq)

# Set ZEROMQ_FOUND and error out if zmq is not found
INCLUDE (FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS (ZEROMQ
DEFAULT_MSG ZEROMQ_LIBRARIES ZEROMQ_INCLUDE_DIR)

IF (ZEROMQ_FOUND)
MESSAGE (STATUS "ZeroMQ found: zmq library and zmq.hpp ")
MESSAGE (STATUS " * includes: ${ZEROMQ_INCLUDE_DIR}")
MESSAGE (STATUS " * libs: ${ZEROMQ_LIBRARIES}")
ELSE (ZEROMQ_FOUND)
IF(${ZEROMQ_LIBRARIES} STREQUAL "ZEROMQ_LIBRARIES-NOTFOUND")
MESSAGE (STATUS "ZeroMQ library does not exist")
ELSEIF(${ZEROMQ_INCLUDE_DIR} STREQUAL "ZEROMQ_INCLUDE_DIR-NOTFOUND")
MESSAGE (STATUS "ZeroMQ has a problem: zmq.hpp does not exist, try to download it from https://github.com/zeromq/cppzmq/blob/master/zmq.hpp")
ENDIF()
ENDIF (ZEROMQ_FOUND)
ENDIF (NOT ZEROMQ_FOUND)
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
BSD 3-Clause License

Copyright (c) 2022, Virtual Vehicle
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Receiver Demo (CXX)

Sample implementation for a receiving cpp client for the vehicleCAPTAIN [routing core](https://github.com/virtual-vehicle/vehicle_captain_routing_core).

Sample implementation also shows decoding usage for [vcits](https://github.com/virtual-vehicle/vehicle_captain_its_lib_c_cxx).

## Feature List
### Version 1.0
Dependencies
- [vcits](https://github.com/virtual-vehicle/vehicle_captain_its_lib_c_cxx) 1.0 - can use standard or experimental version (experimental messages included)

Message Examples
- DENM - TODO
- CAM - parsed with major parts
- POI - TODO
- SPATEM - TODO
- MAPEM - TODO
- IVIM - TODO
- EV_RSR - TODO
- TISTPGTRANSACTION - TODO
- SREM - TODO
- SSEM - TODO
- EVCSN - TODO
- SAEM - TODO
- RTCMEM - partly parsed

## Copyright
Please cite the [vehicleCAPTAIN paper](https://TODO_link_to_paper_when_it_is_published) if you used any part of this library for your work.

## Contribution Guidelines
Feel free to add fixes and new features!

## Authors
Main Author: [Christoph Pilz](https://github.com/MrMushroom)

## Acknowledgement
The majority of this work is part of my ([Christoph Pilz](https://www.researchgate.net/profile/Christoph-Pilz)) PhD studies at [Graz University of Technology](https://www.tugraz.at/home) in cooperation with the [Virtual Vehicle Research GmbH](https://www.v2c2.at/).

Features are also integrated across various funded projects (see [vehicleCAPTAIN](https://github.com/virtual-vehicle/vehicle_captain)).

2 changes: 2 additions & 0 deletions docker_demo_build_and_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker build -t vehicle_captain/cpp_receiver_client:0.1 -f Dockerfiles/Dockerfile.demo .
docker run -t -d --name cpp_receiver-demo vehicle_captain/cpp_receiver_client:0.1
5 changes: 5 additions & 0 deletions docker_dev_build_and_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PORT="2222"

docker build -t clion/lw_remote-cpp_receiver-env:0.1 -f Dockerfiles/Dockerfile.remote-cpp-env .
docker run -d --cap-add sys_ptrace -p127.0.0.1:$PORT:22 --name cpp_receiver-dev clion/lw_remote-cpp_receiver-env:0.1
ssh-keygen -f "$HOME/.ssh/known_hosts" -R "[localhost]:$PORT"
Loading

0 comments on commit b06424a

Please sign in to comment.