More improvements for TCP/UDP port definition

This commit is contained in:
Robin Müller 2021-08-09 18:12:25 +02:00
parent ba5e2ad8bb
commit fb36dc4501
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
6 changed files with 21 additions and 19 deletions

View File

@ -1,6 +1,5 @@
#include "fsfw/platform.h" #include "fsfw/platform.h"
#include "fsfw/osal/common/TcpTmTcBridge.h" #include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/tcpipHelpers.h"
#include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/ipc/MutexGuard.h" #include "fsfw/ipc/MutexGuard.h"
@ -17,8 +16,6 @@
#endif #endif
const std::string TcpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId): object_id_t tmStoreId, object_id_t tcStoreId):
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {

View File

@ -2,7 +2,7 @@
#define FSFW_OSAL_COMMON_TCPTMTCBRIDGE_H_ #define FSFW_OSAL_COMMON_TCPTMTCBRIDGE_H_
#include "TcpIpBase.h" #include "TcpIpBase.h"
#include "../../tmtcservices/TmTcBridge.h" #include "fsfw/tmtcservices/TmTcBridge.h"
#ifdef _WIN32 #ifdef _WIN32
@ -29,8 +29,6 @@ class TcpTmTcBridge:
public TmTcBridge { public TmTcBridge {
friend class TcpTmTcServer; friend class TcpTmTcServer;
public: public:
/* The ports chosen here should not be used by any other process. */
static const std::string DEFAULT_SERVER_PORT;
/** /**
* Constructor * Constructor

View File

@ -22,7 +22,7 @@
#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0 #define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0
#endif #endif
const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = TcpTmTcBridge::DEFAULT_SERVER_PORT; const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge,
size_t receptionBufferSize, std::string customTcpServerPort): size_t receptionBufferSize, std::string customTcpServerPort):
@ -200,6 +200,10 @@ void TcpTmTcServer::setTcpBacklog(uint8_t tcpBacklog) {
this->tcpBacklog = tcpBacklog; this->tcpBacklog = tcpBacklog;
} }
std::string TcpTmTcServer::getTcpPort() const {
return tcpPort;
}
ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket) { ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket) {
// Access to the FIFO is mutex protected because it is filled by the bridge // Access to the FIFO is mutex protected because it is filled by the bridge
MutexGuard(tmtcBridge->mutex, tmtcBridge->timeoutType, tmtcBridge->mutexTimeoutMs); MutexGuard(tmtcBridge->mutex, tmtcBridge->timeoutType, tmtcBridge->mutexTimeoutMs);

View File

@ -3,13 +3,14 @@
#include "TcpIpBase.h" #include "TcpIpBase.h"
#include "../../platform.h" #include "fsfw/platform.h"
#include "../../ipc/messageQueueDefinitions.h" #include "fsfw/osal/common/tcpipHelpers.h"
#include "../../ipc/MessageQueueIF.h" #include "fsfw/ipc/messageQueueDefinitions.h"
#include "../../objectmanager/frameworkObjects.h" #include "fsfw/ipc/MessageQueueIF.h"
#include "../../objectmanager/SystemObject.h" #include "fsfw/objectmanager/frameworkObjects.h"
#include "../../storagemanager/StorageManagerIF.h" #include "fsfw/objectmanager/SystemObject.h"
#include "../../tasks/ExecutableObjectIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tasks/ExecutableObjectIF.h"
#ifdef PLATFORM_UNIX #ifdef PLATFORM_UNIX
#include <sys/socket.h> #include <sys/socket.h>
@ -43,7 +44,7 @@ class TcpTmTcServer:
public: public:
static const std::string DEFAULT_SERVER_PORT; static const std::string DEFAULT_SERVER_PORT;
static constexpr size_t ETHERNET_MTU_SIZE = 1500; static constexpr size_t ETHERNET_MTU_SIZE = 1500;
/** /**
* TCP Server Constructor * TCP Server Constructor
@ -64,6 +65,8 @@ public:
ReturnValue_t performOperation(uint8_t opCode) override; ReturnValue_t performOperation(uint8_t opCode) override;
ReturnValue_t initializeAfterTaskCreation() override; ReturnValue_t initializeAfterTaskCreation() override;
std::string getTcpPort() const;
protected: protected:
StorageManagerIF* tcStore = nullptr; StorageManagerIF* tcStore = nullptr;
StorageManagerIF* tmStore = nullptr; StorageManagerIF* tmStore = nullptr;

View File

@ -2,8 +2,8 @@
#define FSFW_OSAL_COMMON_TMTCUDPBRIDGE_H_ #define FSFW_OSAL_COMMON_TMTCUDPBRIDGE_H_
#include "TcpIpBase.h" #include "TcpIpBase.h"
#include "../../platform.h" #include "fsfw/platform.h"
#include "../../tmtcservices/TmTcBridge.h" #include "fsfw/tmtcservices/TmTcBridge.h"
#ifdef PLATFORM_WIN #ifdef PLATFORM_WIN
#include <ws2tcpip.h> #include <ws2tcpip.h>

View File

@ -1,7 +1,7 @@
#ifndef FSFW_OSAL_COMMON_TCPIPCOMMON_H_ #ifndef FSFW_OSAL_COMMON_TCPIPCOMMON_H_
#define FSFW_OSAL_COMMON_TCPIPCOMMON_H_ #define FSFW_OSAL_COMMON_TCPIPCOMMON_H_
#include "../../timemanager/clockDefinitions.h" #include "fsfw/timemanager/clockDefinitions.h"
#include <string> #include <string>
#ifdef _WIN32 #ifdef _WIN32
@ -13,7 +13,7 @@
namespace tcpip { namespace tcpip {
const char* const DEFAULT_SERVER_PORT = "7301"; static constexpr char DEFAULT_SERVER_PORT[] = "7301";
enum class Protocol { enum class Protocol {
UDP, UDP,