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/connect__misc_8cpp_source.html below:

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

44 #include <corelib/ncbisys.hpp> 46 #if defined(NCBI_OS_MSWIN) 48 #elif defined(NCBI_OS_UNIX) 58  unsigned GetHost

(

const string

& name)

const 65  auto

& name =

m_Data

[host];

90

name(

n

==

EName

::eOriginal ? h : std::optional<

string

>()),

98  return

NStr::StringToNumeric<unsigned short>(p);

140  return

make_shared<CServiceDiscovery::TServers>(1, std::move(server));

148

m_ServiceName(service_name),

150

m_IsSingleServer(m_Data)

159  return

*static_pointer_cast<TServers>(

m_Data

);

167

shared_ptr<void>& net_info, pair<string, const char*> lbsm_affinity,

168  int

try_count,

unsigned long

retry_delay)

180

lbsm_affinity.first.c_str(), lbsm_affinity.second),

SERV_Close

)) {

193  if

(--try_count < 0) {

197  ERR_POST

(

"Could not find LB service name '"

<< service_name <<

"', will retry after delay"

);

206  using namespace

chrono;

208  enum

ESubExpression :

size_t

{ eServer = 1, eTimestamp = 1 };

209  enum

EMatchedPattern :

size_t

{ fNothing = 0, fStart, fStop, eServerSide, eNumberOfPatterns,

eBoth

= fStart | fStop };

214  using

TMatched = size_t;

216  using

TServerData = tuple<TMatched, TTimePoints, TServerSide>;

217

unordered_map<string, TServerData> servers;

218

TServerData* current =

nullptr

;

220  for

(

const auto

&

msg

:

data

) {

221  const auto

msg_start =

msg

.m_Buffer;

222  const auto

msg_len =

min

((

size_t

)1024,

msg

.m_BufferLen);

223  const auto

msg_end = msg_start + msg_len;

224

TMatched matched = fNothing;

226  if

(regex_match(msg_start, msg_end, m,

m_Start

)) {

228

current = &servers[m[eServer].str()];

230

}

else if

(regex_match(msg_start, msg_end, m,

m_Stop

)) {

234  if

(m.size() > eServer) {

235

current = &servers[m[eServer].str()];

239

matched = eServerSide;

243

cerr << prefixes[matched];

249

cerr <<

"Cannot use matched data without a server\n"

;

251

}

else if

(matched == eServerSide) {

252

get<TServerSide>(*current) = m[eTimestamp].str();

255  auto t

=

msg

.GetTime();

256  auto

tp = system_clock::from_time_t(

t

.GetTimeT()) + microseconds(

t

.MicroSecond());

257

get<TMatched>(*current) |= matched;

258

get<TTimePoints>(*current)[matched] = tp;

265  auto

extremum_it = latencies.

end

();

267  for

(

const auto

& server : servers) {

268  const auto

& server_name = server.first;

269  const auto

& server_data = server.second;

271  if

(get<TMatched>(server_data) ==

eBoth

) {

272  const auto

& start = get<TTimePoints>(server_data)[fStart];

273  const auto

& stop = get<TTimePoints>(server_data)[fStop];

274  const auto

& server_side = get<TServerSide>(server_data);

275  auto result

= latencies.try_emplace(server_name, duration_cast<microseconds>(stop - start), server_side);

279

extremum_it =

result

.first;

284  return

extremum_it == latencies.

end

() ? latencies :

TResult

(extremum_it,

next

(extremum_it));

296  const auto

latencies =

Parse

(*m_Handler);

298  for

(

const auto

& server : latencies) {

300  const auto

server_name = address ? address.AsString() : server.first;

301  const auto

& server_side = get<TServerSide>(server.second);

303

os <<

"server="

<< server_name <<

"&latency="

<< get<TLatency>(server.second).count();

304  if

(!server_side.empty()) os <<

"&server_side="

<< server_side;

309  catch

(exception& ex) {

310

cerr <<

"Exception on calculating latencies: "

<< ex.what();

@ eBoth

Both preliminary and traceback stages.

Helper hook-up class that installs default logging/registry/locking (but only if they have not yet be...

void SetWhich(EWhich which)

std::optional< regex > m_ServerSide

TResult Parse(const TData &data)

map< string, TServerResult > TResult

deque< SDiagMessage > TData

static TServers DiscoverImpl(const string &, unsigned, shared_ptr< void > &, pair< string, const char * >, int, unsigned long)

pair< SSocketAddress, double > TServer

vector< TServer > TServers

shared_ptr< void > m_Data

CServiceDiscovery(const string &service_name, SSocketAddress::SHost::EName name=SSocketAddress::SHost::EName::eOriginal)

const bool m_IsSingleServer

const string m_ServiceName

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

const_iterator end() const

bool operator<(const SSocketAddress &lhs, const SSocketAddress &rhs)

NCBI_EXPORT_FUNC_DEFINE(XCONNECT, mbedtls_ctr_drbg_free)

bool operator==(const SSocketAddress &lhs, const SSocketAddress &rhs)

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 DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)

static const struct type types[]

unique_ptr< T, TDeleter > make_c_unique(T *p, TDeleter d)

Eliminates the necessity for specifying types of both allocated resource and deallocating C function.

void SetDiagFilter(EDiagFilter what, const char *filter_str)

Set diagnostic filter.

CDiagContext & GetDiagContext(void)

Get diag context instance.

#define ERR_POST(message)

Error posting with file, line number information but without error codes.

void SetDiagHandler(CDiagHandler *handler, bool can_delete=true)

Set the diagnostic handler using the specified diagnostic handler class.

static void SetOldPostFormat(bool value)

Set old/new format flag.

@ eDiagFilter_All

for all non-FATAL

#define NCBI_RETHROW_FMT(prev_exception, exception_class, err_code, message)

The same as NCBI_RETHROW but with message processed as output to ostream.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

void SERV_Close(SERV_ITER iter)

Deallocate the iterator.

unsigned int TSERV_Type

Bitwise OR of ESERV_Type[Special].

#define SERV_LOCALHOST

Special values for the "preferred_host" parameter.

SSERV_InfoCPtr SERV_GetNextInfoEx(SERV_ITER iter, HOST_INFO *host_info)

Get the next server meta-address, optionally accompanied by the host parameters made available by the...

static CNCBI_IPAddr gethostbyname(const string &host, ESwitch log=eOff)

Return 0 or empty address on error.

static string gethostbyaddr(const CNCBI_IPAddr &addr, ESwitch log=eOff)

Return empty string on error.

static string ntoa(const CNCBI_IPAddr &addr)

BSD-like API.

static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)

Split a string into two pieces using the specified delimiters.

#define NCBI_TIME_INFINITE

SConnNetInfo * ConnNetInfo_Create(const char *service)

void ConnNetInfo_Destroy(SConnNetInfo *net_info)

psa_status_t psa_crypto_init(void)

Library initialization.

SERV_ITER SERV_OpenP(const char *service, TSERV_Type types, unsigned int preferred_host, unsigned short preferred_port, double preference, const SConnNetInfo *net_info, SSERV_InfoCPtr skip[], size_t n_skip, int external, const char *arg, const char *val)

Uint4 GetHost(TEndpointKey key)

void SleepMilliSec(unsigned long ml_sec, EInterruptOnSignal onsignal=eRestartOnSignal)

#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.

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.

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.

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.

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(...

int mbedtls_ssl_close_notify(mbedtls_ssl_context *ssl)

Notify the peer that the connection is being closed.

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.

shared_ptr< void > GetSingleServer(const string &service_name, SSocketAddress::SHost::EName name) const

unsigned GetHost(const string &name) const

map< unsigned, string > m_Data

const string & GetName(unsigned host)

static SSocketAddressImpl & GetInstance()

static unsigned short x_GetPort(CTempString p)

string GetHostName() const

std::optional< string > m_Name

static SSocketAddress Parse(const string &address, SHost::EName name=SHost::EName::eResolved)


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