2021-03-12 18:06:24 +01:00
|
|
|
#ifndef FSFW_OSAL_COMMON_TCPIPCOMMON_H_
|
|
|
|
#define FSFW_OSAL_COMMON_TCPIPCOMMON_H_
|
|
|
|
|
|
|
|
#include "../../timemanager/clockDefinitions.h"
|
|
|
|
#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 {
|
|
|
|
|
2021-03-21 00:30:33 +01:00
|
|
|
const char* const 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,
|
|
|
|
SENDTO_CALL
|
|
|
|
};
|
|
|
|
|
|
|
|
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_ */
|