EHS/include/ehs/io/socket/Socket.h

51 lines
948 B
C
Raw Permalink Normal View History

2024-02-05 22:25:30 -08:00
#pragma once
#ifndef EHS_IPV4_HEADER
#define EHS_IPV4_HEADER 60
#endif
#ifndef EHS_IPV6_HEADER
#define EHS_IPV6_HEADER 40
#endif
#ifndef EHS_UDP_HEADER
#define EHS_UDP_HEADER 8
#endif
#ifndef EHS_IPV4_UDP_PAYLOAD
#define EHS_IPV4_UDP_PAYLOAD (EHS_UINT_16_MAX - EHS_IPV4_HEADER - EHS_UDP_HEADER)
#endif
#ifndef EHS_IPV6_UDP_PAYLOAD
#define EHS_IPV6_UDP_PAYLOAD (EHS_UINT_16_MAX - EHS_IPV6_HEADER - EHS_UDP_HEADER)
#endif
namespace ehs
{
enum class AddrType
{
IPV6,
IPV4
};
enum class ContentType
{
APP_MULTIPART_FORMDATA,
APP_FORMURLENCODED,
APP_JAVASCRIPT,
APP_JSON,
APP_XML,
TEXT_PLAIN,
TEXT_HTML,
TEXT_XML,
NONE
};
#if defined(EHS_OS_WINDOWS)
typedef UInt_64 Socket;
#define EHS_INVALID_SOCKET EHS_UINT_64_MAX
#elif defined(EHS_OS_LINUX)
typedef SInt_32 Socket;
#define EHS_INVALID_SOCKET (SInt_32)0xffffffff
#endif
}