NCBI C++ ToolKit
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SH2S_Session Struct Reference

Search Toolkit Book for SH2S_Session

#include "ncbi_http2_session_impl.hpp"
(Private to src/connect.)

+ Inheritance diagram for SH2S_Session:
+ Collaboration diagram for SH2S_Session:

Public Member Functions

template<class... TNgHttp2Cbs>
 SH2S_Session (uv_loop_t *loop, const TAddrNCred &addr_n_cred, bool https, TH2S_SessionsByQueues &sessions_by_queues, TNgHttp2Cbs &&... callbacks)
bool Request (TH2S_RequestEvent request)
template<class TFunc >
bool Event (TH2S_RequestEvent &event, TFunc f)
bool IsFull () const
- Public Member Functions inherited from SUvNgHttp2_SessionBase
template<class ... TArgs>
 SUvNgHttp2_SessionBase (uv_loop_t *loop, const TAddrNCred &addr_n_cred, size_t rd_buf_size, size_t wr_buf_size, bool https, TArgs &&... args)
virtual ~SUvNgHttp2_SessionBase ()
SId GetId () const
void Reset (SUvNgHttp2_Error error, SUv_Tcp::ECloseType close_type=SUv_Tcp::eCloseReset)

Protected Member Functions

int OnData (nghttp2_session *session, uint8_t flags, int32_t stream_id, const uint8_t *data, size_t len)
int OnStreamClose (nghttp2_session *session, int32_t stream_id, uint32_t error_code)
int OnHeader (nghttp2_session *session, const nghttp2_frame *frame, const uint8_t *name, size_t namelen, const uint8_t *value, size_t valuelen, uint8_t flags)
- Protected Member Functions inherited from SUvNgHttp2_SessionBase
bool Send ()
int OnError (nghttp2_session *session, int lib_error_code, const char *msg, size_t len)

Private Types

using TStreams = list< SH2S_IoStream >

Private Member Functions

TStreams::iterator Find (int32_t stream_id)
TStreams::iterator Find (const TH2S_WeakResponseQueue &response_queue)
int OnFrameRecv (nghttp2_session *session, const nghttp2_frame *frame)
void OnReset (SUvNgHttp2_Error error) override
void Push (TH2S_WeakResponseQueue &response_queue, TH2S_ResponseEvent event)

Static Private Member Functions

static int s_OnFrameRecv (nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
static ssize_t s_DataSourceRead (nghttp2_session *, int32_t, uint8_t *buf, size_t length, uint32_t *data_flags, nghttp2_data_source *source, void *user_data)

Private Attributes

TStreams m_Streams
unordered_map< int32_t, TStreams::iterator > m_StreamsByIds
map< TH2S_WeakResponseQueue, TStreams::iterator, owner_less< weak_ptr< TH2S_ResponseQueue > > > m_StreamsByQueues

Additional Inherited Members

- Protected Attributes inherited from SUvNgHttp2_SessionBase
const string m_Authority
SUv_Tcp m_Tcp
unique_ptr< SUvNgHttp2_Tlsm_Tls
SNgHttp2_Session m_Session

Detailed Description

Definition at line 167 of file ncbi_http2_session_impl.hpp.

Member Typedef Documentation

◆ TStreams

using SH2S_Session::TStreams = list<SH2S_IoStream>

Definition at line 186 of file ncbi_http2_session_impl.hpp.

Constructor & Destructor Documentation

◆ SH2S_Session()

template<class... TNgHttp2Cbs>
SH2S_Session::SH2S_Session ( uv_loop_t *  loop,
const TAddrNCred addr_n_cred,
bool  https,
TH2S_SessionsByQueues sessions_by_queues,
TNgHttp2Cbs &&...  callbacks 

Definition at line 297 of file ncbi_http2_session.cpp.

Member Function Documentation

◆ Event()

template<class TFunc >
bool SH2S_Session::Event ( TH2S_RequestEvent event,
TFunc  f 

◆ Find() [1/2]

TStreams::iterator SH2S_Session::Find ( const TH2S_WeakResponseQueue response_queue)

Definition at line 194 of file ncbi_http2_session_impl.hpp.

References m_Streams, and m_StreamsByQueues.

◆ Find() [2/2]

TStreams::iterator SH2S_Session::Find ( int32_t  stream_id)

Definition at line 188 of file ncbi_http2_session_impl.hpp.

References m_Streams, and m_StreamsByIds.

Referenced by Event(), OnData(), OnFrameRecv(), OnHeader(), and OnStreamClose().

◆ IsFull()

bool SH2S_Session::IsFull ( void  ) const

◆ OnData()

int SH2S_Session::OnData ( nghttp2_session *  session,
uint8_t  flags,
int32_t  stream_id,
const uint8_t data,
size_t  len 

Definition at line 406 of file ncbi_http2_session.cpp.

References data, Find(), len, m_Streams, and Push().

◆ OnFrameRecv()

int SH2S_Session::OnFrameRecv ( nghttp2_session *  session,
const nghttp2_frame *  frame 

Definition at line 477 of file ncbi_http2_session.cpp.

References SH2S_Event< TBase >::eEof, Find(), m_Streams, and Push().

Referenced by s_OnFrameRecv().

◆ OnHeader()

int SH2S_Session::OnHeader ( nghttp2_session *  session,
const nghttp2_frame *  frame,
const uint8_t name,
size_t  namelen,
const uint8_t value,
size_t  valuelen,
uint8_t  flags 

Definition at line 440 of file ncbi_http2_session.cpp.

References Find(), m_Streams, n, and rapidjson::value.

◆ OnReset()

void SH2S_Session::OnReset ( SUvNgHttp2_Error  error)

◆ OnStreamClose()

int SH2S_Session::OnStreamClose ( nghttp2_session *  session,
int32_t  stream_id,
uint32_t  error_code 

◆ Push()

void SH2S_Session::Push ( TH2S_WeakResponseQueue response_queue,
TH2S_ResponseEvent  event 

Definition at line 203 of file ncbi_http2_session_impl.hpp.


Referenced by OnData(), OnFrameRecv(), OnReset(), and OnStreamClose().

◆ Request()

bool SH2S_Session::Request ( TH2S_RequestEvent  request)

◆ s_DataSourceRead()

static ssize_t SH2S_Session::s_DataSourceRead ( nghttp2_session *  ,
int32_t  ,
uint8_t buf,
size_t  length,
uint32_t data_flags,
nghttp2_data_source *  source,
void *  user_data 

Definition at line 218 of file ncbi_http2_session_impl.hpp.

References _ASSERT, buf, and rapidjson::source.

Referenced by Request().

◆ s_OnFrameRecv()

static int SH2S_Session::s_OnFrameRecv ( nghttp2_session *  session,
const nghttp2_frame *  frame,
void *  user_data 

Definition at line 212 of file ncbi_http2_session_impl.hpp.

References _ASSERT, and OnFrameRecv().

Member Data Documentation

◆ m_SessionsByQueues

TH2S_SessionsByQueues& SH2S_Session::m_SessionsByQueues

Definition at line 229 of file ncbi_http2_session_impl.hpp.

Referenced by OnReset(), OnStreamClose(), and Request().

◆ m_Streams

TStreams SH2S_Session::m_Streams

◆ m_StreamsByIds

unordered_map<int32_t, TStreams::iterator> SH2S_Session::m_StreamsByIds

Definition at line 227 of file ncbi_http2_session_impl.hpp.

Referenced by Find(), OnReset(), OnStreamClose(), and Request().

◆ m_StreamsByQueues

map<TH2S_WeakResponseQueue, TStreams::iterator, owner_less<weak_ptr<TH2S_ResponseQueue> > > SH2S_Session::m_StreamsByQueues

Definition at line 228 of file ncbi_http2_session_impl.hpp.

Referenced by Find(), OnReset(), OnStreamClose(), and Request().

The documentation for this struct was generated from the following files:
Modified on Sun Apr 21 03:43:04 2024 by rev. 669887