A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/ncbi__uv__nghttp2_8cpp_source.html below:

NCBI C++ ToolKit: src/connect/ncbi_uv_nghttp2.cpp Source File

32 #define HAVE_LOCAL_NCBI_BUILD_VER_H 1 49 #define NCBI_UV_WRITE_TRACE(message) _TRACE(message) 50 #define NCBI_UV_TCP_TRACE(message) _TRACE(message) 51 #define NCBI_NGHTTP2_SESSION_TRACE(message) _TRACE(message) 52 #define NCBI_UVNGHTTP2_TLS_TRACE(message) _TRACE(message) 53 #define NCBI_UVNGHTTP2_SESSION_TRACE(message) _TRACE(message) 55 using namespace

NCBI_XCONNECT;

65

m_UserData(user_data),

88  buf

.len =

static_cast<

decltype(

buf

.

len

)

>

(

data

.size());

90  auto

try_rv = uv_try_write(handle, &

buf

, 1);

93  if

(try_rv ==

static_cast<int>

(

data

.size())) {

99

}

else if

(try_rv > 0) {

101  _ASSERT

(try_rv <

static_cast<int>

(

data

.size()));

106

}

else if

(try_rv != UV_EAGAIN) {

111  auto

rv = uv_write(&request, handle, &

buf

, 1, cb);

123  if

(!

buffer

.in_progress) {

140  if

(&

buffer

.request == req) {

146  buffer

.in_progress =

false

;

160  buffer

.in_progress =

false

;

189  return

uv_tcp_connect(&

m_Request

, handle,

reinterpret_cast<

sockaddr*

>

(&

m_Address

), cb);

197

m_Connect(this, address),

198

m_Write(this, wr_buf_size),

199

m_ConnectCb(connect_cb),

240 #if UV_VERSION_HEX < 0x12000 252  auto

rv = uv_tcp_close_reset(

this

,

s_OnClose

);

267  auto

rv = uv_read_stop(

reinterpret_cast<

uv_stream_t*

>

(

this

));

296  auto

rv = uv_tcp_init(

m_Loop

,

this

);

320

status = uv_tcp_nodelay(

this

, 1);

326  struct

sockaddr_storage name;

327  auto

namelen =

static_cast<int>

(

sizeof

(name));

329

status = uv_tcp_getsockname(

this

,

reinterpret_cast<

sockaddr*

>

(&name), &namelen);

332  if

(name.ss_family == AF_INET) {

333  auto

sin =

reinterpret_cast<

sockaddr_in*

>

(&name);

407  if

(

auto

tci = TUvNgHttp2_TestIdentity::GetDefault(); !tci.empty()) {

408  if

(tci.starts_with(

"ua_"

)) {

416  const auto

& full_version = app->GetFullVersion();

417  const auto

& app_version = full_version.GetVersionInfo();

418  const auto

pkg_version = full_version.GetPackageVersion();

420

assign(app->GetProgramDisplayName());

423  if

(app_version.IsAny() && !pkg_version.IsAny()) {

425  append

(pkg_version.Print());

427  append

(app_version.Print());

430

assign(

"UNKNOWN/UNKNOWN"

);

433  append

(

" NcbiCxxToolkit/" 434

#

if

defined(NCBI_PRODUCTION_VER)

440

#elif defined(NCBI_SC_VERSION)

455

nghttp2_on_data_chunk_recv_callback on_data,

456

nghttp2_on_stream_close_callback on_stream_close,

457

nghttp2_on_header_callback on_header,

458

nghttp2_error_callback2 on_error,

459

nghttp2_on_frame_recv_callback on_frame_recv) :

460

m_UserData(user_data),

462

m_OnStreamClose(on_stream_close),

463

m_OnHeader(on_header),

465

m_OnFrameRecv(on_frame_recv),

466

m_MaxStreams(max_streams, max_streams)

475

nghttp2_session_callbacks* callbacks;

476

nghttp2_session_callbacks_new(&callbacks);

478

nghttp2_session_callbacks_set_on_data_chunk_recv_callback(callbacks,

m_OnData

);

479

nghttp2_session_callbacks_set_on_stream_close_callback( callbacks,

m_OnStreamClose

);

480

nghttp2_session_callbacks_set_on_header_callback( callbacks,

m_OnHeader

);

481

nghttp2_session_callbacks_set_error_callback2( callbacks,

m_OnError

);

485

nghttp2_session_callbacks_del(callbacks);

487

nghttp2_settings_entry iv[1] = {

488

{NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,

m_MaxStreams

.second}

492  if

(

auto

rv = nghttp2_submit_settings(

m_Session

, NGHTTP2_FLAG_NONE, iv,

sizeof

(iv) /

sizeof

(iv[0]))) {

497  auto

max_streams = nghttp2_session_get_remote_settings(

m_Session

, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS);

510  auto

rv = nghttp2_session_terminate_session(

m_Session

, NGHTTP2_NO_ERROR);

531  if

(

auto

rv =

Init

())

return

rv;

533  auto

rv = nghttp2_submit_request(

m_Session

,

nullptr

, nva, nvlen, data_prd,

nullptr

);

546  if

(

auto

rv =

Init

())

return

rv;

548  auto

rv = nghttp2_session_resume_data(

m_Session

, stream_id);

561  if

(

auto

rv =

Init

())

return

rv;

565  while

(nghttp2_session_want_write(

m_Session

)) {

587  if

(nghttp2_session_want_read(

m_Session

) == 0) {

599  if

(

auto

rv =

Init

())

return

rv;

628  return static_cast<int>

(exchange(nread, 0));

648  int Write

()

override

;

649  int Close

()

override

;

712

m_ReadBuffer(rd_buf_size),

713

m_GetWriteBuf(get_write_buf),

714

m_Protocols({

"h2"

,

nullptr

})

717

m_WriteBuffer.reserve(wr_buf_size),

729 #if MBEDTLS_VERSION_MAJOR >= 3 764  const auto

host_name = addr_n_cred.first.GetHostName();

774  const auto

& cert = addr_n_cred.second.first;

775  const auto

& pkey = addr_n_cred.second.second;

777  if

(cert.empty() || pkey.empty()) {

781  auto

cp_rv =

mbedtls_x509_crt_parse

(&m_Cert,

reinterpret_cast<const unsigned char

*

>

(cert.data()), cert.size() + 1);

789

&m_Pkey,

reinterpret_cast<const unsigned char

*

>

(pkey.data()),

790

pkey.size() + 1,

nullptr

, 0

872  if

(

auto

rv =

Init

())

return

rv;

887  if

(

auto

rv =

Init

())

return

rv;

908  return static_cast<int>

(written);

937  return static_cast<int>

(copied);

950

write_buf.insert(write_buf.end(),

buf

,

buf

+

len

);

951  return static_cast<int>

(

len

);

974  auto

tls_rv =

m_Tls

->Write();

1026  auto

read_rv =

m_Tls

->Read(

buf

, nread);

1034  if

(nread == 0)

break

;

1036  Reset

(

"Some encrypted data was ignored"

);

1038

}

else if

(read_rv < 0) {

1047

}

else if

(recv_rv != read_rv) {

1048  Reset

(

"Processed size does not equal to received"

);

1066  if

(!rv && shutdown) {

CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...

Platform Security Architecture cryptography module.

void mbedtls_ctr_drbg_free(mbedtls_ctr_drbg_context *ctx)

This function resets CTR_DRBG context to the state immediately after initial call of mbedtls_ctr_drbg...

void mbedtls_ctr_drbg_init(mbedtls_ctr_drbg_context *ctx)

This function initializes the CTR_DRBG context, and prepares it for mbedtls_ctr_drbg_seed() or mbedtl...

int mbedtls_ctr_drbg_seed(mbedtls_ctr_drbg_context *ctx, int(*f_entropy)(void *, unsigned char *, size_t), void *p_entropy, const unsigned char *custom, size_t len)

This function seeds and sets up the CTR_DRBG entropy source for future reseeds.

int mbedtls_ctr_drbg_random(void *p_rng, unsigned char *output, size_t output_len)

This function uses CTR_DRBG to generate random data.

void mbedtls_entropy_free(mbedtls_entropy_context *ctx)

Free the data in the context.

int mbedtls_entropy_func(void *data, unsigned char *output, size_t len)

Retrieve entropy from the accumulator (Maximum length: MBEDTLS_ENTROPY_BLOCK_SIZE) (Thread-safe if MB...

void mbedtls_entropy_init(mbedtls_entropy_context *ctx)

Initialize the context.

static void DLIST_NAME() append(DLIST_LIST_TYPE *list, DLIST_TYPE *item)

static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)

static CNcbiApplicationGuard InstanceGuard(void)

Singleton method.

#define _DEBUG_CODE(code)

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

#define NCBI_AS_STRING(value)

Convert some value to string even if this value is macro itself.

static unsigned short HostToNetShort(unsigned short value)

static unsigned short NetToHostShort(unsigned short value)

#define PSA_SUCCESS

The action was completed successfully.

psa_status_t psa_crypto_init(void)

Library initialization.

#define NCBI_DEVELOPMENT_VER

#define MBEDTLS_VERSION_MAJOR

The version number x.y.z is split into three parts.

const struct ncbi::grid::netcache::search::fields::SIZE size

const GenericPointer< typename T::ValueType > T2 value

#define NCBI_SUBVERSION_REVISION

NCBI_PARAM_DEF(string, UVNGHTTP2, test_identity, "")

#define NCBI_UV_WRITE_TRACE(message)

#define NCBI_UVNGHTTP2_TLS_TRACE(message)

#define NCBI_UV_TCP_TRACE(message)

bool s_WantReadOrWrite(int rv)

#define NCBI_UVNGHTTP2_SESSION_TRACE(message)

#define NCBI_NGHTTP2_SESSION_TRACE(message)

Defines the CNcbiApplication and CAppException classes for creating NCBI applications.

#define mbedtls_ssl_conf_own_cert

#define mbedtls_pk_parse_key

#define mbedtls_ssl_set_hostname

#define mbedtls_x509_crt_init

#define mbedtls_x509_crt_free

#define mbedtls_x509_crt_parse

#define mbedtls_ssl_conf_alpn_protocols

void mbedtls_pk_init(mbedtls_pk_context *ctx)

Initialize a mbedtls_pk_context (as NONE).

void mbedtls_pk_free(mbedtls_pk_context *ctx)

Free the components of a mbedtls_pk_context.

Defines CRequestContext class for NCBI C++ diagnostic API.

static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)

void mbedtls_strerror(int errnum, char *buffer, size_t buflen)

Translate an Mbed TLS error code into a string representation.

#define MBEDTLS_SSL_VERIFY_NONE

#define MBEDTLS_SSL_IS_CLIENT

int mbedtls_ssl_session_reset(mbedtls_ssl_context *ssl)

Reset an already initialized SSL context for re-use while retaining application-set variables,...

void mbedtls_ssl_free(mbedtls_ssl_context *ssl)

Free referenced items in an SSL context and clear memory.

@ MBEDTLS_SSL_VERSION_TLS1_2

int mbedtls_ssl_handshake(mbedtls_ssl_context *ssl)

Perform the SSL handshake.

uint32_t mbedtls_ssl_get_verify_result(const mbedtls_ssl_context *ssl)

Return the result of the certificate verification.

void mbedtls_ssl_conf_authmode(mbedtls_ssl_config *conf, int authmode)

Set the certificate verification mode Default: NONE on server, REQUIRED on client.

int mbedtls_ssl_write(mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len)

Try to write exactly 'len' application data bytes.

#define MBEDTLS_ERR_SSL_WANT_WRITE

Connection requires a write call.

#define MBEDTLS_ERR_SSL_WANT_READ

No data of requested type currently available on underlying transport.

void mbedtls_ssl_config_free(mbedtls_ssl_config *conf)

Free an SSL configuration context.

void mbedtls_ssl_init(mbedtls_ssl_context *ssl)

Initialize an SSL context Just makes the context ready for mbedtls_ssl_setup() or mbedtls_ssl_free()

void mbedtls_ssl_set_bio(mbedtls_ssl_context *ssl, void *p_bio, mbedtls_ssl_send_t *f_send, mbedtls_ssl_recv_t *f_recv, mbedtls_ssl_recv_timeout_t *f_recv_timeout)

Set the underlying BIO callbacks for write, read and read-with-timeout.

int mbedtls_ssl_config_defaults(mbedtls_ssl_config *conf, int endpoint, int transport, int preset)

Load reasonable default SSL configuration values.

int mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len)

Read at most 'len' application data bytes.

void mbedtls_ssl_config_init(mbedtls_ssl_config *conf)

Initialize an SSL configuration context Just makes the context ready for mbedtls_ssl_config_defaults(...

static void mbedtls_ssl_conf_max_tls_version(mbedtls_ssl_config *conf, mbedtls_ssl_protocol_version tls_version)

Set the maximum supported version sent from the client side and/or accepted at the server side.

int mbedtls_ssl_close_notify(mbedtls_ssl_context *ssl)

Notify the peer that the connection is being closed.

#define MBEDTLS_SSL_TRANSPORT_STREAM

void mbedtls_ssl_conf_rng(mbedtls_ssl_config *conf, mbedtls_f_rng_t *f_rng, void *p_rng)

Set the random number generator callback.

int mbedtls_ssl_setup(mbedtls_ssl_context *ssl, const mbedtls_ssl_config *conf)

Set up an SSL context for use.

#define MBEDTLS_SSL_PRESET_DEFAULT

SNgHttp2_Session(void *user_data, uint32_t max_streams, nghttp2_on_data_chunk_recv_callback on_data, nghttp2_on_stream_close_callback on_stream_close, nghttp2_on_header_callback on_header, nghttp2_error_callback2 on_error, nghttp2_on_frame_recv_callback on_frame_recv=nullptr)

TInt x_DelOnError(TInt rv)

nghttp2_on_frame_recv_callback m_OnFrameRecv

pair< uint32_t, const uint32_t > m_MaxStreams

void Del(int terminate_rv)

int32_t Submit(const nghttp2_nv *nva, size_t nvlen, nghttp2_data_provider *data_prd=nullptr)

int Resume(int32_t stream_id)

nghttp2_on_stream_close_callback m_OnStreamClose

nghttp2_error_callback2 m_OnError

ssize_t Recv(const uint8_t *buffer, size_t size)

ssize_t Send(vector< char > &buffer)

nghttp2_session * m_Session

nghttp2_on_header_callback m_OnHeader

nghttp2_on_data_chunk_recv_callback m_OnData

string GetHostName() const

const char * operator()(T e)

static SUvNgHttp2_Error FromNgHttp2(T e, const char *w)

static const char * LibuvStr(T e)

static const char * NgHttp2Str(T e)

static SUvNgHttp2_Error FromMbedTls(T e, const char *w)

static SMbedTlsStr MbedTlsStr(T e)

static SUvNgHttp2_Error FromLibuv(T e, const char *w)

void OnRead(const char *buf, ssize_t nread)

void OnConnect(int status)

int OnError(nghttp2_session *session, int lib_error_code, const char *msg, size_t len)

virtual void OnReset(SUvNgHttp2_Error error)=0

SNgHttp2_Session m_Session

void Reset(SUvNgHttp2_Error error, SUv_Tcp::ECloseType close_type=SUv_Tcp::eCloseReset, bool shutdown=false)

unique_ptr< SUvNgHttp2_Tls > m_Tls

void operator()(first_type *p) const

auto operator()(first_type b, second_type l)

SUvNgHttp2_TlsImpl & operator=(SUvNgHttp2_TlsImpl &&)=delete

SIncomingData m_IncomingData

mbedtls_entropy_context m_Entropy

int OnRecv(unsigned char *buf, size_t len)

vector< char > m_WriteBuffer

static int s_OnSend(void *ctx, const unsigned char *buf, size_t len)

mbedtls_ctr_drbg_context m_CtrDrbg

SUvNgHttp2_TlsImpl(const TAddrNCred &addr_n_cred, size_t rd_buf_size, size_t wr_buf_size, TGetWriteBuf get_write_buf)

const char * GetReadBuffer() override

enum SUvNgHttp2_TlsImpl::@1004 m_State

vector< char > m_ReadBuffer

mbedtls_ssl_config m_Conf

SUvNgHttp2_TlsImpl & operator=(const SUvNgHttp2_TlsImpl &)=delete

static SUvNgHttp2_TlsImpl * GetThat(void *ctx)

~SUvNgHttp2_TlsImpl() override

array< const char *, 2 > m_Protocols

mbedtls_pk_context m_Pkey

mbedtls_ssl_context m_Ssl

static int s_OnRecv(void *ctx, unsigned char *buf, size_t len)

int Read(const char *&buf, ssize_t &nread) override

vector< char > & GetWriteBuffer() override

SUvNgHttp2_TlsImpl(SUvNgHttp2_TlsImpl &&)=delete

TGetWriteBuf m_GetWriteBuf

SUvNgHttp2_TlsImpl(const SUvNgHttp2_TlsImpl &)=delete

int OnSend(const unsigned char *buf, size_t len)

const char * m_IncomingData

vector< char > & GetWriteBuffer() override

const char * GetReadBuffer() override

int Read(const char *&buf, ssize_t &nread) override

SUvNgHttp2_TlsNoOp(TGetWriteBuf get_write_buf)

TGetWriteBuf m_GetWriteBuf

function< vector< char > &()> TGetWriteBuf

pair< SSocketAddress, TCred > TAddrNCred

static SUvNgHttp2_Tls * Create(bool https, const TAddrNCred &addr_n_cred, size_t rd_buf_size, size_t wr_buf_size, TGetWriteBuf get_write_buf)

SUvNgHttp2_UserAgentImpl()

struct sockaddr_in m_Address

SUv_Connect(void *user_data, const SSocketAddress &address)

int operator()(uv_tcp_t *handle, uv_connect_cb cb)

void OnWrite(uv_write_t *, int status)

function< void(int)> TConnectCb

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

void OnClose(uv_handle_t *)

void OnAlloc(uv_handle_t *, size_t suggested_size, uv_buf_t *buf)

static void s_OnClose(uv_handle_t *handle)

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

static void s_OnWrite(uv_write_t *req, int status)

function< void(int)> TWriteCb

bool CloseReset(ECloseType close_type)

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)

function< void(const char *, ssize_t)> TReadCb

vector< char > m_ReadBuffer

void Close(ECloseType close_type=eCloseReset)

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

void OnConnect(uv_connect_t *req, int status)

static void s_OnConnect(uv_connect_t *req, int status)

SBuffer * m_CurrentBuffer

void OnWrite(uv_write_t *req)

forward_list< SBuffer > m_Buffers

int Write(uv_stream_t *handle, uv_write_cb cb)

SUv_Write(void *user_data, size_t buf_size)

The CTR_DRBG context structure.

Entropy context structure.

SSL/TLS configuration to be shared between mbedtls_ssl_context structures.

Container for an X.509 certificate.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4