1
0
forked from fsfw/fsfw

cleaned up a bit, removed unused fields

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

View File

@ -7,51 +7,47 @@
#include <netinet/in.h>
#include <netinet/udp.h>
class TmTcUnixUdpBridge: public TmTcBridge {
friend class TcUnixUdpPollingTask;
class TmTcUnixUdpBridge:
public TmTcBridge {
friend class TcUnixUdpPollingTask;
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 */
static const std::string DEFAULT_UDP_SERVER_PORT;
static const std::string DEFAULT_UDP_CLIENT_PORT;
static const std::string DEFAULT_UDP_SERVER_PORT;
TmTcUnixUdpBridge(object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId,
std::string serverPort = "", std::string clientPort = "");
virtual~ TmTcUnixUdpBridge();
TmTcUnixUdpBridge(object_id_t objectId, object_id_t tcDestination,
object_id_t tmStoreId, object_id_t tcStoreId,
std::string serverPort = "");
virtual~ TmTcUnixUdpBridge();
/**
* Set properties of internal mutex.
*/
void setMutexProperties(MutexIF::TimeoutType timeoutType, dur_millis_t timeoutMs);
/**
* Set properties of internal mutex.
*/
void setMutexProperties(MutexIF::TimeoutType timeoutType, dur_millis_t timeoutMs);
ReturnValue_t initialize() override;
ReturnValue_t initialize() override;
void checkAndSetClientAddress(sockaddr_in& clientAddress);
void checkAndSetClientAddress(sockaddr_in& clientAddress);
void setClientAddressToAny(bool ipAddrAnySet);
void setClientAddressToAny(bool ipAddrAnySet);
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:
int serverSocket = 0;
std::string udpServerPort;
std::string udpClientPort;
int serverSocket = 0;
std::string udpServerPort;
const int serverSocketOptions = 0;
struct sockaddr_in clientAddress;
socklen_t clientAddressLen = 0;
struct sockaddr_in clientAddress;
socklen_t clientAddressLen = 0;
bool ipAddrAnySet = false;
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.
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
dur_millis_t mutexTimeoutMs = 20;
MutexIF* mutex;
//! Access to the client address is mutex protected as it is set by another task.
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
dur_millis_t mutexTimeoutMs = 20;
MutexIF* mutex;
};
#endif /* FRAMEWORK_OSAL_LINUX_TMTCUNIXUDPBRIDGE_H_ */