Files
fsfw/src/fsfw/osal/common/tcpipCommon.h
T

44 lines
795 B
C++
Raw Normal View History

2021-03-12 18:06:24 +01:00
#ifndef FSFW_OSAL_COMMON_TCPIPCOMMON_H_
#define FSFW_OSAL_COMMON_TCPIPCOMMON_H_
#include "fsfw/timemanager/clockDefinitions.h"
2021-03-12 18:06:24 +01:00
#include <string>
2021-04-12 12:33:45 +02:00
#ifdef _WIN32
#include <winsock2.h>
#else
#include <netdb.h>
#include <arpa/inet.h>
#endif
2021-03-12 18:06:24 +01:00
namespace tcpip {
static constexpr char DEFAULT_SERVER_PORT[] = "7301";
2021-03-12 18:30:36 +01:00
2021-03-12 18:06:24 +01:00
enum class Protocol {
UDP,
TCP
};
enum class ErrorSources {
GETADDRINFO_CALL,
SOCKET_CALL,
SETSOCKOPT_CALL,
BIND_CALL,
RECV_CALL,
RECVFROM_CALL,
LISTEN_CALL,
ACCEPT_CALL,
2021-05-05 15:59:41 +02:00
SEND_CALL,
2021-05-05 12:59:42 +02:00
SENDTO_CALL,
SHUTDOWN_CALL
2021-03-12 18:06:24 +01:00
};
void determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std::string& protStr,
std::string& srcString);
2021-04-12 12:33:45 +02:00
void printAddress(struct sockaddr* addr);
2021-03-12 18:06:24 +01:00
2021-04-12 12:33:45 +02:00
}
2021-03-12 18:06:24 +01:00
#endif /* FSFW_OSAL_COMMON_TCPIPCOMMON_H_ */