cleaned up a bit, removed unused fields
This commit is contained in:
parent
7bc04014e8
commit
703dfe9854
@ -6,6 +6,9 @@
|
|||||||
|
|
||||||
namespace tcpip {
|
namespace tcpip {
|
||||||
|
|
||||||
|
const char* const DEFAULT_UDP_SERVER_PORT = "7301";
|
||||||
|
const char* const DEFAULT_TCP_SERVER_PORT = "7303";
|
||||||
|
|
||||||
enum class Protocol {
|
enum class Protocol {
|
||||||
UDP,
|
UDP,
|
||||||
TCP
|
TCP
|
||||||
|
@ -125,7 +125,6 @@ ReturnValue_t TcUnixUdpPollingTask::initialize() {
|
|||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,12 +12,10 @@
|
|||||||
//! Debugging preprocessor define.
|
//! Debugging preprocessor define.
|
||||||
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
|
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
|
||||||
|
|
||||||
const std::string TmTcUnixUdpBridge::DEFAULT_UDP_SERVER_PORT = "7301";
|
const std::string TmTcUnixUdpBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_UDP_SERVER_PORT;
|
||||||
const std::string TmTcUnixUdpBridge::DEFAULT_UDP_CLIENT_PORT = "7302";
|
|
||||||
|
|
||||||
TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId,
|
TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
object_id_t tcDestination, object_id_t tmStoreId, object_id_t tcStoreId,
|
object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort):
|
||||||
std::string udpServerPort, std::string udpClientPort):
|
|
||||||
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
|
||||||
if(udpServerPort == "") {
|
if(udpServerPort == "") {
|
||||||
this->udpServerPort = DEFAULT_UDP_SERVER_PORT;
|
this->udpServerPort = DEFAULT_UDP_SERVER_PORT;
|
||||||
@ -25,12 +23,6 @@ TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId,
|
|||||||
else {
|
else {
|
||||||
this->udpServerPort = udpServerPort;
|
this->udpServerPort = udpServerPort;
|
||||||
}
|
}
|
||||||
if(udpClientPort == "") {
|
|
||||||
this->udpClientPort = DEFAULT_UDP_CLIENT_PORT;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this->udpClientPort = udpClientPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex = MutexFactory::instance()->createMutex();
|
mutex = MutexFactory::instance()->createMutex();
|
||||||
communicationLinkUp = false;
|
communicationLinkUp = false;
|
||||||
@ -113,7 +105,7 @@ ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
|
|||||||
|
|
||||||
if(ipAddrAnySet){
|
if(ipAddrAnySet){
|
||||||
clientAddress.sin_addr.s_addr = htons(INADDR_ANY);
|
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
|
#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1
|
||||||
|
@ -7,17 +7,18 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/udp.h>
|
#include <netinet/udp.h>
|
||||||
|
|
||||||
class TmTcUnixUdpBridge: public TmTcBridge {
|
class TmTcUnixUdpBridge:
|
||||||
|
public TmTcBridge {
|
||||||
friend class TcUnixUdpPollingTask;
|
friend class TcUnixUdpPollingTask;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/* The ports chosen here should not be used by any other process.
|
/* The ports chosen here should not be used by any other process.
|
||||||
List of used ports on Linux: /etc/services */
|
List of used ports on Linux: /etc/services */
|
||||||
static const std::string DEFAULT_UDP_SERVER_PORT;
|
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,
|
TmTcUnixUdpBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
object_id_t tmStoreId, object_id_t tcStoreId,
|
object_id_t tmStoreId, object_id_t tcStoreId,
|
||||||
std::string serverPort = "", std::string clientPort = "");
|
std::string serverPort = "");
|
||||||
virtual~ TmTcUnixUdpBridge();
|
virtual~ TmTcUnixUdpBridge();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,22 +31,17 @@ public:
|
|||||||
void checkAndSetClientAddress(sockaddr_in& clientAddress);
|
void checkAndSetClientAddress(sockaddr_in& clientAddress);
|
||||||
|
|
||||||
void setClientAddressToAny(bool ipAddrAnySet);
|
void setClientAddressToAny(bool ipAddrAnySet);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override;
|
virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int serverSocket = 0;
|
int serverSocket = 0;
|
||||||
std::string udpServerPort;
|
std::string udpServerPort;
|
||||||
std::string udpClientPort;
|
|
||||||
|
|
||||||
const int serverSocketOptions = 0;
|
|
||||||
|
|
||||||
struct sockaddr_in clientAddress;
|
struct sockaddr_in clientAddress;
|
||||||
socklen_t clientAddressLen = 0;
|
socklen_t clientAddressLen = 0;
|
||||||
|
|
||||||
struct sockaddr_in serverAddress;
|
|
||||||
socklen_t serverAddressLen = 0;
|
|
||||||
|
|
||||||
bool ipAddrAnySet = false;
|
bool ipAddrAnySet = false;
|
||||||
|
|
||||||
//! Access to the client address is mutex protected as it is set by another task.
|
//! Access to the client address is mutex protected as it is set by another task.
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
//! Debugging preprocessor define.
|
//! Debugging preprocessor define.
|
||||||
#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0
|
#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,
|
TmTcWinUdpBridge::TmTcWinUdpBridge(object_id_t objectId, object_id_t tcDestination,
|
||||||
object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort):
|
object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort):
|
||||||
|
Loading…
Reference in New Issue
Block a user