cleaned up a bit, removed unused fields

This commit is contained in:
Robin Müller 2021-03-12 18:30:36 +01:00
parent 7bc04014e8
commit 703dfe9854
5 changed files with 69 additions and 79 deletions

View File

@ -6,6 +6,9 @@
namespace tcpip {
const char* const DEFAULT_UDP_SERVER_PORT = "7301";
const char* const DEFAULT_TCP_SERVER_PORT = "7303";
enum class Protocol {
UDP,
TCP

View File

@ -125,7 +125,6 @@ ReturnValue_t TcUnixUdpPollingTask::initialize() {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -12,12 +12,10 @@
//! Debugging preprocessor define.
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
const std::string TmTcUnixUdpBridge::DEFAULT_UDP_SERVER_PORT = "7301";
const std::string TmTcUnixUdpBridge::DEFAULT_UDP_CLIENT_PORT = "7302";
const std::string TmTcUnixUdpBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_UDP_SERVER_PORT;
TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId,
object_id_t tcDestination, object_id_t tmStoreId, object_id_t tcStoreId,
std::string udpServerPort, std::string udpClientPort):
TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort):
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
if(udpServerPort == "") {
this->udpServerPort = DEFAULT_UDP_SERVER_PORT;
@ -25,12 +23,6 @@ TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId,
else {
this->udpServerPort = udpServerPort;
}
if(udpClientPort == "") {
this->udpClientPort = DEFAULT_UDP_CLIENT_PORT;
}
else {
this->udpClientPort = udpClientPort;
}
mutex = MutexFactory::instance()->createMutex();
communicationLinkUp = false;
@ -113,7 +105,7 @@ ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
if(ipAddrAnySet){
clientAddress.sin_addr.s_addr = htons(INADDR_ANY);
clientAddressLen = sizeof(serverAddress);
clientAddressLen = sizeof(clientAddress);
}
#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1

View File

@ -7,17 +7,18 @@
#include <netinet/in.h>
#include <netinet/udp.h>
class TmTcUnixUdpBridge: public TmTcBridge {
class TmTcUnixUdpBridge:
public TmTcBridge {
friend class TcUnixUdpPollingTask;
public:
/* The ports chosen here should not be used by any other process.
List of used ports on Linux: /etc/services */
static const std::string DEFAULT_UDP_SERVER_PORT;
static const std::string DEFAULT_UDP_CLIENT_PORT;
TmTcUnixUdpBridge(object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId,
std::string serverPort = "", std::string clientPort = "");
std::string serverPort = "");
virtual~ TmTcUnixUdpBridge();
/**
@ -30,22 +31,17 @@ public:
void checkAndSetClientAddress(sockaddr_in& clientAddress);
void setClientAddressToAny(bool ipAddrAnySet);
protected:
virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override;
private:
int serverSocket = 0;
std::string udpServerPort;
std::string udpClientPort;
const int serverSocketOptions = 0;
struct sockaddr_in clientAddress;
socklen_t clientAddressLen = 0;
struct sockaddr_in serverAddress;
socklen_t serverAddressLen = 0;
bool ipAddrAnySet = false;
//! Access to the client address is mutex protected as it is set by another task.

View File

@ -8,7 +8,7 @@
//! Debugging preprocessor define.
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
const std::string TmTcWinUdpBridge::DEFAULT_UDP_SERVER_PORT = "7301";
const std::string TmTcWinUdpBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_UDP_SERVER_PORT;
TmTcWinUdpBridge::TmTcWinUdpBridge(object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort):