/*****************************************************************************/
 *                          OPC UA Pub/Sub <-> FIP Gateway
/*****************************************************************************/
// xdp (express data path) pre-requisties (for faster processing the data) - libbpf v0.3
$ sudo apt install llvm
$ sudo apt install clang
$ cd /usr/local/src/
$ git clone https://github.com/libbpf/libbpf.git
$ cd libbpf/
$ git checkout 051a4009f94d5633a8f734ca4235f0a78ee90469
$ cd src/
$ sudo OBJDIR=/usr/lib make install

// open62541 compilation
$ sudo apt-get install build-essential gcc pkg-config cmake python
$ wget https://github.com/open62541/open62541/archive/refs/tags/v1.3.tar.gz -O open62541-1.3.0.tar.gz
$ tar xzvf open62541-1.3.0.tar.gz
$ cd open62541-1.3.0
$ mkdir build
$ cd build
$ cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DOPEN62541_VERSION=v1.3.0 -DUA_ENABLE_PUBSUB=ON -DUA_ENABLE_PUBSUB_ETH_UADP=ON -DUA_ENABLE_MALLOC_SINGLETON=ON -DUA_ENABLE_IMMUTABLE_NODES=ON -DUA_ENABLE_PUBSUB_INFORMATIONMODEL=ON -DUA_MULTITHREADING=150
$ make
$ sudo make install

// json-c dependency installation
$ sudo apt install libjson-c-dev

// Compilation & Start-up of the gateway from powerfip package
$ cd tools/uafip_tsn_gateway
$ make
$ sudo setcap cap_sys_nice+ep uafipd
$ ./uafipd -f ./config/2sta/sta1.json

// For RT-Preemt Linux kernel, use the following script:
// note: this command starts the gateway, locks the process to a specific CPU,
// and sets the scheduling policy.
$ sudo ./start_rt_gateway.sh "./uafipd -f ./config/2sta/sta1.json"

// List FIP devices
$ ./uafipd -l

// Help infos
$ ./uafipd -h
