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

Search Toolkit Book for SUv_Tcp

#include <connect/impl/ncbi_uv_nghttp2.hpp>

+ Inheritance diagram for SUv_Tcp:
+ Collaboration diagram for SUv_Tcp:

Public Types

enum  ECloseType { eNormalClose , eCloseReset }
 
using TPort = unsigned short
 
using TConnectCb = function< void(int)>
 
using TReadCb = function< void(const char *, ssize_t)>
 
using TWriteCb = function< void(int)>
 

Public Member Functions

 SUv_Tcp (uv_loop_t *loop, const SSocketAddress &address, size_t rd_buf_size, size_t wr_buf_size, TConnectCb connect_cb, TReadCb read_cb, TWriteCb write_cb)
 
int Write ()
 
void Close (ECloseType close_type=eCloseReset)
 
vector< char > & GetWriteBuffer ()
 
TPort GetLocalPort () const
 
- Public Member Functions inherited from SUv_Handle< uv_tcp_t >
 SUv_Handle (uv_close_cb cb=nullptr)
 
void Close ()
 
void Ref ()
 
void Unref ()
 

Private Types

enum  EState {
  eClosed , eConnecting , eConnected , eClosing ,
  eRestarting
}
 

Private Member Functions

int Connect ()
 
bool CloseReset (ECloseType close_type)
 
void OnConnect (uv_connect_t *req, int status)
 
void OnAlloc (uv_handle_t *, size_t suggested_size, uv_buf_t *buf)
 
void OnRead (uv_stream_t *, ssize_t nread, const uv_buf_t *buf)
 
void OnWrite (uv_write_t *, int status)
 
void OnClose (uv_handle_t *)
 

Static Private Member Functions

template<class THandle , class ... TArgs1, class ... TArgs2>
static void OnCallback (void(SUv_Tcp::*member)(THandle *, TArgs1...), THandle *handle, TArgs2 &&... args)
 
static void s_OnAlloc (uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf)
 
static void s_OnRead (uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)
 
static void s_OnWrite (uv_write_t *req, int status)
 
static void s_OnConnect (uv_connect_t *req, int status)
 
static void s_OnClose (uv_handle_t *handle)
 

Private Attributes

uv_loop_t * m_Loop
 
EState m_State = eClosed
 
vector< char > m_ReadBuffer
 
SUv_Connect m_Connect
 
SUv_Write m_Write
 
TPort m_LocalPort = 0
 
TConnectCb m_ConnectCb
 
TReadCb m_ReadCb
 
TWriteCb m_WriteCb
 

Additional Inherited Members

- Static Public Member Functions inherited from SUv_Handle< uv_tcp_t >
static auto GetThat (uv_tcp_t *handle)
 

Detailed Description

Definition at line 171 of file ncbi_uv_nghttp2.hpp.

Member Typedef Documentation

◆ TConnectCb

using SUv_Tcp::TConnectCb = function<void(int)>

Definition at line 176 of file ncbi_uv_nghttp2.hpp.

◆ TPort

using SUv_Tcp::TPort = unsigned short

Definition at line 173 of file ncbi_uv_nghttp2.hpp.

◆ TReadCb

using SUv_Tcp::TReadCb = function<void(const char*, ssize_t)>

Definition at line 177 of file ncbi_uv_nghttp2.hpp.

◆ TWriteCb

using SUv_Tcp::TWriteCb = function<void(int)>

Definition at line 178 of file ncbi_uv_nghttp2.hpp.

Member Enumeration Documentation

◆ ECloseType

Enumerator
eNormalClose 
eCloseReset 

Definition at line 174 of file ncbi_uv_nghttp2.hpp.

◆ EState

enum SUv_Tcp::EState
private
Enumerator
eClosed 
eConnecting 
eConnected 
eClosing 
eRestarting 

Definition at line 190 of file ncbi_uv_nghttp2.hpp.

Constructor & Destructor Documentation

◆ SUv_Tcp()

SUv_Tcp::SUv_Tcp ( uv_loop_t *  loop,
const SSocketAddress address,
size_t  rd_buf_size,
size_t  wr_buf_size,
TConnectCb  connect_cb,
TReadCb  read_cb,
TWriteCb  write_cb 
)

Member Function Documentation

◆ Close()

void SUv_Tcp::Close ( ECloseType  close_type = eCloseReset)

◆ CloseReset()

bool SUv_Tcp::CloseReset ( ECloseType  close_type)
private

Definition at line 239 of file ncbi_uv_nghttp2.cpp.

Referenced by Close().

◆ Connect()

int SUv_Tcp::Connect ( )
private

◆ GetLocalPort()

TPort SUv_Tcp::GetLocalPort ( ) const
inline

Definition at line 187 of file ncbi_uv_nghttp2.hpp.

References m_LocalPort.

Referenced by SUvNgHttp2_SessionBase::GetId(), and SPSG_IoSession::ProcessRequest().

◆ GetWriteBuffer()

vector<char>& SUv_Tcp::GetWriteBuffer ( )
inline

Definition at line 186 of file ncbi_uv_nghttp2.hpp.

References SUv_Write::GetBuffer(), and m_Write.

Referenced by SUvNgHttp2_SessionBase::SUvNgHttp2_SessionBase().

◆ OnAlloc()

void SUv_Tcp::OnAlloc ( uv_handle_t *  ,
size_t  suggested_size,
uv_buf_t *  buf 
)
private

Definition at line 356 of file ncbi_uv_nghttp2.cpp.

References buf, len, m_ReadBuffer, and NCBI_UV_TCP_TRACE.

Referenced by s_OnAlloc().

◆ OnCallback()

template<class THandle , class ... TArgs1, class ... TArgs2>
static void SUv_Tcp::OnCallback ( void(SUv_Tcp::*)(THandle *, TArgs1...)  member,
THandle *  handle,
TArgs2 &&...  args 
)
inlinestaticprivate

Definition at line 208 of file ncbi_uv_nghttp2.hpp.

Referenced by s_OnAlloc(), s_OnClose(), s_OnConnect(), s_OnRead(), and s_OnWrite().

◆ OnClose()

void SUv_Tcp::OnClose ( uv_handle_t *  )
private

Definition at line 389 of file ncbi_uv_nghttp2.cpp.

References Connect(), eClosed, eRestarting, m_State, and NCBI_UV_TCP_TRACE.

Referenced by s_OnClose().

◆ OnConnect()

void SUv_Tcp::OnConnect ( uv_connect_t *  req,
int  status 
)
private

◆ OnRead()

void SUv_Tcp::OnRead ( uv_stream_t *  ,
ssize_t  nread,
const uv_buf_t *  buf 
)
private

◆ OnWrite()

void SUv_Tcp::OnWrite ( uv_write_t *  req,
int  status 
)
private

◆ s_OnAlloc()

static void SUv_Tcp::s_OnAlloc ( uv_handle_t *  handle,
size_t  suggested_size,
uv_buf_t *  buf 
)
inlinestaticprivate

Definition at line 214 of file ncbi_uv_nghttp2.hpp.

References buf, OnAlloc(), and OnCallback().

Referenced by OnConnect().

◆ s_OnClose()

static void SUv_Tcp::s_OnClose ( uv_handle_t *  handle)
inlinestaticprivate

Definition at line 218 of file ncbi_uv_nghttp2.hpp.

References OnCallback(), and OnClose().

◆ s_OnConnect()

static void SUv_Tcp::s_OnConnect ( uv_connect_t *  req,
int  status 
)
inlinestaticprivate

Definition at line 217 of file ncbi_uv_nghttp2.hpp.

References OnCallback(), and OnConnect().

Referenced by Connect().

◆ s_OnRead()

static void SUv_Tcp::s_OnRead ( uv_stream_t *  stream,
ssize_t  nread,
const uv_buf_t *  buf 
)
inlinestaticprivate

Definition at line 215 of file ncbi_uv_nghttp2.hpp.

References buf, OnCallback(), and OnRead().

Referenced by OnConnect().

◆ s_OnWrite()

static void SUv_Tcp::s_OnWrite ( uv_write_t *  req,
int  status 
)
inlinestaticprivate

Definition at line 216 of file ncbi_uv_nghttp2.hpp.

References OnCallback(), and OnWrite().

Referenced by Write().

◆ Write()

int SUv_Tcp::Write ( )

Member Data Documentation

◆ m_Connect

SUv_Connect SUv_Tcp::m_Connect
private

Definition at line 223 of file ncbi_uv_nghttp2.hpp.

Referenced by Connect().

◆ m_ConnectCb

TConnectCb SUv_Tcp::m_ConnectCb
private

Definition at line 226 of file ncbi_uv_nghttp2.hpp.

Referenced by OnConnect().

◆ m_LocalPort

TPort SUv_Tcp::m_LocalPort = 0
private

Definition at line 225 of file ncbi_uv_nghttp2.hpp.

Referenced by GetLocalPort(), and OnConnect().

◆ m_Loop

uv_loop_t* SUv_Tcp::m_Loop
private

Definition at line 220 of file ncbi_uv_nghttp2.hpp.

Referenced by Connect().

◆ m_ReadBuffer

vector<char> SUv_Tcp::m_ReadBuffer
private

Definition at line 222 of file ncbi_uv_nghttp2.hpp.

Referenced by OnAlloc(), and SUv_Tcp().

◆ m_ReadCb

TReadCb SUv_Tcp::m_ReadCb
private

Definition at line 227 of file ncbi_uv_nghttp2.hpp.

Referenced by OnRead().

◆ m_State

EState SUv_Tcp::m_State = eClosed
private

Definition at line 221 of file ncbi_uv_nghttp2.hpp.

Referenced by Close(), Connect(), OnClose(), OnConnect(), and Write().

◆ m_Write

SUv_Write SUv_Tcp::m_Write
private

Definition at line 224 of file ncbi_uv_nghttp2.hpp.

Referenced by Close(), GetWriteBuffer(), OnWrite(), and Write().

◆ m_WriteCb

TWriteCb SUv_Tcp::m_WriteCb
private

Definition at line 228 of file ncbi_uv_nghttp2.hpp.

Referenced by OnWrite().


The documentation for this struct was generated from the following files:
Modified on Wed May 22 11:34:02 2024 by modify_doxy.py rev. 669887