wiretapping in runtime config now
This commit is contained in:
parent
09299802f0
commit
e536918804
@ -5,12 +5,13 @@
|
|||||||
#include "TcpTmTcBridge.h"
|
#include "TcpTmTcBridge.h"
|
||||||
#include "tcpipHelpers.h"
|
#include "tcpipHelpers.h"
|
||||||
|
|
||||||
|
#include "fsfw/tmtcservices/SpacePacketParser.h"
|
||||||
#include "fsfw/tasks/TaskFactory.h"
|
#include "fsfw/tasks/TaskFactory.h"
|
||||||
|
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||||
#include "fsfw/container/SharedRingBuffer.h"
|
#include "fsfw/container/SharedRingBuffer.h"
|
||||||
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
#include "fsfw/ipc/MessageQueueSenderIF.h"
|
||||||
#include "fsfw/ipc/MutexGuard.h"
|
#include "fsfw/ipc/MutexGuard.h"
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||||
|
|
||||||
@ -20,11 +21,6 @@
|
|||||||
#elif defined(PLATFORM_UNIX)
|
#elif defined(PLATFORM_UNIX)
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#endif
|
#endif
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
#ifndef FSFW_TCP_RECV_WIRETAPPING_ENABLED
|
|
||||||
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
|
||||||
|
|
||||||
@ -202,9 +198,11 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t packetSize) {
|
ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t packetSize) {
|
||||||
#if FSFW_TCP_RECV_WIRETAPPING_ENABLED == 1
|
if(wiretappingEnabled) {
|
||||||
arrayprinter::print(receptionBuffer.data(), bytesRead);
|
sif::info << "Received TC:" << std::endl;
|
||||||
#endif
|
arrayprinter::print(spacePacket, packetSize);
|
||||||
|
}
|
||||||
|
|
||||||
if(spacePacket == nullptr or packetSize == 0) {
|
if(spacePacket == nullptr or packetSize == 0) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
@ -268,6 +266,10 @@ ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent)
|
|||||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if(wiretappingEnabled) {
|
||||||
|
sif::info << "Sending TM:" << std::endl;
|
||||||
|
arrayprinter::print(storeAccessor.data(), storeAccessor.size());
|
||||||
|
}
|
||||||
int retval = send(connSocket,
|
int retval = send(connSocket,
|
||||||
reinterpret_cast<const char*>(storeAccessor.data()),
|
reinterpret_cast<const char*>(storeAccessor.data()),
|
||||||
storeAccessor.size(),
|
storeAccessor.size(),
|
||||||
@ -346,6 +348,10 @@ ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TcpTmTcServer::enableWiretapping(bool enable) {
|
||||||
|
this->wiretappingEnabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
void TcpTmTcServer::handleSocketError(ConstStorageAccessor &accessor) {
|
void TcpTmTcServer::handleSocketError(ConstStorageAccessor &accessor) {
|
||||||
// Don't delete data
|
// Don't delete data
|
||||||
accessor.release();
|
accessor.release();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_
|
#ifndef FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_
|
||||||
#define FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_
|
#define FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_
|
||||||
|
|
||||||
#include <fsfw/tmtcservices/SpacePacketParser.h>
|
|
||||||
#include "TcpIpBase.h"
|
#include "TcpIpBase.h"
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
@ -22,6 +21,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class TcpTmTcBridge;
|
class TcpTmTcBridge;
|
||||||
|
class SpacePacketParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief TCP server implementation
|
* @brief TCP server implementation
|
||||||
@ -91,6 +91,8 @@ public:
|
|||||||
ReceptionModes receptionMode = ReceptionModes::SPACE_PACKETS);
|
ReceptionModes receptionMode = ReceptionModes::SPACE_PACKETS);
|
||||||
virtual~ TcpTmTcServer();
|
virtual~ TcpTmTcServer();
|
||||||
|
|
||||||
|
void enableWiretapping(bool enable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a handle to the TCP configuration struct, which can be used to configure TCP
|
* Get a handle to the TCP configuration struct, which can be used to configure TCP
|
||||||
* properties
|
* properties
|
||||||
@ -113,6 +115,7 @@ private:
|
|||||||
//! TMTC bridge is cached.
|
//! TMTC bridge is cached.
|
||||||
object_id_t tmtcBridgeId = objects::NO_OBJECT;
|
object_id_t tmtcBridgeId = objects::NO_OBJECT;
|
||||||
TcpTmTcBridge* tmtcBridge = nullptr;
|
TcpTmTcBridge* tmtcBridge = nullptr;
|
||||||
|
bool wiretappingEnabled = false;
|
||||||
|
|
||||||
ReceptionModes receptionMode;
|
ReceptionModes receptionMode;
|
||||||
TcpConfig tcpConfig;
|
TcpConfig tcpConfig;
|
||||||
|
Loading…
Reference in New Issue
Block a user