Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::internal::service::http::HttpConnectionEx Struct Referenceabstract

#include <HttpConnectionEx.h>

Inheritance diagram for sese::internal::service::http::HttpConnectionEx:
sese::internal::service::http::HttpConnectionExImpl sese::internal::service::http::HttpsConnectionExImpl

Public Types

using Ptr = std::shared_ptr<HttpConnectionEx>
 

Public Member Functions

Ptr getPtr ()
 
 HttpConnectionEx (const std::shared_ptr< HttpServiceImpl > &service, asio::io_context &io_context, const sese::net::IPAddress::Ptr &addr)
 
virtual ~HttpConnectionEx ()=default
 
void close (uint32_t id)
 
virtual void checkKeepalive ()=0
 
void disponse ()
 
virtual void writeBlocks (const std::vector< asio::const_buffer > &buffers, const std::function< void(const asio::error_code &code)> &callback)=0
 
virtual void writeBlock (const void *buffer, size_t size, const std::function< void(const asio::error_code &code)> &callback)=0
 
virtual void readBlock (char *buffer, size_t length, const std::function< void(const asio::error_code &code)> &callback)=0
 
void readMagic ()
 
void readFrameHeader ()
 
void handleFrameHeader ()
 
uint8_t handleSettingsFrame ()
 
void handleWindowUpdate ()
 
void handleRstStreamFrame ()
 
void handleGoawayFrame ()
 
void handleHeadersFrame ()
 
void handleDataFrame ()
 
void handlePriorityFrame ()
 
void handlePingFrame ()
 
void handleRequest (const HttpStream::Ptr &stream)
 
void handleWrite ()
 
void writeSettingsFrame ()
 
void writeAckFrame ()
 
void writeGoawayFrame (uint32_t latest_stream_id, uint8_t flags, uint32_t error_code, const std::string &msg, bool once=false)
 
void writeRstStreamFrame (uint32_t stream_id, uint8_t flags, uint32_t error_code, bool once=false)
 
void writeWindowUpdateFrame (uint32_t stream_id, uint8_t flags, uint32_t window_size)
 
bool writeHeadersFrame (const HttpStream::Ptr &stream, bool verify_end_stream=true)
 
bool writeDataFrame4Body (const HttpStream::Ptr &stream)
 
bool writeDataFrame4SingleRange (const HttpStream::Ptr &stream)
 
bool writeDataFrame4Ranges (const HttpStream::Ptr &stream)
 
void writeSubheaderAndData (const HttpStream::Ptr &stream, const std::string &subheader, size_t remind)
 

Public Attributes

bool keepalive = false
 
asio::system_timer timer
 
sese::net::IPAddress::Ptr remote_address
 
std::weak_ptr< HttpServiceImplservice
 
bool is_read = false
 
bool is_write = false
 
bool expect_ack = false
 
uint32_t accept_stream_count = 0
 
uint32_t latest_stream_ident = 0
 
sese::net::http::Http2FrameInfo frame {}
 
char temp_buffer [MAX_FRAME_SIZE] {}
 
uint32_t header_table_size = 4096
 
uint32_t enable_push = 0
 
uint32_t max_concurrent_stream = 0
 
uint32_t endpoint_init_window_size = 65535
 
uint32_t endpoint_window_size = 65535
 
uint32_t window_size = 65535
 
uint32_t endpoint_max_frame_size = 16384
 
uint32_t max_frame_size = 16384
 
uint32_t max_header_list_size = 0
 
sese::net::http::DynamicTable req_dynamic_table
 
sese::net::http::DynamicTable resp_dynamic_table
 
std::map< uint32_t, HttpStream::Ptrstreams
 
std::set< uint32_t > closed_streams
 
std::vector< sese::net::http::Http2Frame::Ptrpre_vector
 Send queues.
 
std::vector< sese::net::http::Http2Frame::Ptrvector
 
std::vector< asio::const_buffer > asio_buffers
 

Static Public Attributes

static constexpr uint32_t MAX_FRAME_SIZE = 16384
 
static constexpr uint32_t INIT_WINDOW_SIZE = 65535
 
static constexpr uint32_t HEADER_TABLE_SIZE = 8192
 
static constexpr uint32_t MAX_CONCURRENT_STREAMS = 16
 

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ HttpConnectionEx()

sese::internal::service::http::HttpConnectionEx::HttpConnectionEx ( const std::shared_ptr< HttpServiceImpl > & service,
asio::io_context & io_context,
const sese::net::IPAddress::Ptr & addr )

◆ ~HttpConnectionEx()

virtual sese::internal::service::http::HttpConnectionEx::~HttpConnectionEx ( )
virtualdefault

Member Function Documentation

◆ checkKeepalive()

virtual void sese::internal::service::http::HttpConnectionEx::checkKeepalive ( )
pure virtual

◆ close()

void sese::internal::service::http::HttpConnectionEx::close ( uint32_t id)

Close stream

Parameters
idStream ID

◆ disponse()

void sese::internal::service::http::HttpConnectionEx::disponse ( )

◆ getPtr()

Ptr sese::internal::service::http::HttpConnectionEx::getPtr ( )
inline

◆ handleDataFrame()

void sese::internal::service::http::HttpConnectionEx::handleDataFrame ( )

◆ handleFrameHeader()

void sese::internal::service::http::HttpConnectionEx::handleFrameHeader ( )

◆ handleGoawayFrame()

void sese::internal::service::http::HttpConnectionEx::handleGoawayFrame ( )

References FromBigEndian32().

◆ handleHeadersFrame()

void sese::internal::service::http::HttpConnectionEx::handleHeadersFrame ( )

References FromBigEndian32().

◆ handlePingFrame()

void sese::internal::service::http::HttpConnectionEx::handlePingFrame ( )

◆ handlePriorityFrame()

void sese::internal::service::http::HttpConnectionEx::handlePriorityFrame ( )

References FromBigEndian32().

◆ handleRequest()

void sese::internal::service::http::HttpConnectionEx::handleRequest ( const HttpStream::Ptr & stream)

◆ handleRstStreamFrame()

void sese::internal::service::http::HttpConnectionEx::handleRstStreamFrame ( )

References close(), and FromBigEndian32().

◆ handleSettingsFrame()

uint8_t sese::internal::service::http::HttpConnectionEx::handleSettingsFrame ( )

◆ handleWindowUpdate()

void sese::internal::service::http::HttpConnectionEx::handleWindowUpdate ( )

◆ handleWrite()

◆ readBlock()

virtual void sese::internal::service::http::HttpConnectionEx::readBlock ( char * buffer,
size_t length,
const std::function< void(const asio::error_code &code)> & callback )
pure virtual

Read block function. This function ensures that the specified size of the buffer is completely read, and calls back immediately if an error occurs

Parameters
bufferPointer to the buffer
lengthSize of the buffer
callbackCompletion callback function

Implemented in sese::internal::service::http::HttpConnectionExImpl, and sese::internal::service::http::HttpsConnectionExImpl.

◆ readFrameHeader()

void sese::internal::service::http::HttpConnectionEx::readFrameHeader ( )

References FromBigEndian32().

◆ readMagic()

void sese::internal::service::http::HttpConnectionEx::readMagic ( )

◆ writeAckFrame()

void sese::internal::service::http::HttpConnectionEx::writeAckFrame ( )

◆ writeBlock()

virtual void sese::internal::service::http::HttpConnectionEx::writeBlock ( const void * buffer,
size_t size,
const std::function< void(const asio::error_code &code)> & callback )
pure virtual

Write block function. This function ensures that a single block of buffer is completely written, and calls back immediately if an error occurs

Parameters
bufferSingle block buffer
sizeSize of the buffer
callbackCompletion callback function

Implemented in sese::internal::service::http::HttpConnectionExImpl, and sese::internal::service::http::HttpsConnectionExImpl.

◆ writeBlocks()

virtual void sese::internal::service::http::HttpConnectionEx::writeBlocks ( const std::vector< asio::const_buffer > & buffers,
const std::function< void(const asio::error_code &code)> & callback )
pure virtual

Write block function. This function ensures that the specified buffer is completely written, and calls back immediately if an error occurs

Parameters
buffersBuffer
callbackCompletion callback function

Implemented in sese::internal::service::http::HttpConnectionExImpl, and sese::internal::service::http::HttpsConnectionExImpl.

◆ writeDataFrame4Body()

bool sese::internal::service::http::HttpConnectionEx::writeDataFrame4Body ( const HttpStream::Ptr & stream)

Write the controller's response body into a DATA frame

Parameters
streamOperating stream
Returns
Whether the current stream has been fully processed

References sese::net::http::FRAME_FLAG_END_STREAM, and sese::net::http::FRAME_TYPE_DATA.

◆ writeDataFrame4Ranges()

bool sese::internal::service::http::HttpConnectionEx::writeDataFrame4Ranges ( const HttpStream::Ptr & stream)

Write multi-range file response into a DATA frame

Parameters
streamOperating stream
Returns
Whether the current stream has been fully processed

References sese::net::http::FRAME_FLAG_END_STREAM, sese::net::http::FRAME_TYPE_DATA, and HTTPD_BOUNDARY.

◆ writeDataFrame4SingleRange()

bool sese::internal::service::http::HttpConnectionEx::writeDataFrame4SingleRange ( const HttpStream::Ptr & stream)

Write single-range file response into a DATA frame

Parameters
streamOperating stream
Returns
Whether the current stream has been fully processed

References sese::net::http::FRAME_FLAG_END_STREAM.

◆ writeGoawayFrame()

void sese::internal::service::http::HttpConnectionEx::writeGoawayFrame ( uint32_t latest_stream_id,
uint8_t flags,
uint32_t error_code,
const std::string & msg,
bool once = false )

References f, and ToBigEndian32().

◆ writeHeadersFrame()

bool sese::internal::service::http::HttpConnectionEx::writeHeadersFrame ( const HttpStream::Ptr & stream,
bool verify_end_stream = true )

Write HEADERS frame

Parameters
streamOperating stream
verify_end_streamWhether to determine END_STREAM through response body
Returns
Whether the current stream has been fully processed

References sese::net::http::FRAME_FLAG_END_HEADERS, sese::net::http::FRAME_FLAG_END_STREAM, and sese::net::http::FRAME_TYPE_HEADERS.

◆ writeRstStreamFrame()

void sese::internal::service::http::HttpConnectionEx::writeRstStreamFrame ( uint32_t stream_id,
uint8_t flags,
uint32_t error_code,
bool once = false )

References f, and ToBigEndian32().

◆ writeSettingsFrame()

void sese::internal::service::http::HttpConnectionEx::writeSettingsFrame ( )

References ToBigEndian16(), and ToBigEndian32().

◆ writeSubheaderAndData()

void sese::internal::service::http::HttpConnectionEx::writeSubheaderAndData ( const HttpStream::Ptr & stream,
const std::string & subheader,
size_t remind )

Process the first DATA frame of the range

Warning
This function is highly coupled and intended for reuse
Parameters
streamOperating stream
subheaderRange header
remindRemaining window size after removing the range header
See also
writeDataFrame4Ranges

References sese::net::http::FRAME_TYPE_DATA.

◆ writeWindowUpdateFrame()

void sese::internal::service::http::HttpConnectionEx::writeWindowUpdateFrame ( uint32_t stream_id,
uint8_t flags,
uint32_t window_size )

Member Data Documentation

◆ accept_stream_count

uint32_t sese::internal::service::http::HttpConnectionEx::accept_stream_count = 0

◆ asio_buffers

std::vector<asio::const_buffer> sese::internal::service::http::HttpConnectionEx::asio_buffers

◆ closed_streams

std::set<uint32_t> sese::internal::service::http::HttpConnectionEx::closed_streams

◆ enable_push

uint32_t sese::internal::service::http::HttpConnectionEx::enable_push = 0

◆ endpoint_init_window_size

uint32_t sese::internal::service::http::HttpConnectionEx::endpoint_init_window_size = 65535

◆ endpoint_max_frame_size

uint32_t sese::internal::service::http::HttpConnectionEx::endpoint_max_frame_size = 16384

◆ endpoint_window_size

uint32_t sese::internal::service::http::HttpConnectionEx::endpoint_window_size = 65535

◆ expect_ack

bool sese::internal::service::http::HttpConnectionEx::expect_ack = false

◆ frame

sese::net::http::Http2FrameInfo sese::internal::service::http::HttpConnectionEx::frame {}

◆ HEADER_TABLE_SIZE

uint32_t sese::internal::service::http::HttpConnectionEx::HEADER_TABLE_SIZE = 8192
staticconstexpr

◆ header_table_size

uint32_t sese::internal::service::http::HttpConnectionEx::header_table_size = 4096

◆ INIT_WINDOW_SIZE

uint32_t sese::internal::service::http::HttpConnectionEx::INIT_WINDOW_SIZE = 65535
staticconstexpr

◆ is_read

bool sese::internal::service::http::HttpConnectionEx::is_read = false

◆ is_write

bool sese::internal::service::http::HttpConnectionEx::is_write = false

◆ keepalive

bool sese::internal::service::http::HttpConnectionEx::keepalive = false

◆ latest_stream_ident

uint32_t sese::internal::service::http::HttpConnectionEx::latest_stream_ident = 0

◆ max_concurrent_stream

uint32_t sese::internal::service::http::HttpConnectionEx::max_concurrent_stream = 0

◆ MAX_CONCURRENT_STREAMS

uint32_t sese::internal::service::http::HttpConnectionEx::MAX_CONCURRENT_STREAMS = 16
staticconstexpr

◆ MAX_FRAME_SIZE

uint32_t sese::internal::service::http::HttpConnectionEx::MAX_FRAME_SIZE = 16384
staticconstexpr

◆ max_frame_size

uint32_t sese::internal::service::http::HttpConnectionEx::max_frame_size = 16384

◆ max_header_list_size

uint32_t sese::internal::service::http::HttpConnectionEx::max_header_list_size = 0

◆ pre_vector

std::vector<sese::net::http::Http2Frame::Ptr> sese::internal::service::http::HttpConnectionEx::pre_vector

Send queues.

◆ remote_address

sese::net::IPAddress::Ptr sese::internal::service::http::HttpConnectionEx::remote_address

◆ req_dynamic_table

sese::net::http::DynamicTable sese::internal::service::http::HttpConnectionEx::req_dynamic_table

◆ resp_dynamic_table

sese::net::http::DynamicTable sese::internal::service::http::HttpConnectionEx::resp_dynamic_table

◆ service

std::weak_ptr<HttpServiceImpl> sese::internal::service::http::HttpConnectionEx::service

◆ streams

std::map<uint32_t, HttpStream::Ptr> sese::internal::service::http::HttpConnectionEx::streams

◆ temp_buffer

char sese::internal::service::http::HttpConnectionEx::temp_buffer[MAX_FRAME_SIZE] {}

◆ timer

asio::system_timer sese::internal::service::http::HttpConnectionEx::timer

◆ vector

std::vector<sese::net::http::Http2Frame::Ptr> sese::internal::service::http::HttpConnectionEx::vector

◆ window_size

uint32_t sese::internal::service::http::HttpConnectionEx::window_size = 65535

The documentation for this struct was generated from the following files: