2
3
4
5
18
19
20
26
27
28
29
30 InetAddress(uint16_t port = 0, std::string ip =
"127.0.0.1");
33
34
35
41
42
46
47
48
49 std::string
ToIP()
const;
52
53
54
58
59
60
64
65
66
70
71
72
76
77
78
84
85
#define SPICES_PROFILE_ZONE
const char * Peek() const
Get read area start pointer.
std::string RetrieveAllAsString()
Get readable area data as string.
size_t m_WriterIndex
Writer pointer.
const char * BeginWrite() const
Get writeable area pointer.
std::string RetrieveAsString(size_t len)
Get retrieve area data as string.
void EnsureWriteableBytes(size_t len)
Ensure enough bytes to write.
size_t WriteableBytes() const
Get writeable area bytes.
char * Begin()
Get Buffer start pointer.
size_t WriteFd(SOCKET fd, int *saveErrno) const
Write to Socket.
static constexpr size_t header
size_t ReadableBytes() const
Get readable area bytes.
Buffer(size_t bytes=initialSize)
Constructor Function.
size_t ReadFd(SOCKET fd, int *saveErrno)
Read from Socket.
size_t m_ReaderIndex
Reader pointer.
void Append(const char *data, size_t len)
Append another buffer data.
char * BeginWrite()
Get writeable area pointer.
void Retrieve(size_t len)
Retrieve some buffer data from data area.
const char * Begin() const
Get Buffer start pointer.
virtual ~Buffer()=default
Destructor Function.
static constexpr size_t initialSize
void RetrieveAll()
Retrieve all buffer data.
void expend(size_t len)
Expend buffer size.
size_t HeaderBytes() const
Get header area bytes.
std::vector< char > m_Buffer
Buffer data.
void Append(const std::string &msg)
Append Message to this buffer.
Wrapper of readwrite buffer.
void SetCloseConnection(bool on)
Set CloseConnection.
HttpResponse(bool close)
Constructor Function.
void SetContentType(const std::string &contentType)
Set ContentType.
std::string m_StatusMessage
StatusMessage.
StatusCode m_StatusCode
StatusCode.
bool m_CloseConnection
CloseConnection.
void SetBody(const std::string &body)
Set body.
void SetStatusCode(StatusCode code)
Set StatusCode.
void SetStatusMessage(const std::string &message)
Set StatusMessage.
void AddHeader(const std::string &name, const std::string &value)
Add a header.
void AppendToBuffer(Buffer *output)
Append this response to Buffer.
virtual ~HttpResponse()=default
Destructor Function.
bool CloseConnection() const
Get CloseConnection.
std::unordered_map< std::string, std::string > m_Header
This response header.
sockaddr_in * GetSockAddress()
Get Socket Address.
std::string ToIPPort() const
Get IP and Port from Socket Address.
virtual ~InetAddress()=default
Destructor Function.
std::string ToIP() const
Get IP from Socket Address.
uint16_t ToPort() const
Get Port and Port from Socket Address.
void SetSockAddress(const sockaddr_in &addr)
Set Socket Address.
sockaddr_in m_Address
Socket Address.
InetAddress(uint16_t port=0, std::string ip="127.0.0.1")
Constructor Function.
InetAddress(const sockaddr_in &addr)
Constructor Function.
const sockaddr_in * GetSockAddress() const
Get Socket Address.
This class is Wrapper of current socket address.