mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00

* test for rx_arping * arping ip and interface from client interface * apring thread added to thread ids * clean code for thread for arping * removing the assumption that udpip1 fill be updated along with udpip2 * review, replacing syscall(sys_gettid) with gettid()
36 lines
886 B
C++
36 lines
886 B
C++
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
#pragma once
|
|
/**
|
|
*@short creates/destroys an ARPing thread to arping the interfaces slsReceiver
|
|
is listening to.
|
|
*/
|
|
|
|
#include "receiver_defs.h"
|
|
#include "sls/logger.h"
|
|
|
|
#include <atomic>
|
|
#include <thread>
|
|
|
|
class Arping {
|
|
|
|
public:
|
|
void SetInterfacesAndIps(const int index, const std::string &interface,
|
|
const std::string &ip);
|
|
pid_t GetThreadId() const;
|
|
bool IsRunning() const;
|
|
void StartThread();
|
|
void StopThread();
|
|
|
|
private:
|
|
void TestCommands();
|
|
std::string ExecuteCommands();
|
|
void ThreadExecution();
|
|
|
|
std::vector<std::string> commands =
|
|
std::vector<std::string>(MAX_NUMBER_OF_LISTENING_THREADS);
|
|
std::atomic<bool> runningFlag{false};
|
|
std::thread t;
|
|
std::atomic<pid_t> threadId{0};
|
|
};
|