EHS
Loading...
Searching...
No Matches
Socket.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
ehs/Str.h
"
4
5
#ifndef EHS_IPV4_HEADER
6
#define EHS_IPV4_HEADER 60
7
#include <string>
8
#endif
9
10
#ifndef EHS_IPV6_HEADER
11
#define EHS_IPV6_HEADER 40
12
#endif
13
14
#ifndef EHS_UDP_HEADER
15
#define EHS_UDP_HEADER 8
16
#endif
17
18
#ifndef EHS_IPV4_UDP_PAYLOAD
19
#define EHS_IPV4_UDP_PAYLOAD (EHS_UINT_16_MAX - EHS_IPV4_HEADER - EHS_UDP_HEADER)
20
#endif
21
22
#ifndef EHS_IPV6_UDP_PAYLOAD
23
#define EHS_IPV6_UDP_PAYLOAD (EHS_UINT_16_MAX - EHS_IPV6_HEADER - EHS_UDP_HEADER)
24
#endif
25
26
namespace
ehs
27
{
28
enum class
IP
29
{
30
V4
,
31
V6
32
};
33
34
enum class
ContentType
35
{
36
APP_MULTIPART_FORMDATA
,
37
APP_FORMURLENCODED
,
38
APP_JAVASCRIPT
,
39
APP_JSON
,
40
APP_XML
,
41
TEXT_PLAIN
,
42
TEXT_HTML
,
43
TEXT_XML
,
44
NONE
45
};
46
47
struct
Endpoint
48
{
49
IP
version
=
IP::V6
;
50
Str_8
address
;
51
UInt_16
port
= 0;
52
};
53
54
#if defined(EHS_OS_WINDOWS)
55
typedef
UInt_64 Socket;
56
#define EHS_INVALID_SOCKET EHS_UINT_64_MAX
57
#elif defined(EHS_OS_LINUX)
58
typedef
SInt_32
Socket;
59
#define EHS_INVALID_SOCKET (SInt_32)0xffffffff
60
#endif
61
}
Str.h
ehs
Definition
Anchor.h:6
ehs::SInt_32
signed int SInt_32
Definition
Types.h:50
ehs::Dock::NONE
@ NONE
Definition
Dock.h:7
ehs::IP
IP
Definition
Socket.h:29
ehs::IP::V4
@ V4
Definition
Socket.h:30
ehs::IP::V6
@ V6
Definition
Socket.h:31
ehs::ContentType
ContentType
Definition
Socket.h:35
ehs::ContentType::TEXT_XML
@ TEXT_XML
Definition
Socket.h:43
ehs::ContentType::APP_XML
@ APP_XML
Definition
Socket.h:40
ehs::ContentType::APP_MULTIPART_FORMDATA
@ APP_MULTIPART_FORMDATA
Definition
Socket.h:36
ehs::ContentType::TEXT_HTML
@ TEXT_HTML
Definition
Socket.h:42
ehs::ContentType::APP_FORMURLENCODED
@ APP_FORMURLENCODED
Definition
Socket.h:37
ehs::ContentType::APP_JSON
@ APP_JSON
Definition
Socket.h:39
ehs::ContentType::APP_JAVASCRIPT
@ APP_JAVASCRIPT
Definition
Socket.h:38
ehs::ContentType::TEXT_PLAIN
@ TEXT_PLAIN
Definition
Socket.h:41
ehs::Str_8
Str< Char_8, UInt_64 > Str_8
Definition
Str.h:1953
ehs::UInt_16
unsigned short UInt_16
Definition
Types.h:46
ehs::Endpoint
Definition
Socket.h:48
ehs::Endpoint::version
IP version
Definition
Socket.h:49
ehs::Endpoint::port
UInt_16 port
Definition
Socket.h:51
ehs::Endpoint::address
Str_8 address
Definition
Socket.h:50
include
ehs
io
socket
Socket.h
Generated by
1.13.2