finsihed tcpip refactoring for linux udp
This commit is contained in:
3
osal/common/CMakeLists.txt
Normal file
3
osal/common/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||
tcpipCommon.cpp
|
||||
)
|
36
osal/common/tcpipCommon.cpp
Normal file
36
osal/common/tcpipCommon.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include "tcpipCommon.h"
|
||||
|
||||
void tcpip::determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std::string &protStr,
|
||||
std::string &srcString) {
|
||||
if(protocol == Protocol::TCP) {
|
||||
protStr = "TCP";
|
||||
}
|
||||
else if(protocol == Protocol::UDP) {
|
||||
protStr = "UDP";
|
||||
}
|
||||
else {
|
||||
protStr = "Unknown protocol";
|
||||
}
|
||||
|
||||
if(errorSrc == ErrorSources::SETSOCKOPT_CALL) {
|
||||
srcString = "setsockopt call";
|
||||
}
|
||||
else if(errorSrc == ErrorSources::SOCKET_CALL) {
|
||||
srcString = "socket call";
|
||||
}
|
||||
else if(errorSrc == ErrorSources::LISTEN_CALL) {
|
||||
srcString = "listen call";
|
||||
}
|
||||
else if(errorSrc == ErrorSources::ACCEPT_CALL) {
|
||||
srcString = "accept call";
|
||||
}
|
||||
else if(errorSrc == ErrorSources::RECVFROM_CALL) {
|
||||
srcString = "recvfrom call";
|
||||
}
|
||||
else if(errorSrc == ErrorSources::GETADDRINFO_CALL) {
|
||||
srcString = "getaddrinfo call";
|
||||
}
|
||||
else {
|
||||
srcString = "unknown call";
|
||||
}
|
||||
}
|
33
osal/common/tcpipCommon.h
Normal file
33
osal/common/tcpipCommon.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef FSFW_OSAL_COMMON_TCPIPCOMMON_H_
|
||||
#define FSFW_OSAL_COMMON_TCPIPCOMMON_H_
|
||||
|
||||
#include "../../timemanager/clockDefinitions.h"
|
||||
#include <string>
|
||||
|
||||
namespace tcpip {
|
||||
|
||||
enum class Protocol {
|
||||
UDP,
|
||||
TCP
|
||||
};
|
||||
|
||||
enum class ErrorSources {
|
||||
GETADDRINFO_CALL,
|
||||
SOCKET_CALL,
|
||||
SETSOCKOPT_CALL,
|
||||
BIND_CALL,
|
||||
RECV_CALL,
|
||||
RECVFROM_CALL,
|
||||
LISTEN_CALL,
|
||||
ACCEPT_CALL,
|
||||
SENDTO_CALL
|
||||
};
|
||||
|
||||
void determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std::string& protStr,
|
||||
std::string& srcString);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* FSFW_OSAL_COMMON_TCPIPCOMMON_H_ */
|
Reference in New Issue
Block a user