NCBI C++ ToolKit
Classes | Macros | Typedefs | Enumerations | Enumerator | Functions | Variables
Utility Functions
+ Collaboration diagram for Utility Functions:

Classes

struct  SConnNetInfo
 
struct  SURLExtra
 Extra URL_ConnectEx() parameters. More...
 
struct  SLOG_Message
 Message and miscellaneous data to pass to log post callback FLOG_Handler. More...
 
class  CConnIniter
 Helper hook-up class that installs default logging/registry/locking (but only if they have not yet been installed explicitly by the user) as if by calling CONNECT_Init(&CNcbiApplication::GetConfig()) automagically. More...
 
class  CRateMonitor
 
class  CSERV_Info
 Attributes of a given service. More...
 
struct  STimeoutTag
 Timeout structure. More...
 
struct  SHASH_Descriptor
 

Macros

#define DEF_CONN_REG_SECTION   "CONN"
 
#define REG_CONN_REQ_METHOD   "REQ_METHOD"
 
#define DEF_CONN_REQ_METHOD   "ANY"
 
#define REG_CONN_USER   "USER"
 
#define DEF_CONN_USER   ""
 
#define REG_CONN_PASS   "PASS"
 
#define DEF_CONN_PASS   ""
 
#define REG_CONN_HOST   "HOST"
 
#define DEF_CONN_HOST   "www.ncbi.nlm.nih.gov"
 
#define REG_CONN_PORT   "PORT"
 
#define DEF_CONN_PORT   0/*default*/
 
#define REG_CONN_PATH   "PATH"
 
#define DEF_CONN_PATH   "/Service/dispd.cgi"
 
#define REG_CONN_ARGS   "ARGS"
 
#define DEF_CONN_ARGS   ""
 
#define REG_CONN_HTTP_PROXY_HOST   "HTTP_PROXY_HOST"
 
#define DEF_CONN_HTTP_PROXY_HOST   ""
 
#define REG_CONN_HTTP_PROXY_PORT   "HTTP_PROXY_PORT"
 
#define DEF_CONN_HTTP_PROXY_PORT   ""
 
#define REG_CONN_HTTP_PROXY_USER   "HTTP_PROXY_USER"
 
#define DEF_CONN_HTTP_PROXY_USER   ""
 
#define REG_CONN_HTTP_PROXY_PASS   "HTTP_PROXY_PASS"
 
#define DEF_CONN_HTTP_PROXY_PASS   ""
 
#define REG_CONN_HTTP_PROXY_LEAK   "HTTP_PROXY_LEAK"
 
#define DEF_CONN_HTTP_PROXY_LEAK   ""
 
#define REG_CONN_HTTP_PROXY_SKIP   "HTTP_PROXY_SKIP"
 
#define DEF_CONN_HTTP_PROXY_SKIP   ""
 
#define REG_CONN_HTTP_PUSH_AUTH   "HTTP_PUSH_AUTH"
 
#define DEF_CONN_HTTP_PUSH_AUTH   ""
 
#define REG_CONN_TIMEOUT   "TIMEOUT"
 
#define DEF_CONN_TIMEOUT   30.0
 
#define REG_CONN_MAX_TRY   "MAX_TRY"
 
#define DEF_CONN_MAX_TRY   3
 
#define REG_CONN_EXTERNAL   "EXTERNAL"
 
#define DEF_CONN_EXTERNAL   ""
 
#define REG_CONN_FIREWALL   "FIREWALL"
 
#define DEF_CONN_FIREWALL   ""
 
#define REG_CONN_STATELESS   "STATELESS"
 
#define DEF_CONN_STATELESS   ""
 
#define REG_CONN_LB_DISABLE   "LB_DISABLE"
 
#define DEF_CONN_LB_DISABLE   ""
 
#define REG_CONN_HTTP_VERSION   "HTTP_VERSION"
 
#define DEF_CONN_HTTP_VERSION   0
 
#define REG_CONN_DEBUG_PRINTOUT   "DEBUG_PRINTOUT"
 
#define DEF_CONN_DEBUG_PRINTOUT   ""
 
#define REG_CONN_HTTP_USER_HEADER   "HTTP_USER_HEADER"
 
#define DEF_CONN_HTTP_USER_HEADER   ""
 
#define REG_CONN_HTTP_REFERER   "HTTP_REFERER"
 
#define DEF_CONN_HTTP_REFERER   0
 
#define REG_CONN_LOCAL_ENABLE   "LOCAL_ENABLE"
 
#define REG_CONN_LBSMD_DISABLE   "LBSMD_DISABLE"
 
#define REG_CONN_LBDNS_ENABLE   "LBDNS_ENABLE"
 
#define REG_CONN_LINKERD_ENABLE   "LINKERD_ENABLE"
 
#define REG_CONN_NAMERD_ENABLE   "NAMERD_ENABLE"
 
#define REG_CONN_DISPD_DISABLE   "DISPD_DISABLE"
 
#define REG_CONN_IMPLICIT_SERVER_TYPE   "IMPLICIT_SERVER_TYPE"
 
#define REG_CONN_SERVICE_NAME   DEF_CONN_REG_SECTION "_" "SERVICE_NAME"
 
#define REG_CONN_LOCAL_SERVICES   DEF_CONN_REG_SECTION "_" "LOCAL_SERVICES"
 
#define REG_CONN_LOCAL_SERVER   DEF_CONN_REG_SECTION "_" "LOCAL_SERVER"
 
#define REG_CONN_LBDNS_DOMAIN   DEF_CONN_REG_SECTION "_" "LBDNS_DOMAIN"
 
#define REG_CONN_LBDNS_DEBUG   DEF_CONN_REG_SECTION "_" "LBDNS_DEBUG"
 
#define REG_CONN_LBDNS_HOST   DEF_CONN_REG_SECTION "_" "LBDNS_HOST"
 
#define REG_CONN_LBDNS_PORT   DEF_CONN_REG_SECTION "_" "LBDNS_PORT"
 
#define DEF_CONN_LOCAL_IPS   "LOCAL_IPS"
 
#define REG_CONN_LOCAL_IPS   DEF_CONN_REG_SECTION "_" DEF_CONN_LOCAL_IPS
 
#define DEF_CONN_LOCAL_IPS_DISABLE   "NONE"
 
#define ConnNetInfo_PostOverrideUserHeader   ConnNetInfo_OverrideUserHeader
 
#define NCBI_CONNUTIL_DEPRECATED   NCBI_DEPRECATED
 
#define CONN_CONTENT_TYPE_LEN   63
 
#define MAX_CONTENT_TYPE_LEN   (CONN_CONTENT_TYPE_LEN+1)
 
#define EIO_N_STATUS   8
 connection is / has been closed, EOF condition More...
 
#define MT_LOCK_Do(lk, how)   ((lk) ? MT_LOCK_DoInternal((lk), (how)) : -1)
 Call "lk->handler(lk->data, how)". More...
 
#define kDefaultTimeout   ((const STimeout*)(-1))
 
#define kInfiniteTimeout   ((const STimeout*)( 0))
 
#define NCBI_ESWITCH_DEFINED
 
#define NCBI_EOWNERSHIP_DEFINED
 
#define NCBI_TIME_INFINITE   ((TNCBI_Time)(-1))
 
#define NCBI_BIGCOUNT_FORMAT_SPEC   PRIu64
 
#define NCBI_BIGCOUNT_FORMAT_SPEC_HEX   PRIx64
 
#define NCBI_BIGCOUNT_FORMAT_SPEC_HEX_X   PRIX64
 
#define LOG_WRITE(lg, code, subcode, level, message)
 Auxiliary plain macros to write message (maybe, with raw data) to the log. More...
 
#define LOG_DATA(lg, code, subcode, level, data, size, message)
 
#define THIS_MODULE   0
 Default for THIS_MODULE. More...
 
#define CORE_CURRENT_FUNCTION   0
 Get current function name. More...
 
#define CORE_LOGFILE_CUTOFF_LEVEL   eLOG_Note
 Default CORE LOG cut off log level. More...
 
#define fLOG_Short   fLOG_Level
 
#define fLOG_Full   (fLOG_Level | fLOG_Module | fLOG_FileLine)
 
#define UTIL_PRINTABLE_WIDTH_MIN   80 /** Default minimum printable width */
 
#define UTIL_PRINTABLE_WIDTH   130 /** Default printable width for data */
 
#define UTIL_PrintableString(d, s, b, f)   UTIL_PrintableStringEx((d),(s),(b),(f),0)
 Same as UTIL_PrintableStringEx(..., 0) – i.e. More...
 
#define UTIL_TcharToUtf8OnHeap(x)   (x)
 Conversion from Unicode to UTF8, and back. More...
 
#define UTIL_TcharToUtf8(x)   (x)
 
#define UTIL_Utf8ToTchar(x)   (x)
 
#define UTIL_ReleaseBuffer(x)   /*void*/
 

Typedefs

typedef const struct SNcbiBlowfishNCBI_BLOWFISH
 Opaque encryption / decryption context type. More...
 
typedef unsigned TReqMethod
 
typedef unsigned EBURLScheme
 
typedef unsigned EBFWMode
 
typedef unsigned EBDebugPrintout
 
typedef unsigned EBProxyType
 
typedef struct MT_LOCK_tagMT_LOCK
 
typedef int(* FMT_LOCK_Handler) (void *data, EMT_Lock how)
 MT locking callback (operates like a [recursive] mutex or RW-lock). More...
 
typedef void(* FMT_LOCK_Cleanup) (void *data)
 MT lock cleanup callback. More...
 
typedef struct LOG_tagLOG
 
typedef void(* FLOG_Handler) (void *data, const SLOG_Message *mess)
 Log post callback. More...
 
typedef void(* FLOG_Cleanup) (void *data)
 Log cleanup callback. More...
 
typedef struct REG_tagREG
 
typedef int(* FREG_Get) (void *data, const char *section, const char *name, char *value, size_t value_size)
 Registry getter callback. More...
 
typedef int(* FREG_Set) (void *data, const char *section, const char *name, const char *value, EREG_Storage storage)
 Registry setter callback. More...
 
typedef void(* FREG_Cleanup) (void *data)
 Registry cleanup callback. More...
 
typedef unsigned int TConnectInitFlags
 Bitwise OR of EConnectInitFlag. More...
 
typedef pair< Uint8, double > CRateMonitor::TMark
 
typedef struct STimeoutTag STimeout
 Timeout structure. More...
 
typedef enum ENcbiSwitch ESwitch
 Aux. More...
 
typedef enum ENcbiOwnership EOwnership
 Ownership relations between objects. More...
 
typedef unsigned int TNCBI_Size
 Fixed-size analogs of size_t and time_t (mainly for IPC) More...
 
typedef unsigned int TNCBI_Time
 
typedef uint64_t TNCBI_BigCount
 Big unsigned integer for file size and position. More...
 
typedef unsigned int TLOG_FormatFlags
 bitwise OR of "ELOG_FormatFlag" More...
 
typedef int TUTIL_PrintableFlags
 Bitwise "OR" of EUTIL_PrintableFlags. More...
 

Enumerations

enum  EReqMethod {
  eReqMethod_Any = 0 , eReqMethod_Get , eReqMethod_Post , eReqMethod_Head ,
  eReqMethod_Connect , eReqMethod_v1 = 8 , eReqMethod_Any11 = eReqMethod_v1 | eReqMethod_Any , eReqMethod_Get11 = eReqMethod_v1 | eReqMethod_Get ,
  eReqMethod_Post11 = eReqMethod_v1 | eReqMethod_Post , eReqMethod_Head11 = eReqMethod_v1 | eReqMethod_Head , eReqMethod_Connect11 = eReqMethod_v1 | eReqMethod_Connect , eReqMethod_Put = 16 ,
  eReqMethod_Patch , eReqMethod_Trace , eReqMethod_Delete , eReqMethod_Options
}
 
enum  EURLScheme {
  eURL_Unspec = 0 , eURL_Https , eURL_File , eURL_Http ,
  eURL_Ftp
}
 
enum  EFWMode { eFWMode_Legacy = 0 , eFWMode_Adaptive = 1 , eFWMode_Firewall = 2 , eFWMode_Fallback = 3 }
 
enum  EDebugPrintout { eDebugPrintout_None = 0 , eDebugPrintout_Some , eDebugPrintout_Data }
 
enum  EProxyType { fProxy_None = 0 , fProxy_Http , fProxy_Https }
 
enum  EMIME_Type {
  eMIME_T_Undefined = -1 , eMIME_T_NcbiData = 0 , eMIME_T_Text , eMIME_T_Application ,
  eMIME_T_Unknown
}
 
enum  EMIME_SubType {
  eMIME_Undefined = -1 , eMIME_Dispatch = 0 , eMIME_AsnText , eMIME_AsnBinary ,
  eMIME_Fasta , eMIME_WwwForm , eMIME_Html , eMIME_Plain ,
  eMIME_Xml , eMIME_XmlSoap , eMIME_OctetStream , eMIME_Unknown
}
 
enum  EMIME_Encoding { eENCOD_None = 0 , eENCOD_Url , eENCOD_Unknown }
 
enum  EIO_ReadMethod { eIO_ReadPeek , eIO_ReadPlain , eIO_ReadPersist }
 I/O read method. More...
 
enum  EIO_WriteMethod { eIO_WriteNone , eIO_WritePlain , eIO_WritePersist , eIO_WriteOutOfBand }
 I/O write method. More...
 
enum  EIO_Event {
  eIO_Open = 0 , eIO_Read = 1 , eIO_Write = 2 , eIO_ReadWrite = 3 ,
  eIO_Close = 4
}
 I/O event (or direction). More...
 
enum  EIO_Status {
  eIO_Success = 0 , eIO_Timeout , eIO_Reserved , eIO_Interrupt ,
  eIO_InvalidArg , eIO_NotSupported , eIO_Unknown
}
 I/O status. More...
 
enum  EMT_Lock {
  eMT_Lock , eMT_LockRead , eMT_Unlock , eMT_TryLock ,
  eMT_TryLockRead
}
 Set the lock/unlock callback function and its data for MT critical section. More...
 
enum  ELOG_Level {
  eLOG_Trace = 0 , eLOG_Note , eLOG_Info = eLOG_Note , eLOG_Warning ,
  eLOG_Error , eLOG_Critical , eLOG_Fatal
}
 Log severity level. More...
 
enum  EREG_Storage { eREG_Transient = 0 , eREG_Persistent }
 Transient/Persistent storage. More...
 
enum  EConnectInitFlag { eConnectInit_OwnNothing = 0 , eConnectInit_OwnRegistry = 1 , eConnectInit_OwnLock = 2 , eConnectInit_NoSSL = 4 }
 CONNECT_Init flags: which parameters to own / initialize. More...
 
enum  ENcbiSwitch {
  eOff = 0 , eOn , eDefault , eOff = 0 ,
  eOn , eDefault
}
 Aux. More...
 
enum  ENcbiOwnership { eNoOwnership , eTakeOwnership , eNoOwnership , eTakeOwnership }
 Ownership relations between objects. More...
 
enum  ELOG_FormatFlag {
  fLOG_Default = 0x0 , fLOG_Level = 0x1 , fLOG_Module = 0x2 , fLOG_FileLine = 0x4 ,
  fLOG_DateTime = 0x8 , fLOG_Function = 0x10 , fLOG_FullOctal = 0x2000 , fLOG_OmitNoteLevel = 0x4000 ,
  fLOG_None = 0x8000
}
 LOG formatting flags: what parts of the message to actually appear. More...
 
enum  ENcbiRequestID { eNcbiRequestID_None = 0 , eNcbiRequestID_HitID , eNcbiRequestID_SID }
 NCBI request ID enumerator. More...
 
enum  ECORE_Username { eCORE_UsernameCurrent , eCORE_UsernameLogin , eCORE_UsernameReal }
 Select which username is the most preferable to obtain from the system. More...
 
enum  EUTIL_PrintableFlags { fUTIL_PrintableFullOctal = 1 , eUTIL_PrintableFullOctal = fUTIL_PrintableFullOctal , fUTIL_PrintableNoNewLine = 2 , eUTIL_PrintableNoNewLine = fUTIL_PrintableNoNewLine }
 

Functions

NCBI_BLOWFISH NcbiBlowfishInit (const void *key, size_t keylen)
 Init the cipher context with a key of the specified length. More...
 
void NcbiBlowfishEncrypt (NCBI_BLOWFISH ctx, Uint8 *text)
 Encrypt a 64-bit block of data pointed to by "text" with an encrypted scrambled cipher data stored back at the same location. More...
 
void NcbiBlowfishDecrypt (NCBI_BLOWFISH ctx, Uint8 *data)
 Decrypt a 64-bit of cipher data pointed to by "data" back into the clear text stored at the same location. More...
 
void NcbiBlowfishFini (NCBI_BLOWFISH ctx)
 Destroy the context created by NcbiBlowfishInit(). More...
 
const char * ConnNetInfo_GetValue (const char *service, const char *param, char *value, size_t value_size, const char *def_value)
 
int ConnNetInfo_Boolean (const char *str)
 
SConnNetInfoConnNetInfo_Create (const char *service)
 
SConnNetInfoConnNetInfo_Clone (const SConnNetInfo *net_info)
 
int ConnNetInfo_SetPath (SConnNetInfo *net_info, const char *path)
 
int ConnNetInfo_AddPath (SConnNetInfo *net_info, const char *path)
 
int ConnNetInfo_SetArgs (SConnNetInfo *net_info, const char *args)
 
int ConnNetInfo_SetFrag (SConnNetInfo *net_info, const char *frag)
 
const char * ConnNetInfo_GetArgs (const SConnNetInfo *net_info)
 
int ConnNetInfo_AppendArg (SConnNetInfo *net_info, const char *arg, const char *val)
 
int ConnNetInfo_PrependArg (SConnNetInfo *net_info, const char *arg, const char *val)
 
int ConnNetInfo_DeleteArg (SConnNetInfo *net_info, const char *arg)
 
void ConnNetInfo_DeleteAllArgs (SConnNetInfo *net_info, const char *args)
 
int ConnNetInfo_PreOverrideArg (SConnNetInfo *net_info, const char *arg, const char *val)
 
int ConnNetInfo_PostOverrideArg (SConnNetInfo *net_info, const char *arg, const char *val)
 
int ConnNetInfo_SetupStandardArgs (SConnNetInfo *net_info, const char *service)
 
int ConnNetInfo_SetUserHeader (SConnNetInfo *net_info, const char *header)
 
int ConnNetInfo_AppendUserHeader (SConnNetInfo *net_info, const char *header)
 
int ConnNetInfo_PrependUserHeader (SConnNetInfo *net_info, const char *header)
 
int ConnNetInfo_OverrideUserHeader (SConnNetInfo *net_info, const char *header)
 
int ConnNetInfo_PreOverrideUserHeader (SConnNetInfo *net_info, const char *header)
 
int ConnNetInfo_ExtendUserHeader (SConnNetInfo *net_info, const char *header)
 
void ConnNetInfo_DeleteUserHeader (SConnNetInfo *net_info, const char *header)
 
int ConnNetInfo_SetTimeout (SConnNetInfo *net_info, const STimeout *timeout)
 
int ConnNetInfo_ParseURL (SConnNetInfo *net_info, const char *url)
 
char * ConnNetInfo_URL (const SConnNetInfo *net_info)
 
void ConnNetInfo_Log (const SConnNetInfo *net_info, ELOG_Level sev, LOG log)
 
void ConnNetInfo_Destroy (SConnNetInfo *net_info)
 
EIO_Status URL_ConnectEx (const char *host, unsigned short port, const char *path, const char *args, TReqMethod req_method, size_t content_length, const STimeout *o_timeout, const STimeout *rw_timeout, const char *user_header, SURLExtra *extra, TSOCK_Flags flags, SOCK *sock)
 
SOCK URL_Connect (const char *host, unsigned short port, const char *path, const char *args, EReqMethod req_method, size_t content_length, const STimeout *o_timeout, const STimeout *rw_timeout, const char *user_header, int encode_args, TSOCK_Flags flags)
 
EIO_Status CONN_StripToPattern (CONN conn, const void *pattern, size_t pattern_size, BUF *discard, size_t *n_discarded)
 Discard all input data before (and including) the first occurrence of a "pattern". More...
 
EIO_Status SOCK_StripToPattern (SOCK sock, const void *pattern, size_t pattern_size, BUF *discard, size_t *n_discarded)
 
EIO_Status BUF_StripToPattern (BUF buffer, const void *pattern, size_t pattern_size, BUF *discard, size_t *n_discarded)
 
void URL_Encode (const void *src_buf, size_t src_size, size_t *src_read, void *dst_buf, size_t dst_size, size_t *dst_written)
 
void URL_EncodeEx (const void *src_buf, size_t src_size, size_t *src_read, void *dst_buf, size_t dst_size, size_t *dst_written, const char *allow_symbols)
 
int URL_Decode (const void *src_buf, size_t src_size, size_t *src_read, void *dst_buf, size_t dst_size, size_t *dst_written)
 
int URL_DecodeEx (const void *src_buf, size_t src_size, size_t *src_read, void *dst_buf, size_t dst_size, size_t *dst_written, const char *allow_symbols)
 
char * MIME_ComposeContentTypeEx (EMIME_Type type, EMIME_SubType subtype, EMIME_Encoding encoding, char *buf, size_t bufsize)
 
int MIME_ParseContentTypeEx (const char *str, EMIME_Type *type, EMIME_SubType *subtype, EMIME_Encoding *encoding)
 
const char * IO_StatusStr (EIO_Status status)
 Get the text form of an enum status value. More...
 
MT_LOCK MT_LOCK_Create (void *data, FMT_LOCK_Handler handler, FMT_LOCK_Cleanup cleanup)
 Create a new MT lock (with an internal reference count set to 1). More...
 
MT_LOCK MT_LOCK_AddRef (MT_LOCK lk)
 Increment internal reference count by 1, then return "lk". More...
 
MT_LOCK MT_LOCK_Delete (MT_LOCK lk)
 Decrement internal reference count by 1, and if it reaches 0, then destroy the handle, call "lk->cleanup(lk->data)", and return NULL; otherwise (if the reference count is still > 0), return "lk". More...
 
int MT_LOCK_DoInternal (MT_LOCK lk, EMT_Lock how)
 
const char * LOG_LevelStr (ELOG_Level level)
 Obtain verbal representation of an enum level value. More...
 
LOG LOG_Create (void *data, FLOG_Handler handler, FLOG_Cleanup cleanup, MT_LOCK lock)
 Create a new LOG (with an internal reference count set to 1). More...
 
LOG LOG_Reset (LOG lg, void *data, FLOG_Handler handler, FLOG_Cleanup cleanup)
 Reset the "lg" to use the new "data", "handler" and "cleanup". More...
 
LOG LOG_AddRef (LOG lg)
 Increment internal reference count by 1, then return "lg". More...
 
LOG LOG_Delete (LOG lg)
 Decrement internal reference count by 1, and if it reaches 0, then call "lg->cleanup(lg->data)", destroy the handle, and return NULL; otherwise (if reference count is still > 0), return "lg". More...
 
void LOG_Write (LOG lg, int code, int subcode, ELOG_Level level, const char *module, const char *func, const char *file, int line, const char *message, const void *raw_data, size_t raw_size)
 Upon having filled SLOG_Message data from parameters, write a message (perhaps with raw data attached) to the log by calling LOG_WriteInternal(). More...
 
void LOG_WriteInternal (LOG lg, const SLOG_Message *mess)
 Write message (perhaps with raw data attached) to the log by calling "lg->handler(lg->data, mess)". More...
 
REG REG_Create (void *data, FREG_Get get, FREG_Set set, FREG_Cleanup cleanup, MT_LOCK lock)
 Create a new registry (with an internal reference count set to 1). More...
 
void REG_Reset (REG rg, void *data, FREG_Get get, FREG_Set set, FREG_Cleanup cleanup, int do_cleanup)
 Reset the registry handle to use the new "data", "set", "get", and "cleanup". More...
 
REG REG_AddRef (REG rg)
 Increment internal reference count by 1, then return "rg". More...
 
REG REG_Delete (REG rg)
 Decrement internal reference count by 1, and if it reaches 0, then call "rg->cleanup(rg->data)", destroy the handle, and return NULL; otherwise (if the reference count is still > 0), return "rg". More...
 
const char * REG_Get (REG rg, const char *section, const char *name, char *value, size_t value_size, const char *def_value)
 Copy the registry value stored in "section" under name "name" to buffer "value"; if the entry is found in both transient and persistent storages, then copy the one from the transient storage. More...
 
int REG_Set (REG rg, const char *section, const char *name, const char *value, EREG_Storage storage)
 Store the "value" into the registry section "section" under the key "name", and according to "storage". More...
 
REG REG_cxx2c (IRWRegistry *reg, bool pass_ownership=false)
 Convert a C++ Toolkit registry object to a REG registry. More...
 
REG REG_cxx2c (const IRWRegistry *reg, bool pass_ownership=false)
 Convert a C++ Toolkit read-only registry object to a REG registry. More...
 
LOG LOG_cxx2c (void)
 Create LOG on top of C++ Toolkit CNcbiDiag. More...
 
MT_LOCK MT_LOCK_cxx2c (CRWLock *lock=0, bool pass_ownership=false)
 Convert a C++ Toolkit lock object to an MT_LOCK lock. More...
 
void CONNECT_Init (const IRWRegistry *reg=0, CRWLock *lock=0, TConnectInitFlags flag=eConnectInit_OwnNothing, FSSLSetup ssl=0)
 Init [X]CONNECT library with the specified "reg" and "lock" (ownership for either or both can be detailed in the "flag" parameter). More...
 
 CConnIniter::CConnIniter (void)
 
const STimeoutg_CTimeoutToSTimeout (const CTimeout &cto, STimeout &sto)
 CTimeout/STimeout adapters. More...
 
CTimeout g_STimeoutToCTimeout (const STimeout *sto)
 Convert STimeout to CTimeout. More...
 
 CRateMonitor::CRateMonitor (double minspan=0.5, double maxspan=10.0, double weight=0.5, double precision=0.95)
 Monitor position progressing in time, calculate speed and estimate time to complete the job (when the final size is known). More...
 
void CRateMonitor::SetSize (Uint8 size)
 Set size of the anticipated job, clear all prior measurements. More...
 
Uint8 CRateMonitor::GetSize (void) const
 Get size previously set. More...
 
Uint8 CRateMonitor::GetPos (void) const
 Get current progress position (position 0 when job starts) More...
 
double CRateMonitor::GetTime (void) const
 Get current time (time 0.0 when job starts) More...
 
void CRateMonitor::Mark (Uint8 pos, double time)
 Submit a mark of the job progress. More...
 
double CRateMonitor::GetRate (void) const
 How fast the recent rate has been, in positions per time unit, using the weighted formula. More...
 
double CRateMonitor::GetPace (void) const
 How fast the average pace has been so far, in positions per time unit. More...
 
double CRateMonitor::GetETA (void) const
 How long it will take to complete, at the current rate. More...
 
double CRateMonitor::GetTimeRemaining (void) const
 How long it will take to complete, at the average pace. More...
 
 CSERV_Info::CSERV_Info (const string &host, unsigned short port, double rate, ESERV_Type type)
 
string CSERV_Info::GetHost (void) const
 
unsigned short CSERV_Info::GetPort (void) const
 
double CSERV_Info::GetRate (void) const
 
ESERV_Type CSERV_Info::GetType (void) const
 
vector< CSERV_InfoSERV_GetServers (const string &service, TSERV_TypeOnly types=fSERV_Any)
 Get the servers for a given service. More...
 
unsigned long NcbiTimeoutToMs (const STimeout *timeout)
 
STimeoutNcbiMsToTimeout (STimeout *timeout, unsigned long ms)
 
void CORE_SetLOCK (MT_LOCK lk)
 Set the MT critical section lock/unlock handler – to be used by the core internals for protection of internal static variables and other MT-sensitive code from being accessed/changed by several threads simultaneously. More...
 
MT_LOCK CORE_GetLOCK (void)
 Get the lock handle that is to be used by the core internals. More...
 
void CORE_SetLOG (LOG lg)
 Set the log handle (no logging if "lg" is passed zero) – to be used by the core internals (CORE LOG). More...
 
LOG CORE_GetLOG (void)
 Get the log handle that is to be used by the core internals (CORE LOG). More...
 
void CORE_SetLOGFILE_Ex (FILE *fp, ELOG_Level cut_off, ELOG_Level fatal_err, int auto_close)
 Standard logging (CORE LOG) to the specified file stream. More...
 
void CORE_SetLOGFILE (FILE *fp, int auto_close)
 Same as CORE_SetLOGFILE_Ex(fp, CORE_LOGFILE_CUTOFF_LEVEL, eLOG_Fatal, auto_close). More...
 
int CORE_SetLOGFILE_NAME_Ex (const char *logfile, ELOG_Level cut_off, ELOG_Level fatal_err)
 Same as CORE_SetLOGFILE_Ex(fopen(logfile, "a"), cut_off, fatal_err, TRUE). More...
 
int CORE_SetLOGFILE_NAME (const char *logfile)
 Same as CORE_SetLOGFILE_NAME_Ex(logfile, CORE_LOGFILE_CUTOFF_LEVEL, eLOG_Fatal). More...
 
TLOG_FormatFlags CORE_SetLOGFormatFlags (TLOG_FormatFlags)
 
char * LOG_ComposeMessage (const SLOG_Message *mess, TLOG_FormatFlags flags)
 Compose a message using the "call_data" info. More...
 
void LOG_ToFILE_Ex (LOG lg, FILE *fp, ELOG_Level cut_off, ELOG_Level fatal_err, int auto_close)
 LOG_Reset specialized to log to a "FILE*" stream using LOG_ComposeMessage. More...
 
void LOG_ToFILE (LOG lg, FILE *fp, int auto_close)
 Same as LOG_ToFILEx(lg, fp, eLOG_Trace, eLOG_Fatal, auto_close). More...
 
const char * NcbiMessagePlusError (int *dynamic, const char *message, int error, const char *descr)
 Add current "error" (and maybe its description) to the message: <message>[ {error=[[<error>][,]][<descr>]}]. More...
 
void CORE_SetREG (REG rg)
 Set the registry (no registry if "rg" is passed zero) – to be used by the core internals. More...
 
REG CORE_GetREG (void)
 Get the registry that is to be used by the core internals. More...
 
const char * CORE_GetAppName (void)
 Obtain current application name (toolkit dependent). More...
 
char * CORE_GetNcbiRequestID (ENcbiRequestID reqid)
 Obtain current NCBI request ID (if known, per thread). More...
 
const char * CORE_GetPlatform (void)
 Return NCBI platrofm ID (if known). More...
 
const char * CORE_GetUsernameEx (char *buf, size_t bufsize, ECORE_Username username)
 Obtain and store in the buffer provided, the best (as possible) user name that matches the requested username selector. More...
 
const char * CORE_GetUsername (char *buf, size_t bufsize)
 Equivalent to CORE_GetUsernameEx(buf, bufsize, eNCBI_UsernameLogin) except that it always returns non-empty "buf" when successful, or NULL otherwise (i.e. More...
 
size_t CORE_GetVMPageSize (void)
 Obtain virtual memory page size. More...
 
void CORE_Msdelay (unsigned long ms)
 Delay execution of the current thread by the specified number of milliseconds. More...
 
unsigned int UTIL_CRC32_Update (unsigned int checksum, const void *ptr, size_t len)
 Calculate/Update CRC-32 checksum NB: Initial checksum is "0". More...
 
unsigned int UTIL_Adler32_Update (unsigned int checksum, const void *ptr, size_t len)
 Calculate/Update Adler-32 checksum NB: Initial checksum is "1". More...
 
void * UTIL_GenerateHMAC (const SHASH_Descriptor *hash, const void *text, size_t text_len, const void *key, size_t key_len, void *digest)
 Generate an RFC2401 digest (HMAC). More...
 
int UTIL_MatchesMaskEx (const char *text, const char *mask, int ignore_case)
 Match a given text with a given pattern mask. More...
 
int UTIL_MatchesMask (const char *text, const char *mask)
 Shortcut for UTIL_MatchesMaskEx(text, mask, 1), that is matching is done case-insensitively for the letters (a-z). More...
 
char * UTIL_NcbiLocalHostName (char *hostname)
 Cut off well-known NCBI domain suffix out of the passed "hostname". More...
 
size_t UTIL_PrintableStringSize (const char *data, size_t size)
 Calculate size of buffer needed to store printable representation of the block of data of the specified size (or, if size is 0, strlen(data)) but without the '\0' terminator. More...
 
char * UTIL_PrintableStringEx (const char *data, size_t size, char *buf, TUTIL_PrintableFlags flags, int width)
 Create a printable representation of a block of data of the specified size (or, if size is 0, strlen(data)), and return the buffer pointer past the last stored character (non '\0'-terminated). More...
 
int UTIL_HelpRequested (int argc, char **argv)
 Given the main()'s argc and argv return non-zero (true) if the arguments specify that only a help option was requested. More...
 
void UTIL_ReleaseBufferOnHeap (const void *ptr)
 

Variables

char SConnNetInfo::client_host [255+1]
 
TReqMethod SConnNetInfo::req_method:5
 
EBURLScheme SConnNetInfo::scheme:3
 
unsigned SConnNetInfo::external:1
 
EBFWMode SConnNetInfo::firewall:2
 
unsigned SConnNetInfo::stateless:1
 
unsigned SConnNetInfo::lb_disable:1
 
unsigned SConnNetInfo::http_version:1
 
EBDebugPrintout SConnNetInfo::debug_printout:2
 
unsigned SConnNetInfo::http_push_auth:1
 
unsigned SConnNetInfo::http_proxy_leak:1
 
unsigned SConnNetInfo::http_proxy_skip:1
 
EBProxyType SConnNetInfo::http_proxy_mask:2
 
unsigned SConnNetInfo::reserved:11
 
char SConnNetInfo::user [63+1]
 
char SConnNetInfo::pass [63+1]
 
char SConnNetInfo::host [255+1]
 
unsigned short SConnNetInfo::port
 
char SConnNetInfo::path [4095+1]
 
char SConnNetInfo::http_proxy_host [255+1]
 
unsigned short SConnNetInfo::http_proxy_port
 
char SConnNetInfo::http_proxy_user [63+1]
 
char SConnNetInfo::http_proxy_pass [63+1]
 
unsigned short SConnNetInfo::max_try
 
unsigned short SConnNetInfo::unused
 
const STimeoutSConnNetInfo::timeout
 
const char * SConnNetInfo::http_user_header
 
const char * SConnNetInfo::http_referer
 
NCBI_CRED SConnNetInfo::credentials
 
unsigned int SConnNetInfo::magic
 
STimeout SConnNetInfo::tmo
 
const char SConnNetInfo::svc [1]
 
NCBI_CRED SURLExtra::cred
 SSL credentials (if any) More...
 
const char * SURLExtra::host
 SSL host id (aka SNI) (if differs from "host") More...
 
int SLOG_Message::dynamic
 
const char * SLOG_Message::message
 
ELOG_Level SLOG_Message::level
 
const char * SLOG_Message::module
 
const char * SLOG_Message::func
 
const char * SLOG_Message::file
 
int SLOG_Message::line
 
const void * SLOG_Message::raw_data
 
size_t SLOG_Message::raw_size
 
int SLOG_Message::err_code
 
int SLOG_Message::err_subcode
 
const double CRateMonitor::kMinSpan
 
const double CRateMonitor::kMaxSpan
 
const double CRateMonitor::kWeight
 
const double CRateMonitor::kSpan
 
double CRateMonitor::m_Rate
 Cached rate from last calculation. More...
 
list< TMarkCRateMonitor::m_Data
 Measurements as submitted by Mark() More...
 
Uint8 CRateMonitor::m_Size
 Total size of job to be performed. More...
 
string CSERV_Info::m_Host
 
unsigned short CSERV_Info::m_Port
 
double CSERV_Info::m_Rate
 
ESERV_Type CSERV_Info::m_Type
 
unsigned int STimeoutTag::sec
 seconds More...
 
unsigned int STimeoutTag::usec
 microseconds (modulo 1,000,000) More...
 
char * CORE_GetNcbiRequestDtab
 NCBI request "DTab-Local" header. More...
 
size_t SHASH_Descriptor::block_len
 
size_t SHASH_Descriptor::digest_len
 
int(* SHASH_Descriptor::init )(void **ctx)
 
void(* SHASH_Descriptor::update )(void *ctx, const void *data, size_t data_len)
 
void(* SHASH_Descriptor::fini )(void *ctx, void *digest)
 

Detailed Description

__STDC_FORMAT_MACROS

Macro Definition Documentation

◆ CONN_CONTENT_TYPE_LEN

#define CONN_CONTENT_TYPE_LEN   63

Definition at line 1070 of file ncbi_connutil.h.

◆ ConnNetInfo_PostOverrideUserHeader

#define ConnNetInfo_PostOverrideUserHeader   ConnNetInfo_OverrideUserHeader

Definition at line 640 of file ncbi_connutil.h.

◆ CORE_CURRENT_FUNCTION

#define CORE_CURRENT_FUNCTION   0

Get current function name.

Note
Defined inside of either a method or a function body only. See <corelib/ncbidiag.hpp> for definition of NCBI_CURRENT_FUNCTION.
See also
NCBI_CURRENT_FUNCTION

Definition at line 177 of file ncbi_util.h.

◆ CORE_LOGFILE_CUTOFF_LEVEL

#define CORE_LOGFILE_CUTOFF_LEVEL   eLOG_Note

Default CORE LOG cut off log level.

See also
CORE_SetLOGFILE, CORE_SetLOGFILE_NAME

Definition at line 188 of file ncbi_util.h.

◆ DEF_CONN_ARGS

#define DEF_CONN_ARGS   ""

Definition at line 255 of file ncbi_connutil.h.

◆ DEF_CONN_DEBUG_PRINTOUT

#define DEF_CONN_DEBUG_PRINTOUT   ""

Definition at line 300 of file ncbi_connutil.h.

◆ DEF_CONN_EXTERNAL

#define DEF_CONN_EXTERNAL   ""

Definition at line 285 of file ncbi_connutil.h.

◆ DEF_CONN_FIREWALL

#define DEF_CONN_FIREWALL   ""

Definition at line 288 of file ncbi_connutil.h.

◆ DEF_CONN_HOST

#define DEF_CONN_HOST   "www.ncbi.nlm.nih.gov"

Definition at line 246 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_PROXY_HOST

#define DEF_CONN_HTTP_PROXY_HOST   ""

Definition at line 258 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_PROXY_LEAK

#define DEF_CONN_HTTP_PROXY_LEAK   ""

Definition at line 270 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_PROXY_PASS

#define DEF_CONN_HTTP_PROXY_PASS   ""

Definition at line 267 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_PROXY_PORT

#define DEF_CONN_HTTP_PROXY_PORT   ""

Definition at line 261 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_PROXY_SKIP

#define DEF_CONN_HTTP_PROXY_SKIP   ""

Definition at line 273 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_PROXY_USER

#define DEF_CONN_HTTP_PROXY_USER   ""

Definition at line 264 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_PUSH_AUTH

#define DEF_CONN_HTTP_PUSH_AUTH   ""

Definition at line 276 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_REFERER

#define DEF_CONN_HTTP_REFERER   0

Definition at line 306 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_USER_HEADER

#define DEF_CONN_HTTP_USER_HEADER   ""

Definition at line 303 of file ncbi_connutil.h.

◆ DEF_CONN_HTTP_VERSION

#define DEF_CONN_HTTP_VERSION   0

Definition at line 297 of file ncbi_connutil.h.

◆ DEF_CONN_LB_DISABLE

#define DEF_CONN_LB_DISABLE   ""

Definition at line 294 of file ncbi_connutil.h.

◆ DEF_CONN_LOCAL_IPS

#define DEF_CONN_LOCAL_IPS   "LOCAL_IPS"

Definition at line 334 of file ncbi_connutil.h.

◆ DEF_CONN_LOCAL_IPS_DISABLE

#define DEF_CONN_LOCAL_IPS_DISABLE   "NONE"

Definition at line 336 of file ncbi_connutil.h.

◆ DEF_CONN_MAX_TRY

#define DEF_CONN_MAX_TRY   3

Definition at line 282 of file ncbi_connutil.h.

◆ DEF_CONN_PASS

#define DEF_CONN_PASS   ""

Definition at line 243 of file ncbi_connutil.h.

◆ DEF_CONN_PATH

#define DEF_CONN_PATH   "/Service/dispd.cgi"

Definition at line 252 of file ncbi_connutil.h.

◆ DEF_CONN_PORT

#define DEF_CONN_PORT   0/*default*/

Definition at line 249 of file ncbi_connutil.h.

◆ DEF_CONN_REG_SECTION

#define DEF_CONN_REG_SECTION   "CONN"

Definition at line 234 of file ncbi_connutil.h.

◆ DEF_CONN_REQ_METHOD

#define DEF_CONN_REQ_METHOD   "ANY"

Definition at line 237 of file ncbi_connutil.h.

◆ DEF_CONN_STATELESS

#define DEF_CONN_STATELESS   ""

Definition at line 291 of file ncbi_connutil.h.

◆ DEF_CONN_TIMEOUT

#define DEF_CONN_TIMEOUT   30.0

Definition at line 279 of file ncbi_connutil.h.

◆ DEF_CONN_USER

#define DEF_CONN_USER   ""

Definition at line 240 of file ncbi_connutil.h.

◆ EIO_N_STATUS

#define EIO_N_STATUS   8

connection is / has been closed, EOF condition

Definition at line 141 of file ncbi_core.h.

◆ fLOG_Full

#define fLOG_Full   (fLOG_Level | fLOG_Module | fLOG_FileLine)

Definition at line 297 of file ncbi_util.h.

◆ fLOG_Short

#define fLOG_Short   fLOG_Level

Definition at line 296 of file ncbi_util.h.

◆ kDefaultTimeout

#define kDefaultTimeout   ((const STimeout*)(-1))

Definition at line 81 of file ncbi_types.h.

◆ kInfiniteTimeout

#define kInfiniteTimeout   ((const STimeout*)( 0))

Definition at line 82 of file ncbi_types.h.

◆ LOG_DATA

#define LOG_DATA (   lg,
  code,
  subcode,
  level,
  data,
  size,
  message 
)
Value:
__FILE__, __LINE__, message, data, size)
char data[12]
Definition: iconv.c:80
#define THIS_MODULE
Default for THIS_MODULE.
Definition: ncbi_util.h:153
#define CORE_CURRENT_FUNCTION
Get current function name.
Definition: ncbi_util.h:177
void LOG_Write(LOG lg, int code, int subcode, ELOG_Level level, const char *module, const char *func, const char *file, int line, const char *message, const void *raw_data, size_t raw_size)
Upon having filled SLOG_Message data from parameters, write a message (perhaps with raw data attached...
Definition: ncbi_core.c:424
const struct ncbi::grid::netcache::search::fields::SIZE size
Definition: inftrees.h:24

Definition at line 145 of file ncbi_util.h.

◆ LOG_WRITE

#define LOG_WRITE (   lg,
  code,
  subcode,
  level,
  message 
)
Value:
__FILE__, __LINE__, message, 0, 0)

Auxiliary plain macros to write message (maybe, with raw data) to the log.

See also
LOG_Write

Definition at line 136 of file ncbi_util.h.

◆ MAX_CONTENT_TYPE_LEN

#define MAX_CONTENT_TYPE_LEN   (CONN_CONTENT_TYPE_LEN+1)

Definition at line 1072 of file ncbi_connutil.h.

◆ MT_LOCK_Do

#define MT_LOCK_Do (   lk,
  how 
)    ((lk) ? MT_LOCK_DoInternal((lk), (how)) : -1)

Call "lk->handler(lk->data, how)".

Parameters
lkA handle previously obtained from MT_LOCK_Create
howWhether to lock (and how: read, write) or to unlock
Returns
Value returned by the lock handler ("handler" in MT_LOCK_Create()). If the lock handler is not specified then always return "-1" (noop).
Note
Use MT_LOCK_Do() to avoid overhead!
See also
MT_LOCK_Create, FMT_LOCK_Handler, EMT_Lock

Definition at line 270 of file ncbi_core.h.

◆ NCBI_BIGCOUNT_FORMAT_SPEC

#define NCBI_BIGCOUNT_FORMAT_SPEC   PRIu64

Definition at line 165 of file ncbi_types.h.

◆ NCBI_BIGCOUNT_FORMAT_SPEC_HEX

#define NCBI_BIGCOUNT_FORMAT_SPEC_HEX   PRIx64

Definition at line 166 of file ncbi_types.h.

◆ NCBI_BIGCOUNT_FORMAT_SPEC_HEX_X

#define NCBI_BIGCOUNT_FORMAT_SPEC_HEX_X   PRIX64

Definition at line 167 of file ncbi_types.h.

◆ NCBI_CONNUTIL_DEPRECATED

#define NCBI_CONNUTIL_DEPRECATED   NCBI_DEPRECATED

Definition at line 862 of file ncbi_connutil.h.

◆ NCBI_EOWNERSHIP_DEFINED

#define NCBI_EOWNERSHIP_DEFINED

NCBI_ESWITCH_DEFINED

Definition at line 119 of file ncbi_types.h.

◆ NCBI_ESWITCH_DEFINED

#define NCBI_ESWITCH_DEFINED

Definition at line 97 of file ncbi_types.h.

◆ NCBI_TIME_INFINITE

#define NCBI_TIME_INFINITE   ((TNCBI_Time)(-1))

Definition at line 147 of file ncbi_types.h.

◆ REG_CONN_ARGS

#define REG_CONN_ARGS   "ARGS"

Definition at line 254 of file ncbi_connutil.h.

◆ REG_CONN_DEBUG_PRINTOUT

#define REG_CONN_DEBUG_PRINTOUT   "DEBUG_PRINTOUT"

Definition at line 299 of file ncbi_connutil.h.

◆ REG_CONN_DISPD_DISABLE

#define REG_CONN_DISPD_DISABLE   "DISPD_DISABLE"

Definition at line 314 of file ncbi_connutil.h.

◆ REG_CONN_EXTERNAL

#define REG_CONN_EXTERNAL   "EXTERNAL"

Definition at line 284 of file ncbi_connutil.h.

◆ REG_CONN_FIREWALL

#define REG_CONN_FIREWALL   "FIREWALL"

Definition at line 287 of file ncbi_connutil.h.

◆ REG_CONN_HOST

#define REG_CONN_HOST   "HOST"

Definition at line 245 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_PROXY_HOST

#define REG_CONN_HTTP_PROXY_HOST   "HTTP_PROXY_HOST"

Definition at line 257 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_PROXY_LEAK

#define REG_CONN_HTTP_PROXY_LEAK   "HTTP_PROXY_LEAK"

Definition at line 269 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_PROXY_PASS

#define REG_CONN_HTTP_PROXY_PASS   "HTTP_PROXY_PASS"

Definition at line 266 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_PROXY_PORT

#define REG_CONN_HTTP_PROXY_PORT   "HTTP_PROXY_PORT"

Definition at line 260 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_PROXY_SKIP

#define REG_CONN_HTTP_PROXY_SKIP   "HTTP_PROXY_SKIP"

Definition at line 272 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_PROXY_USER

#define REG_CONN_HTTP_PROXY_USER   "HTTP_PROXY_USER"

Definition at line 263 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_PUSH_AUTH

#define REG_CONN_HTTP_PUSH_AUTH   "HTTP_PUSH_AUTH"

Definition at line 275 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_REFERER

#define REG_CONN_HTTP_REFERER   "HTTP_REFERER"

Definition at line 305 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_USER_HEADER

#define REG_CONN_HTTP_USER_HEADER   "HTTP_USER_HEADER"

Definition at line 302 of file ncbi_connutil.h.

◆ REG_CONN_HTTP_VERSION

#define REG_CONN_HTTP_VERSION   "HTTP_VERSION"

Definition at line 296 of file ncbi_connutil.h.

◆ REG_CONN_IMPLICIT_SERVER_TYPE

#define REG_CONN_IMPLICIT_SERVER_TYPE   "IMPLICIT_SERVER_TYPE"

Definition at line 317 of file ncbi_connutil.h.

◆ REG_CONN_LB_DISABLE

#define REG_CONN_LB_DISABLE   "LB_DISABLE"

Definition at line 293 of file ncbi_connutil.h.

◆ REG_CONN_LBDNS_DEBUG

#define REG_CONN_LBDNS_DEBUG   DEF_CONN_REG_SECTION "_" "LBDNS_DEBUG"

Definition at line 328 of file ncbi_connutil.h.

◆ REG_CONN_LBDNS_DOMAIN

#define REG_CONN_LBDNS_DOMAIN   DEF_CONN_REG_SECTION "_" "LBDNS_DOMAIN"

Definition at line 327 of file ncbi_connutil.h.

◆ REG_CONN_LBDNS_ENABLE

#define REG_CONN_LBDNS_ENABLE   "LBDNS_ENABLE"

Definition at line 311 of file ncbi_connutil.h.

◆ REG_CONN_LBDNS_HOST

#define REG_CONN_LBDNS_HOST   DEF_CONN_REG_SECTION "_" "LBDNS_HOST"

Definition at line 329 of file ncbi_connutil.h.

◆ REG_CONN_LBDNS_PORT

#define REG_CONN_LBDNS_PORT   DEF_CONN_REG_SECTION "_" "LBDNS_PORT"

Definition at line 330 of file ncbi_connutil.h.

◆ REG_CONN_LBSMD_DISABLE

#define REG_CONN_LBSMD_DISABLE   "LBSMD_DISABLE"

Definition at line 310 of file ncbi_connutil.h.

◆ REG_CONN_LINKERD_ENABLE

#define REG_CONN_LINKERD_ENABLE   "LINKERD_ENABLE"

Definition at line 312 of file ncbi_connutil.h.

◆ REG_CONN_LOCAL_ENABLE

#define REG_CONN_LOCAL_ENABLE   "LOCAL_ENABLE"

Definition at line 309 of file ncbi_connutil.h.

◆ REG_CONN_LOCAL_IPS

#define REG_CONN_LOCAL_IPS   DEF_CONN_REG_SECTION "_" DEF_CONN_LOCAL_IPS

Definition at line 335 of file ncbi_connutil.h.

◆ REG_CONN_LOCAL_SERVER

#define REG_CONN_LOCAL_SERVER   DEF_CONN_REG_SECTION "_" "LOCAL_SERVER"

Definition at line 324 of file ncbi_connutil.h.

◆ REG_CONN_LOCAL_SERVICES

#define REG_CONN_LOCAL_SERVICES   DEF_CONN_REG_SECTION "_" "LOCAL_SERVICES"

Definition at line 323 of file ncbi_connutil.h.

◆ REG_CONN_MAX_TRY

#define REG_CONN_MAX_TRY   "MAX_TRY"

Definition at line 281 of file ncbi_connutil.h.

◆ REG_CONN_NAMERD_ENABLE

#define REG_CONN_NAMERD_ENABLE   "NAMERD_ENABLE"

Definition at line 313 of file ncbi_connutil.h.

◆ REG_CONN_PASS

#define REG_CONN_PASS   "PASS"

Definition at line 242 of file ncbi_connutil.h.

◆ REG_CONN_PATH

#define REG_CONN_PATH   "PATH"

Definition at line 251 of file ncbi_connutil.h.

◆ REG_CONN_PORT

#define REG_CONN_PORT   "PORT"

Definition at line 248 of file ncbi_connutil.h.

◆ REG_CONN_REQ_METHOD

#define REG_CONN_REQ_METHOD   "REQ_METHOD"

Definition at line 236 of file ncbi_connutil.h.

◆ REG_CONN_SERVICE_NAME

#define REG_CONN_SERVICE_NAME   DEF_CONN_REG_SECTION "_" "SERVICE_NAME"

Definition at line 320 of file ncbi_connutil.h.

◆ REG_CONN_STATELESS

#define REG_CONN_STATELESS   "STATELESS"

Definition at line 290 of file ncbi_connutil.h.

◆ REG_CONN_TIMEOUT

#define REG_CONN_TIMEOUT   "TIMEOUT"

Definition at line 278 of file ncbi_connutil.h.

◆ REG_CONN_USER

#define REG_CONN_USER   "USER"

Definition at line 239 of file ncbi_connutil.h.

◆ THIS_MODULE

#define THIS_MODULE   0

Default for THIS_MODULE.

Definition at line 153 of file ncbi_util.h.

◆ UTIL_PRINTABLE_WIDTH

#define UTIL_PRINTABLE_WIDTH   130 /** Default printable width for data */

Definition at line 722 of file ncbi_util.h.

◆ UTIL_PRINTABLE_WIDTH_MIN

#define UTIL_PRINTABLE_WIDTH_MIN   80 /** Default minimum printable width */

Definition at line 721 of file ncbi_util.h.

◆ UTIL_PrintableString

#define UTIL_PrintableString (   d,
  s,
  b,
  f 
)    UTIL_PrintableStringEx((d),(s),(b),(f),0)

Same as UTIL_PrintableStringEx(..., 0) – i.e.

w/o width restrictions.

See also
UTIL_PrintableStringEx

Definition at line 781 of file ncbi_util.h.

◆ UTIL_ReleaseBuffer

#define UTIL_ReleaseBuffer (   x)    /*void*/

Definition at line 809 of file ncbi_util.h.

◆ UTIL_TcharToUtf8

#define UTIL_TcharToUtf8 (   x)    (x)

Definition at line 807 of file ncbi_util.h.

◆ UTIL_TcharToUtf8OnHeap

#define UTIL_TcharToUtf8OnHeap (   x)    (x)

Conversion from Unicode to UTF8, and back.

MSWIN-specific and internal.

Note
UTIL_ReleaseBufferOnHeap() must be used to free the buffers returned from UTIL_TcharToUtf8OnHeap(), and UTIL_ReleaseBuffer() to free the ones returned from UTIL_TcharToUtf8()/UTIL_Utf8ToTchar().
If you change these macros (here and in #else) you need to make similar changes in ncbi_strerror.c as well.

Definition at line 806 of file ncbi_util.h.

◆ UTIL_Utf8ToTchar

#define UTIL_Utf8ToTchar (   x)    (x)

Definition at line 808 of file ncbi_util.h.

Typedef Documentation

◆ EBDebugPrintout

typedef unsigned EBDebugPrintout

Definition at line 167 of file ncbi_connutil.h.

◆ EBFWMode

typedef unsigned EBFWMode

Definition at line 158 of file ncbi_connutil.h.

◆ EBProxyType

typedef unsigned EBProxyType

Definition at line 176 of file ncbi_connutil.h.

◆ EBURLScheme

typedef unsigned EBURLScheme

Definition at line 148 of file ncbi_connutil.h.

◆ EOwnership

typedef enum ENcbiOwnership EOwnership

Ownership relations between objects.

Can be used to define or transfer ownership of objects. For example, specify if a CSocket object owns its underlying SOCK object.

◆ ESwitch

typedef enum ENcbiSwitch ESwitch

Aux.

enum to set/unset/default various features.

Examples
/home/coremake/doxygen/cxx/include/corelib/ncbimisc.hpp.

◆ FLOG_Cleanup

typedef void(* FLOG_Cleanup) (void *data)

Log cleanup callback.

Parameters
dataUnspeficied data as passed to LOG_Create() or LOG_Reset()
See also
LOG_Create, LOG_Reset

Definition at line 374 of file ncbi_core.h.

◆ FLOG_Handler

typedef void(* FLOG_Handler) (void *data, const SLOG_Message *mess)

Log post callback.

Parameters
dataUnspeficied data as passed to LOG_Create() or LOG_Reset()
messComposed from arguments passed to LOG_WriteInternal()
See also
SLOG_Message, LOG_Create, LOG_Reset, LOG_WriteInternal

Definition at line 361 of file ncbi_core.h.

◆ FMT_LOCK_Cleanup

typedef void(* FMT_LOCK_Cleanup) (void *data)

MT lock cleanup callback.

Parameters
dataSee "data" in MT_LOCK_Create()
See also
MT_LOCK_Create, MT_LOCK_Delete

Definition at line 215 of file ncbi_core.h.

◆ FMT_LOCK_Handler

typedef int(* FMT_LOCK_Handler) (void *data, EMT_Lock how)

MT locking callback (operates like a [recursive] mutex or RW-lock).

Parameters
dataSee "data" in MT_LOCK_Create()
howAs passed to MT_LOCK_Do()
Returns
Non-zero value if the requested operation was successful.
Note
The "-1" value is reserved for unset handler; you also may want to return "-1" if your locking function does no locking, and you don't consider it as an error, but still want the caller to be aware of this "rightful non-doing" as opposed to the "rightful doing".
See also
MT_LOCK_Create, MT_LOCK_Delete

Definition at line 204 of file ncbi_core.h.

◆ FREG_Cleanup

typedef void(* FREG_Cleanup) (void *data)

Registry cleanup callback.

Parameters
dataUnspecified data as passed to REG_Create or REG_Reset
See also
REG_Reset, REG_Delete

Definition at line 603 of file ncbi_core.h.

◆ FREG_Get

typedef int(* FREG_Get) (void *data, const char *section, const char *name, char *value, size_t value_size)

Registry getter callback.

Copy registry value stored in "section" under "name" to the "value" buffer. Look for a matching entry first in the transient storage, and then in the persistent storage.

Note
Do not modify "value" (leave it "as is", i.e. empty) if the requested entry was not found in the registry; then, return -1.
Always terminate the "value" with '\0'.
Do not put more than "value_size" bytes into "value" (incl. trailing '\0').
Parameters
dataUnspecified data as passed to REG_Create or REG_Reset
sectionSection name to search
nameKey name to search within the section
valueEmpty value passed in, found (if any) value out
value_sizeSize of "value" storage, must be greater than 0
Returns
1 if successfully found and stored; -1 if not found (the default is to be used); 0 if an error (including truncation) occurred
See also
REG_Create, REG_Reset, REG_Get, FREG_Set

Definition at line 561 of file ncbi_core.h.

◆ FREG_Set

typedef int(* FREG_Set) (void *data, const char *section, const char *name, const char *value, EREG_Storage storage)

Registry setter callback.

Store the "value" in the registry "section" under the "name" key, and according to "storage".

Parameters
dataUnspecified data as passed to REG_Create or REG_Reset
sectionSection name to add the key to
nameKey name to add to the section
valueKey value to associate with the key (NULL to deassociate, i.e. unset)
storageHow to store the new setting, temporarily or permanently
Returns
Non-zero if successful (including replacing a value with itself)
See also
REG_Create, REG_Reset, EREG_Storage, REG_Set, FREG_Get

Definition at line 588 of file ncbi_core.h.

◆ LOG

static void LOG

Definition at line 287 of file ncbi_core.h.

◆ MT_LOCK

typedef struct MT_LOCK_tag* MT_LOCK

Definition at line 171 of file ncbi_core.h.

◆ NCBI_BLOWFISH

Opaque encryption / decryption context type.

Definition at line 56 of file ncbi_blowfish.h.

◆ REG

typedef struct REG_tag* REG

Definition at line 521 of file ncbi_core.h.

◆ STimeout

typedef struct STimeoutTag STimeout

Timeout structure.

See also
CTimeout, g_CTimeoutToSTimeout, g_STimeoutToCTimeout

◆ TConnectInitFlags

typedef unsigned int TConnectInitFlags

Bitwise OR of EConnectInitFlag.

Definition at line 121 of file ncbi_core_cxx.hpp.

◆ TLOG_FormatFlags

typedef unsigned int TLOG_FormatFlags

bitwise OR of "ELOG_FormatFlag"

Definition at line 295 of file ncbi_util.h.

◆ TMark

typedef pair<Uint8, double> CRateMonitor::TMark

Definition at line 58 of file ncbi_misc.hpp.

◆ TNCBI_BigCount

Big unsigned integer for file size and position.

Definition at line 164 of file ncbi_types.h.

◆ TNCBI_Size

typedef unsigned int TNCBI_Size

Fixed-size analogs of size_t and time_t (mainly for IPC)

NCBI_EOWNERSHIP_DEFINED

Definition at line 144 of file ncbi_types.h.

◆ TNCBI_Time

typedef unsigned int TNCBI_Time

Definition at line 145 of file ncbi_types.h.

◆ TReqMethod

typedef unsigned TReqMethod

Definition at line 137 of file ncbi_connutil.h.

◆ TUTIL_PrintableFlags

Bitwise "OR" of EUTIL_PrintableFlags.

Definition at line 731 of file ncbi_util.h.

Enumeration Type Documentation

◆ EConnectInitFlag

CONNECT_Init flags: which parameters to own / initialize.

See also
CONNECT_Init
Enumerator
eConnectInit_OwnNothing 

Original ownership gets retained.

eConnectInit_OwnRegistry 

Registry ownership gets passed.

eConnectInit_OwnLock 

Lock ownership gets passed.

eConnectInit_NoSSL 

Do NOT init secure socket layer (SSL)

Definition at line 115 of file ncbi_core_cxx.hpp.

◆ ECORE_Username

Select which username is the most preferable to obtain from the system.

Enumerator
eCORE_UsernameCurrent 

process UID

eCORE_UsernameLogin 

login UID

eCORE_UsernameReal 

real UID

Definition at line 461 of file ncbi_util.h.

◆ EDebugPrintout

Enumerator
eDebugPrintout_None 
eDebugPrintout_Some 
eDebugPrintout_Data 

Definition at line 161 of file ncbi_connutil.h.

◆ EFWMode

enum EFWMode
Enumerator
eFWMode_Legacy 

Relay, no firewall.

eFWMode_Adaptive 

Regular firewall ports first, then fallback.

eFWMode_Firewall 

Regular firewall ports only, no fallback.

eFWMode_Fallback 

Fallback ports only (w/o trying any regular)

Definition at line 151 of file ncbi_connutil.h.

◆ EIO_Event

enum EIO_Event

I/O event (or direction).

Note
Internally, these constants are used as bit-values, and therefore must not be changed in this header. On the other hand, user code should not rely on the values of these constants, either.
Warning
Careful with an unfortunate naming similarity of eIO_Close from this enum and EIO_Status::eIO_Closed – do not mix the two!
See also
SOCK_Wait, SOCK_Poll, CONN_Wait, SOCK_SetTimeout, CONN_SetTimeout
Enumerator
eIO_Open 

also serves as no-event indicator in SOCK_Poll

eIO_Read 

read

eIO_Write 

write

eIO_ReadWrite 

eIO_Read | eIO_Write (also, eCONN_OnFlush)

eIO_Close 

also serves as an error indicator in SOCK_Poll

Definition at line 118 of file ncbi_core.h.

◆ EIO_ReadMethod

I/O read method.

See also
EIO_WriteMethod
Enumerator
eIO_ReadPeek 

do eIO_ReadPlain but leave data in input queue

eIO_ReadPlain but don't discard data read from CONN, the peek'ed data get extracted from CONNECTOR but stored internally in the CONN buffer, a non-peek read takes data (if any) from that buffer first; *

eIO_ReadPlain 

read readily available data only, wait if none

Read up to "size" bytes from connection to the buffer pointed to by "buf".

Return the number of actually read bytes in "*n_read". May not return eIO_Success if no data at all can be read before either the read timeout expires or an error occurs. Parameter "how" modifies the read behavior: * return immediately after having read as many as just 1 byte from connection (return eIO_Success), or if an error has occurred (and "*n_read == 0"); *

eIO_ReadPersist 

read exactly as much as requested, w/waits

return only after having filled full "buf" with data (exactly "size" bytes, eIO_Success), or if an error has occurred (fewer bytes, non-eIO_Success).

Note
when reading from internal CONN's pending input buffer (that keeps data from previous peeks or pushbacks, eIO_ReadPlain and eIO_ReadPeek behave differently: if there was at least some data obtained from the buffer, then eIO_ReadPlain returns immediately with that data, and does not call CONNECTOR's "Read" method; on the other hand, if eIO_ReadPeek received less than the requested amount of data from the buffer, then it proceeds with CONNECTOR's "Read" method to obtain more data – this behavior is to prevent peeks from spinning, because all the same data are otherwise persistenly available from the pending buffer, and I/O cannot progress with getting more data.
if "conn" has the fCONN_Supplement flag set, then the return code can be non-eIO_Success even with some read data (indicated by "*n_read"), to signify that an error has been _following_ the just read block of data (e.g. eIO_Closed for EOF encountered).
See CONN_SetTimeout() for how to set the read timeout.
See also
CONN_SetTimeout, CONN_ReadLine, CONN_PushBack

Definition at line 88 of file ncbi_core.h.

◆ EIO_Status

enum EIO_Status

I/O status.

Warning
Careful with an unfortunate naming similarity of eIO_Closed from this enum and EIO_Event::eIO_Close – do not mix the two!
Enumerator
eIO_Success 

everything is fine, no error occurred

eIO_Timeout 

timeout expired before any I/O succeeded

eIO_Reserved 

reserved status code – DO NOT USE!

eIO_Interrupt 

signal arrival prevented any I/O to succeed

eIO_InvalidArg 

bad argument / parameter value(s) supplied

eIO_NotSupported 

operation is not supported or is not available

eIO_Unknown 

unknown I/O error (likely fatal but can retry)

Definition at line 132 of file ncbi_core.h.

◆ EIO_WriteMethod

I/O write method.

See also
EIO_ReadMethod
Enumerator
eIO_WriteNone 

invalid reserved opcode, not for use!

eIO_WritePlain 

write as much as possible, report back how much

Write up to "size" bytes from the buffer "buf" to the connection.

Return the number of actually written bytes in "*n_written". May not return eIO_Success if no data at all can be written before either the write timeout expires or an error occurs. Parameter "how" modifies the write behavior: * return immediately after having written as little as 1 byte of data (return eIO_Success), or if an error has occurred (and "*n_written == 0"); *

eIO_WritePersist 

write exactly as much as specified, w/waits

return only after having written all of the data from "buf" (return eIO_Success), or if an error has occurred (fewer bytes written, non-eIO_Success).

Note
if "conn" has the fCONN_Supplement flag set, then the return code can be non-eIO_Success even with some data written (as indicated by "*n_written"), to signify that an error has occurred _past_ the just written block of data.
See CONN_SetTimeout() for how to set the write timeout.
See also
CONN_SetTimeout
eIO_WriteOutOfBand 

write out-of-band chunk of urgent data (if supp)

Definition at line 99 of file ncbi_core.h.

◆ ELOG_FormatFlag

LOG formatting flags: what parts of the message to actually appear.

See also
CORE_SetLOGFormatFlags
Enumerator
fLOG_Default 

fLOG_Short if NDEBUG, else fLOG_Full

fLOG_Level 
fLOG_Module 
fLOG_FileLine 
fLOG_DateTime 
fLOG_Function 
fLOG_FullOctal 

do not do reduction in octal data bytes

fLOG_OmitNoteLevel 

do not add "NOTE" if level is eLOG_Note

fLOG_None 

nothing but spec'd parts, msg and data

Definition at line 284 of file ncbi_util.h.

◆ ELOG_Level

enum ELOG_Level

Log severity level.

Enumerator
eLOG_Trace 
eLOG_Note 
eLOG_Info 

In C++ Toolkit "Info" is used, not "Note".

eLOG_Warning 
eLOG_Error 
eLOG_Critical 
eLOG_Fatal 

Definition at line 292 of file ncbi_core.h.

◆ EMIME_Encoding

Enumerator
eENCOD_None 
eENCOD_Url 
eENCOD_Unknown 

Definition at line 1062 of file ncbi_connutil.h.

◆ EMIME_SubType

Enumerator
eMIME_Undefined 
eMIME_Dispatch 
eMIME_AsnText 
eMIME_AsnBinary 
eMIME_Fasta 
eMIME_WwwForm 
eMIME_Html 
eMIME_Plain 
eMIME_Xml 
eMIME_XmlSoap 
eMIME_OctetStream 
eMIME_Unknown 

Definition at line 1042 of file ncbi_connutil.h.

◆ EMIME_Type

enum EMIME_Type
Enumerator
eMIME_T_Undefined 
eMIME_T_NcbiData 
eMIME_T_Text 
eMIME_T_Application 
eMIME_T_Unknown 

Definition at line 1030 of file ncbi_connutil.h.

◆ EMT_Lock

enum EMT_Lock

Set the lock/unlock callback function and its data for MT critical section.

Note
If the RW-lock functionality is not provided by the callback, then: eMT_LockRead <==> eMT_Lock
Enumerator
eMT_Lock 

lock critical section

eMT_LockRead 

lock critical section for reading

eMT_Unlock 

unlock critical section

eMT_TryLock 

try to lock, return immediately

eMT_TryLockRead 

try to lock for reading, return immediately

Definition at line 180 of file ncbi_core.h.

◆ ENcbiOwnership

Ownership relations between objects.

Can be used to define or transfer ownership of objects. For example, specify if a CSocket object owns its underlying SOCK object.

Enumerator
eNoOwnership 

No ownership is assumed.

eTakeOwnership 

An object can take ownership of another.

eNoOwnership 
eTakeOwnership 

No ownership assumed.

An object can take ownership of another

Definition at line 134 of file ncbi_types.h.

◆ ENcbiRequestID

NCBI request ID enumerator.

Enumerator
eNcbiRequestID_None 
eNcbiRequestID_HitID 

NCBI Hit ID.

eNcbiRequestID_SID 

NCBI Session ID.

Definition at line 432 of file ncbi_util.h.

◆ ENcbiSwitch

Aux.

enum to set/unset/default various features.

Enumerator
eOff 
eOn 
eDefault 
eOff 
eOn 
eDefault 

Definition at line 109 of file ncbi_types.h.

◆ EProxyType

enum EProxyType
Enumerator
fProxy_None 

No $http_proxy / $https_proxy used.

fProxy_Http 

$http_proxy used

fProxy_Https 

$https_proxy used

Definition at line 170 of file ncbi_connutil.h.

◆ EREG_Storage

Transient/Persistent storage.

See also
REG_Get, REG_Set
Enumerator
eREG_Transient 

only in-memory storage while program runs

eREG_Persistent 

hard-copy storage across program runs

Definition at line 528 of file ncbi_core.h.

◆ EReqMethod

enum EReqMethod
Enumerator
eReqMethod_Any 
eReqMethod_Get 
eReqMethod_Post 
eReqMethod_Head 
eReqMethod_Connect 
eReqMethod_v1 
eReqMethod_Any11 
eReqMethod_Get11 
eReqMethod_Post11 
eReqMethod_Head11 
eReqMethod_Connect11 
eReqMethod_Put 
eReqMethod_Patch 
eReqMethod_Trace 
eReqMethod_Delete 
eReqMethod_Options 

Definition at line 116 of file ncbi_connutil.h.

◆ EURLScheme

enum EURLScheme
Enumerator
eURL_Unspec 
eURL_Https 
eURL_File 
eURL_Http 
eURL_Ftp 

Definition at line 140 of file ncbi_connutil.h.

◆ EUTIL_PrintableFlags

Enumerator
fUTIL_PrintableFullOctal 

No contactions in octals \ooo.

eUTIL_PrintableFullOctal 

deprecated

fUTIL_PrintableNoNewLine 

Do not include graphical newlines.

eUTIL_PrintableNoNewLine 

deprecated

Definition at line 725 of file ncbi_util.h.

Function Documentation

◆ BUF_StripToPattern()

EIO_Status BUF_StripToPattern ( BUF  buffer,
const void *  pattern,
size_t  pattern_size,
BUF discard,
size_t *  n_discarded 
)

Definition at line 3063 of file ncbi_connutil.c.

References buffer, s_BUF_IO(), and s_StripToPattern().

◆ CConnIniter()

CConnIniter::CConnIniter ( void  )
protected

◆ CONN_StripToPattern()

EIO_Status CONN_StripToPattern ( CONN  conn,
const void *  pattern,
size_t  pattern_size,
BUF discard,
size_t *  n_discarded 
)

Discard all input data before (and including) the first occurrence of a "pattern".

If "discard" is not NULL then add the stripped data (including the "pattern") to it. If "n_discarded" is not NULL then "*n_discarded" will get the number of actually stripped bytes. If there was some excess read, push it back to the original source (and not count as discarded). NOTE: If "pattern_size" == 0, then "pattern" is ignored (and is assumed to be NULL), and the stripping continues until EOF; if "pattern" is NULL and "pattern_size" is not 0, then exactly "pattern_size" bytes will have attempted to be stripped (unless an I/O error occurs prematurely).

Returns
eIO_Success when the requested operation has completed successfully (pattern found, or the requested number of bytes was skipped, including when either was followed by the end-of-file condition), and if the "discard" buffer was provided, then everything skipped has been successfully stored in it. Otherwise, return other error code, and store everything read / skipped thus far in the "discard" buffer, if provided. Naturally, it never returns eIO_Success when requested to skip through the end of file, but eIO_Closed when the EOF has been reached. Note that memory allocation errors (such as unable to save skipped data in the "discard" buffer) will be assigned the eIO_Unknown code – which as well can be returned from the failing I/O).
Note
To distiguish the nature of eIO_Unknown (whether it is I/O or memory) one can check the grow of the buffer size after the call, and compare it to the value of "*n_discarded": if they agree, there was an I/O error, not the buffer's.

Definition at line 2997 of file ncbi_connutil.c.

References conn, s_CONN_IO(), and s_StripToPattern().

◆ CONNECT_Init()

void CONNECT_Init ( const IRWRegistry reg = 0,
CRWLock lock = 0,
TConnectInitFlags  flag = eConnectInit_OwnNothing,
FSSLSetup  ssl = 0 
)

Init [X]CONNECT library with the specified "reg" and "lock" (ownership for either or both can be detailed in the "flag" parameter).

Warning
MUST be called in MT applications to make CONNECT MT-safe, or alternatively, CConnIniter must be used as a base-class.
Parameters
regRegistry to use, non-modifiable (none if NULL)
lockLock to use (new lock will get created if NULL)
flagOwnership / initialization control
sslTLS provider to use for SSL (ignored if eConnectInit_NoSSL; 0 selects the default provider)
Note
LOG will get created out of CNcbiDiag automatically.
See also
EConnectInitFlag, CConnIniter, REG_cxx2c, LOG_cxx2c, MT_LOCK_cxx2c, NcbiSetupTls, SOCK_SetupSSL, CNcbiApplication, CRWLock, CNcbiRegistry, CNcbiDiag

Definition at line 753 of file ncbi_core_cxx.cpp.

References _TRACE, eConnectInit_Explicit, eConnectInit_NoSSL, g_CORE_Set, NCBI_CATCH_ALL_X, NcbiSetupTls(), NStr::PtrToString(), s_Init(), and NStr::UIntToString().

Referenced by CBsDiffApp::CBsDiffApp(), CDemoApp::Init(), NCBITEST_AUTO_INIT(), CSrcChkApp::Run(), CAnnotWriterApp::Run(), CAsn2FastaApp::Run(), CAsn2FlatApp::Run(), CCleanupApp::Run(), CNCBIwxApplication::Run(), CAgpValidateApplication::Run(), CId2FetchApp::Run(), CAlnBuildApp::Run(), CPairwiseAlnApp::Run(), CSampleAlnmgrApplication::Run(), CEditBioseqSampleApp::Run(), CSampleObjmgrApplication::Run(), and CTbl2AsnApp::Setup().

◆ ConnNetInfo_AddPath()

int ConnNetInfo_AddPath ( SConnNetInfo net_info,
const char *  path 
)

Definition at line 1595 of file ncbi_connutil.c.

References assert, info, memmove, memrchr, s_InfoIsValid(), and x_SepAndLen().

Referenced by x_SetupConnectionParams().

◆ ConnNetInfo_AppendArg()

int ConnNetInfo_AppendArg ( SConnNetInfo net_info,
const char *  arg,
const char *  val 
)

Definition at line 1790 of file ncbi_connutil.c.

References info, s_InfoIsValid(), val, and x_AppendArg().

Referenced by CRPCClient< TRequest, TReply >::x_FillConnNetInfo().

◆ ConnNetInfo_AppendUserHeader()

int ConnNetInfo_AppendUserHeader ( SConnNetInfo net_info,
const char *  header 
)

Definition at line 1023 of file ncbi_connutil.c.

References info, s_InfoIsValid(), and x_StrcatCRLF().

Referenced by s_ModifyUserHeader(), and x_FixupUserHeader().

◆ ConnNetInfo_Boolean()

int ConnNetInfo_Boolean ( const char *  str)

◆ ConnNetInfo_Clone()

SConnNetInfo* ConnNetInfo_Clone ( const SConnNetInfo net_info)

◆ ConnNetInfo_Create()

SConnNetInfo* ConnNetInfo_Create ( const char *  service)

◆ ConnNetInfo_DeleteAllArgs()

void ConnNetInfo_DeleteAllArgs ( SConnNetInfo net_info,
const char *  args 
)

Definition at line 1910 of file ncbi_connutil.c.

References info, s_InfoIsValid(), and x_DeleteAllArgs().

◆ ConnNetInfo_DeleteArg()

int ConnNetInfo_DeleteArg ( SConnNetInfo net_info,
const char *  arg 
)

Definition at line 1887 of file ncbi_connutil.c.

References info, s_InfoIsValid(), and x_DeleteArg().

Referenced by ConnNetInfo_SetupStandardArgs().

◆ ConnNetInfo_DeleteUserHeader()

void ConnNetInfo_DeleteUserHeader ( SConnNetInfo net_info,
const char *  header 
)

◆ ConnNetInfo_Destroy()

void ConnNetInfo_Destroy ( SConnNetInfo net_info)

◆ ConnNetInfo_ExtendUserHeader()

int ConnNetInfo_ExtendUserHeader ( SConnNetInfo net_info,
const char *  header 
)

◆ ConnNetInfo_GetArgs()

const char* ConnNetInfo_GetArgs ( const SConnNetInfo net_info)

Definition at line 1725 of file ncbi_connutil.c.

References info, and s_InfoIsValid().

Referenced by s_Adjust(), s_Connect(), and x_UpdateDtabInArgs().

◆ ConnNetInfo_GetValue()

const char* ConnNetInfo_GetValue ( const char *  service,
const char *  param,
char *  value,
size_t  value_size,
const char *  def_value 
)

◆ ConnNetInfo_Log()

void ConnNetInfo_Log ( const SConnNetInfo net_info,
ELOG_Level  sev,
LOG  log 
)

◆ ConnNetInfo_OverrideUserHeader()

int ConnNetInfo_OverrideUserHeader ( SConnNetInfo net_info,
const char *  header 
)

◆ ConnNetInfo_ParseURL()

int ConnNetInfo_ParseURL ( SConnNetInfo net_info,
const char *  url 
)

◆ ConnNetInfo_PostOverrideArg()

int ConnNetInfo_PostOverrideArg ( SConnNetInfo net_info,
const char *  arg,
const char *  val 
)

◆ ConnNetInfo_PreOverrideArg()

int ConnNetInfo_PreOverrideArg ( SConnNetInfo net_info,
const char *  arg,
const char *  val 
)

◆ ConnNetInfo_PreOverrideUserHeader()

int ConnNetInfo_PreOverrideUserHeader ( SConnNetInfo net_info,
const char *  header 
)

Definition at line 1282 of file ncbi_connutil.c.

References eUserHeaderOp_PreOverride, info, and s_ModifyUserHeader().

Referenced by x_SetHttpHostTag().

◆ ConnNetInfo_PrependArg()

int ConnNetInfo_PrependArg ( SConnNetInfo net_info,
const char *  arg,
const char *  val 
)

Definition at line 1844 of file ncbi_connutil.c.

References info, s_InfoIsValid(), val, and x_PrependArg().

◆ ConnNetInfo_PrependUserHeader()

int ConnNetInfo_PrependUserHeader ( SConnNetInfo net_info,
const char *  header 
)

Definition at line 1032 of file ncbi_connutil.c.

References info, s_InfoIsValid(), and x_StrcatCRLF().

Referenced by s_ModifyUserHeader().

◆ ConnNetInfo_SetArgs()

int ConnNetInfo_SetArgs ( SConnNetInfo net_info,
const char *  args 
)

◆ ConnNetInfo_SetFrag()

int ConnNetInfo_SetFrag ( SConnNetInfo net_info,
const char *  frag 
)

Definition at line 1700 of file ncbi_connutil.c.

References info, and s_InfoIsValid().

Referenced by s_CreateHttpConnector().

◆ ConnNetInfo_SetPath()

int ConnNetInfo_SetPath ( SConnNetInfo net_info,
const char *  path 
)

◆ ConnNetInfo_SetTimeout()

int ConnNetInfo_SetTimeout ( SConnNetInfo net_info,
const STimeout timeout 
)

◆ ConnNetInfo_SetupStandardArgs()

int ConnNetInfo_SetupStandardArgs ( SConnNetInfo net_info,
const char *  service 
)

◆ ConnNetInfo_SetUserHeader()

int ConnNetInfo_SetUserHeader ( SConnNetInfo net_info,
const char *  header 
)

◆ ConnNetInfo_URL()

char* ConnNetInfo_URL ( const SConnNetInfo net_info)

◆ CORE_GetAppName()

const char* CORE_GetAppName ( void  )

Obtain current application name (toolkit dependent).

Returns
Return an empty string ("") when the application name cannot be determined; otherwise, return a '\0'-terminated string

NOTE that setting an application name concurrently with this call can cause undefined behavior or a stale pointer returned.

Definition at line 716 of file ncbi_util.c.

References g_CORE_GetAppName.

Referenced by ConnNetInfo_SetupStandardArgs(), and x_FixupUserHeader().

◆ CORE_GetLOCK()

MT_LOCK CORE_GetLOCK ( void  )

Get the lock handle that is to be used by the core internals.

Returns
MT_LOCK handle of an active lock, or NULL if no lock is currently set
Warning
You may not delete the handle with MT_LOCK_Delete(); use CORE_SetLOCK(0) instead (or replace it with a different MT_LOCK).
Note
CONNECT may provide a default lock implementation on most platforms, so the returned lock may be non-NULL even without a prior call to CORE_SetLOCK().
See also
CORE_SetLOCK

Definition at line 111 of file ncbi_util.c.

References g_CORE_MT_Lock.

Referenced by x_InitLocking().

◆ CORE_GetLOG()

LOG CORE_GetLOG ( void  )

Get the log handle that is to be used by the core internals (CORE LOG).

Returns
LOG handle as previously set by CORE_SetLOG() or NULL if no logging is currently active
Warning
You may not delete the handle by means of LOG_Delete(); use CORE_SetLOG(0) instead (or replace it with a different LOG).
See also
CORE_SetLOG

Definition at line 138 of file ncbi_util.c.

References g_CORE_Log.

Referenced by NcbiOpenURL(), s_Connect(), s_DoLog(), s_SocketConnectorBuilder(), and s_VT_Open().

◆ CORE_GetNcbiRequestID()

char* CORE_GetNcbiRequestID ( ENcbiRequestID  reqid)

Obtain current NCBI request ID (if known, per thread).

Returns
Return NULL when the ID cannot be determined or an error has occurred; otherwise, return a '\0'-terminated, non-empty string that is allocated on the heap, and must be free()'d when no longer needed.

Definition at line 728 of file ncbi_util.c.

References assert, CORE_LOCK_READ, CORE_UNLOCK, eNcbiRequestID_HitID, eNcbiRequestID_SID, g_CORE_GetRequestID, out(), strdup, and x_getenv.

Referenced by x_SetRequestIDs().

◆ CORE_GetPlatform()

const char* CORE_GetPlatform ( void  )

Return NCBI platrofm ID (if known).

Returns
Return read-only textual but machine-readable platform description.

Definition at line 769 of file ncbi_util.c.

References HOST.

Referenced by ConnNetInfo_SetupStandardArgs().

◆ CORE_GetREG()

REG CORE_GetREG ( void  )

Get the registry that is to be used by the core internals.

Returns
Registry handle as previously set by CORE_SetREG() or NULL if none
Warning
You may not delete the handle with REG_Delete(); use CORE_SetREG(0) instead (or replace it with a different REG).
See also
CORE_SetREG

Definition at line 705 of file ncbi_util.c.

References g_CORE_Registry.

Referenced by GetAsnDataViaHTTP().

◆ CORE_GetUsername()

const char* CORE_GetUsername ( char *  buf,
size_t  bufsize 
)

Equivalent to CORE_GetUsernameEx(buf, bufsize, eNCBI_UsernameLogin) except that it always returns non-empty "buf" when successful, or NULL otherwise (i.e.

when the username cannot be either obtained or stored).

See also
CORE_GetUsernameEx, ECORE_Username

Definition at line 962 of file ncbi_util.c.

References buf, bufsize, CORE_GetUsernameEx(), and eCORE_UsernameLogin.

Referenced by s_GetUsername(), and SetDiagUserAndHost().

◆ CORE_GetUsernameEx()

const char* CORE_GetUsernameEx ( char *  buf,
size_t  bufsize,
ECORE_Username  username 
)

Obtain and store in the buffer provided, the best (as possible) user name that matches the requested username selector.

Both "buf" and "bufsize" must not be zeros.

Parameters
bufPointer to buffer to store the user name at
bufsizeSize of buffer in bytes
usernameSelects which username to get (most preferably)
Returns
Return NULL when the user name cannot be stored (e.g. buffer too small); otherwise, return "buf". Return "buf" as an empty string "" if the user name cannot be determined.
Note
For some OSes the username selector may not effect any differences, and for some OS releases, it may cause different results.
See also
CORE_GetUsername, ECORE_Username

Definition at line 801 of file ncbi_util.c.

References assert, buf, bufsize, CORE_LOCK_READ, CORE_LOCK_WRITE, CORE_UNLOCK, eCORE_UsernameCurrent, eCORE_UsernameLogin, eCORE_UsernameReal, login, ncbi::grid::netcache::search::fields::size, STDIN_FILENO, UTIL_ReleaseBuffer, UTIL_TcharToUtf8, x_getenv, and x_SaveStr().

Referenced by CORE_GetUsername(), and s_MakeFrom().

◆ CORE_GetVMPageSize()

size_t CORE_GetVMPageSize ( void  )

Obtain virtual memory page size.

Returns
0 if the page size cannot be determined.

Definition at line 975 of file ncbi_util.c.

References NCBI_DEFAULT_PAGE_SIZE, NCBI_OS_UNIX, and si.

Referenced by LBSM_Shmem_Create().

◆ CORE_Msdelay()

void CORE_Msdelay ( unsigned long  ms)

Delay execution of the current thread by the specified number of milliseconds.

Returns
0 if the page size cannot be determined.

Definition at line 1019 of file ncbi_util.c.

References poll.

Referenced by s_CORE_MT_Lock_default_handler(), s_Shmem_Lock(), s_Shmem_TryWLock(), and s_Shmem_WLock().

◆ CORE_SetLOCK()

void CORE_SetLOCK ( MT_LOCK  lk)

Set the MT critical section lock/unlock handler – to be used by the core internals for protection of internal static variables and other MT-sensitive code from being accessed/changed by several threads simultaneously.

It is also to fully protect the core log handler and core regirsty, including their setup, as well as callback and cleanup functions.

Warning
This function itself is NOT MT-safe!
If there is an active CORE MT-lock set already, which is different from the new one, then MT_LOCK_Delete() is called for the old lock (i.e. the one being replaced).
Note
The following are the minimal requirements for the lock that is to be used as a CORE MT_LOCK in the CONNECT library:
  • if locking for read is available, then the lock must allow one nested lock for read when it has been already locked for write (naturally, by the same thread);
  • if locking for read is not available (i.e. the read lock is implemented as a (write) lock), the lock must allow recursive locking (by the same thread) to the depth of 2.
Parameters
lkMT-Lock as created by MT_LOCK_Create (NULL "lk" drops the internal MT-Lock)
See also
MT_LOCK_Create, MT_LOCK_Delete, CORE_SetLOG, CORE_SetREG

Definition at line 100 of file ncbi_util.c.

References CORE_TRACEF, eCORE_SetLOCK, g_CORE_MT_Lock, g_CORE_Set, and MT_LOCK_Delete().

Referenced by CMergeyApp::Run(), s_Fini(), and s_Init().

◆ CORE_SetLOG()

void CORE_SetLOG ( LOG  lg)

Set the log handle (no logging if "lg" is passed zero) – to be used by the core internals (CORE LOG).

NCBI_CXX_TOOLKIT &&_DEBUG && !NDEBUG If there is an active log handler set already, and it is different from the new one, then LOG_Delete is called internally for the old logger (that is, the one being replaced).

Parameters
lgLOG handle as returned by LOG_Create, or NULL to stop logging
See also
LOG_Create, LOG_Delete, CORE_GetLOG, CORE_SetLOCK

Definition at line 123 of file ncbi_util.c.

References CORE_DEBUG_ARG, CORE_LOCK_WRITE, CORE_TRACEF, CORE_UNLOCK, eCORE_SetLOG, g_CORE_Log, g_CORE_Set, and LOG_Delete().

Referenced by CORE_SetLOGFILE_Ex(), s_Fini(), s_Init(), CBiosampleChkApp::Setup(), CTAbleValApp::Setup(), and CTLSApp::Setup().

◆ CORE_SetLOGFILE()

void CORE_SetLOGFILE ( FILE *  fp,
int  auto_close 
)

Same as CORE_SetLOGFILE_Ex(fp, CORE_LOGFILE_CUTOFF_LEVEL, eLOG_Fatal, auto_close).

See also
CORE_SetLOGFILE_Ex, CORE_SetLOG

Definition at line 156 of file ncbi_util.c.

References CORE_LOGFILE_CUTOFF_LEVEL, CORE_SetLOGFILE_Ex(), eLOG_Fatal, and fp.

◆ CORE_SetLOGFILE_Ex()

void CORE_SetLOGFILE_Ex ( FILE *  fp,
ELOG_Level  cut_off,
ELOG_Level  fatal_err,
int  auto_close 
)

Standard logging (CORE LOG) to the specified file stream.

Parameters
fpThe file stream to log to
cut_offDo not post messages with severity levels lower than specified
fatal_errSeverity greater than or equal to the specified level always posts to log, and then aborts the application
auto_closeWhether to call "fclose(fp)" when the CORE LOG is reset/destroyed
See also
LOG_ToFILE_Ex, CORE_SetLOG

Definition at line 144 of file ncbi_util.c.

References CORE_SetLOG(), fp, LOG_Create(), and LOG_ToFILE_Ex().

Referenced by CORE_SetLOGFILE(), and CORE_SetLOGFILE_NAME_Ex().

◆ CORE_SetLOGFILE_NAME()

int CORE_SetLOGFILE_NAME ( const char *  logfile)

Same as CORE_SetLOGFILE_NAME_Ex(logfile, CORE_LOGFILE_CUTOFF_LEVEL, eLOG_Fatal).

See also
CORE_SetLOGFILE_NAME_Ex, CORE_SetLOG

Definition at line 180 of file ncbi_util.c.

References CORE_LOGFILE_CUTOFF_LEVEL, CORE_SetLOGFILE_NAME_Ex(), and eLOG_Fatal.

◆ CORE_SetLOGFILE_NAME_Ex()

int CORE_SetLOGFILE_NAME_Ex ( const char *  logfile,
ELOG_Level  cut_off,
ELOG_Level  fatal_err 
)

Same as CORE_SetLOGFILE_Ex(fopen(logfile, "a"), cut_off, fatal_err, TRUE).

Parameters
logileFilename to write the log into
cut_offDo not post messages with severity levels lower than specified
fatal_errSeverity greater than or equal to the specified level always posts to log, and then aborts the application
Returns
Return zero on error, non-zero on success
See also
CORE_SetLOGFILE_Ex, CORE_SetLOG

Definition at line 164 of file ncbi_util.c.

References CORE_LOGF_ERRNO_X, CORE_SetLOGFILE_Ex(), eLOG_Error, and fp.

Referenced by CORE_SetLOGFILE_NAME().

◆ CORE_SetLOGFormatFlags()

TLOG_FormatFlags CORE_SetLOGFormatFlags ( TLOG_FormatFlags  flags)

Definition at line 190 of file ncbi_util.c.

References flags, and s_LogFormatFlags.

◆ CORE_SetREG()

void CORE_SetREG ( REG  rg)

Set the registry (no registry if "rg" is passed zero) – to be used by the core internals.

If there is an active registry set already, and it is different from the new one, then REG_Delete() is called for the old(replaced) registry.

Parameters
rgRegistry handle as returned by REG_Create()
See also
REG_Create, REG_Delete, CORE_GetREG, CORE_SetLOCK

Definition at line 692 of file ncbi_util.c.

References CORE_LOCK_WRITE, CORE_UNLOCK, eCORE_SetREG, g_CORE_Registry, g_CORE_Set, and REG_Delete().

Referenced by GetAsnDataViaHTTP(), s_Fini(), s_Init(), CBiosampleChkApp::Setup(), CTAbleValApp::Setup(), and CTLSApp::Setup().

◆ CRateMonitor()

CRateMonitor::CRateMonitor ( double  minspan = 0.5,
double  maxspan = 10.0,
double  weight = 0.5,
double  precision = 0.95 
)
inline

Monitor position progressing in time, calculate speed and estimate time to complete the job (when the final size is known).

Parameters
minspanminimal time distance between marks (must be greater than 0)
maxspanmaximal time span covered by measurements (older marks popped out)
weightfor weighted rate calculations (current:remaining ratio), must be within the interval (0, 1) (excluding both ends); a value close to one (e.g. 0.9) makes recent marks more significant
precisionfraction of minspan to consider sufficient to add a next mark, must be within the interval (0, 1] (excluding 0 but including 1)

Definition at line 73 of file ncbi_misc.hpp.

◆ CSERV_Info()

CSERV_Info::CSERV_Info ( const string host,
unsigned short  port,
double  rate,
ESERV_Type  type 
)
inline

Definition at line 55 of file ncbi_service.hpp.

◆ g_CTimeoutToSTimeout()

const STimeout * g_CTimeoutToSTimeout ( const CTimeout cto,
STimeout sto 
)
inline

CTimeout/STimeout adapters.

Convert CTimeout to STimeout.

Parameters
ctoTimeout value to convert.
stoVariable to receive a numeric timeout value.
Returns
A special constant kDefaultTimeout or kInfiniteTimeout, if the incoming timeout is either a default or an infinite one, respectively. A pointer to the "sto" variable, if the incoming timeout contains some other (finite and numeric) value, and "sto" is used to receive the value.
See also
CTimeout, STimeout

Definition at line 203 of file ncbi_core_cxx.hpp.

References CTimeout::Get(), CTimeout::IsDefault(), CTimeout::IsInfinite(), kDefaultTimeout, kInfiniteTimeout, STimeoutTag::sec, and STimeoutTag::usec.

Referenced by CEUtils_Request::Connect(), SNetServerPoolImpl::Init(), CNetCacheWriter::TransmitImpl(), CCDDClientPool::x_GetClient(), and CHttpRequest::x_InitConnection().

◆ g_STimeoutToCTimeout()

CTimeout g_STimeoutToCTimeout ( const STimeout sto)
inline

◆ GetETA()

double CRateMonitor::GetETA ( void  ) const

How long it will take to complete, at the current rate.

Returns
negative value if cannot estimate

Definition at line 163 of file ncbi_misc.cpp.

References CRateMonitor::GetPos(), CRateMonitor::GetRate(), CRateMonitor::kMinSpan, and CRateMonitor::m_Size.

◆ GetHost()

string CSERV_Info::GetHost ( void  ) const
inline

Definition at line 60 of file ncbi_service.hpp.

References CSERV_Info::m_Host.

◆ GetPace()

double CRateMonitor::GetPace ( void  ) const
inline

How fast the average pace has been so far, in positions per time unit.

Returns
zero if cannot estimate

Definition at line 153 of file ncbi_misc.hpp.

References CRateMonitor::GetTime(), and CRateMonitor::m_Data.

Referenced by CRateMonitor::GetRate().

◆ GetPort()

unsigned short CSERV_Info::GetPort ( void  ) const
inline

Definition at line 61 of file ncbi_service.hpp.

References CSERV_Info::m_Port.

◆ GetPos()

Uint8 CRateMonitor::GetPos ( void  ) const
inline

Get current progress position (position 0 when job starts)

Definition at line 141 of file ncbi_misc.hpp.

References CRateMonitor::m_Data.

Referenced by CRateMonitor::GetETA(), and CRateMonitor::GetTimeRemaining().

◆ GetRate() [1/2]

double CRateMonitor::GetRate ( void  ) const

How fast the recent rate has been, in positions per time unit, using the weighted formula.

Returns
zero if cannot estimate

Definition at line 108 of file ncbi_misc.cpp.

References _ASSERT, _DEBUG_ARG, CRateMonitor::GetPace(), CRateMonitor::kSpan, CRateMonitor::kWeight, CRateMonitor::m_Data, CRateMonitor::m_Rate, n, next(), prev(), and weight.

Referenced by CRateMonitor::GetETA().

◆ GetRate() [2/2]

double CSERV_Info::GetRate ( void  ) const
inline

Definition at line 62 of file ncbi_service.hpp.

References CSERV_Info::m_Rate.

◆ GetSize()

Uint8 CRateMonitor::GetSize ( void  ) const
inline

Get size previously set.

Definition at line 85 of file ncbi_misc.hpp.

References CRateMonitor::m_Size.

◆ GetTime()

double CRateMonitor::GetTime ( void  ) const
inline

Get current time (time 0.0 when job starts)

Definition at line 147 of file ncbi_misc.hpp.

References CRateMonitor::m_Data.

Referenced by CRateMonitor::GetPace().

◆ GetTimeRemaining()

double CRateMonitor::GetTimeRemaining ( void  ) const

How long it will take to complete, at the average pace.

Returns
negative value if cannot estimate

Definition at line 180 of file ncbi_misc.cpp.

References CRateMonitor::GetPos(), CRateMonitor::kMinSpan, CRateMonitor::m_Data, and CRateMonitor::m_Size.

◆ GetType()

ESERV_Type CSERV_Info::GetType ( void  ) const
inline

Definition at line 63 of file ncbi_service.hpp.

References CSERV_Info::m_Type.

◆ IO_StatusStr()

const char* IO_StatusStr ( EIO_Status  status)

◆ LOG_AddRef()

LOG LOG_AddRef ( LOG  lg)

Increment internal reference count by 1, then return "lg".

Parameters
lgA log handle previously obtained from LOG_Create
See also
LOG_Create

Definition at line 353 of file ncbi_core.c.

References LOG_tag::count, LOG_LOCK_WRITE, LOG_UNLOCK, and LOG_VALID.

◆ LOG_ComposeMessage()

char* LOG_ComposeMessage ( const SLOG_Message mess,
TLOG_FormatFlags  flags 
)

Compose a message using the "call_data" info.

Full log record format: mm/dd/yy HH:MM:SS "<file>", line <line>: [<module>::<function>] <level>: <message>
#################### [BEGIN] Raw Data (<raw_size> byte[s]):
<raw_data>
#################### [_END_] Raw Data

Note
The returned string must be deallocated using "free()".
Parameters
messBroken down message
flagsWhich fields of "mess" to use
See also
CORE_SetLOG, CORE_SetLOGFormatFlags

Definition at line 426 of file ncbi_util.c.

References assert, eLOG_Note, eLOG_Trace, SLOG_Message::file, flags, fLOG_DateTime, fLOG_Default, fLOG_FileLine, fLOG_Full, fLOG_FullOctal, fLOG_Function, fLOG_Level, fLOG_Module, fLOG_None, fLOG_OmitNoteLevel, fLOG_Short, SLOG_Message::func, fUTIL_PrintableFullOctal, kOutOfMemory, SLOG_Message::level, SLOG_Message::line, LOG_LevelStr(), malloc(), SLOG_Message::message, SLOG_Message::module, SLOG_Message::raw_data, SLOG_Message::raw_size, str(), util::strncmp(), t, UTIL_PRINTABLE_WIDTH, UTIL_PrintableStringEx(), and UTIL_PrintableStringSize().

Referenced by s_LOG_FileHandler().

◆ LOG_Create()

LOG LOG_Create ( void *  data,
FLOG_Handler  handler,
FLOG_Cleanup  cleanup,
MT_LOCK  lock 
)

Create a new LOG (with an internal reference count set to 1).

Warning
If non-NULL "lock" is specified then MT_LOCK_AddRef() is called on it here, and MT_LOCK_Delete() will be called on it when this LOG gets deleted.
Parameters
dataUnspecified data to call "handler" and "cleanup" with
handlerLog post callback
cleanupCleanup callback
lockProtective MT lock (may be NULL)
See also
MT_LOCK, MT_LOCK_AddRef, FLOG_Handler, FLOG_Cleanup, LOG_Reset, LOG_Delete

Definition at line 312 of file ncbi_core.c.

References LOG_tag::cleanup, cleanup(), LOG_tag::count, LOG_tag::data, data, LOG_tag::handler, kLOG_magic, LOG_tag::lock, LOG_tag::magic, malloc(), and MT_LOCK_AddRef().

Referenced by CORE_SetLOGFILE_Ex(), and LOG_cxx2c().

◆ LOG_cxx2c()

LOG LOG_cxx2c ( void  )

Create LOG on top of C++ Toolkit CNcbiDiag.

Returns
New LOG log (or NULL on error)
See also
LOG_Create, CONNECT_Init

Definition at line 336 of file ncbi_core_cxx.cpp.

References _TRACE, LOG_Create(), and s_LOG_Handler().

Referenced by s_Init(), CBiosampleChkApp::Setup(), CTAbleValApp::Setup(), and CTLSApp::Setup().

◆ LOG_Delete()

LOG LOG_Delete ( LOG  lg)

Decrement internal reference count by 1, and if it reaches 0, then call "lg->cleanup(lg->data)", destroy the handle, and return NULL; otherwise (if reference count is still > 0), return "lg".

Parameters
lgA log handle previously obtained from LOG_Create
See also
LOG_Create

Definition at line 365 of file ncbi_core.c.

References LOG_tag::count, free(), LOG_tag::lock, LOG_LOCK_WRITE, LOG_Reset(), LOG_UNLOCK, LOG_VALID, LOG_tag::magic, and MT_LOCK_Delete().

Referenced by CORE_SetLOG().

◆ LOG_LevelStr()

const char* LOG_LevelStr ( ELOG_Level  level)

Obtain verbal representation of an enum level value.

Parameters
levelAn enum value to get the text form for
Returns
Verbal description of the log level
See also
ELOG_Level

Definition at line 294 of file ncbi_core.c.

References assert, eLOG_Fatal, and eLOG_Trace.

Referenced by LOG_ComposeMessage().

◆ LOG_Reset()

LOG LOG_Reset ( LOG  lg,
void *  data,
FLOG_Handler  handler,
FLOG_Cleanup  cleanup 
)

Reset the "lg" to use the new "data", "handler" and "cleanup".

Note
It does not change the reference count of the log.
Parameters
lgA log handle previously obtained from LOG_Create
dataNew user data
handlerNew log post callback
cleanupNew cleanup callback
Returns
lg (as passed in the first parameter)
See also
LOG_Create

Definition at line 332 of file ncbi_core.c.

References LOG_tag::cleanup, cleanup(), LOG_tag::data, data, LOG_tag::handler, LOG_LOCK_WRITE, LOG_UNLOCK, and LOG_VALID.

Referenced by LOG_Delete(), and LOG_ToFILE_Ex().

◆ LOG_ToFILE()

void LOG_ToFILE ( LOG  lg,
FILE *  fp,
int  auto_close 
)

Same as LOG_ToFILEx(lg, fp, eLOG_Trace, eLOG_Fatal, auto_close).

See also
LOG_ToFILE_Ex

Definition at line 677 of file ncbi_util.c.

References eLOG_Fatal, eLOG_Trace, fp, and LOG_ToFILE_Ex().

◆ LOG_ToFILE_Ex()

void LOG_ToFILE_Ex ( LOG  lg,
FILE *  fp,
ELOG_Level  cut_off,
ELOG_Level  fatal_err,
int  auto_close 
)

LOG_Reset specialized to log to a "FILE*" stream using LOG_ComposeMessage.

Parameters
lgCreated by LOG_Create
fpThe file stream to log to
cut_offDo not post messages with severity levels lower than specified
fatal_errSeverity greater or equal to "fatal_err" always logs and aborts the program
auto_closeWhether to call "fclose(fp)" when the LOG is reset/destroyed
See also
LOG_Create, LOG_Reset, LOG_ComposeMessage, LOG_ToFILE

Definition at line 649 of file ncbi_util.c.

References SFILELogData::auto_close, SFILELogData::cut_off, eLOG_Fatal, SFILELogData::fatal_err, SFILELogData::fp, fp, LOG_Reset(), malloc(), s_LOG_FileCleanup(), and s_LOG_FileHandler().

Referenced by CORE_SetLOGFILE_Ex(), and LOG_ToFILE().

◆ LOG_Write()

void LOG_Write ( LOG  lg,
int  code,
int  subcode,
ELOG_Level  level,
const char *  module,
const char *  func,
const char *  file,
int  line,
const char *  message,
const void *  raw_data,
size_t  raw_size 
)

Upon having filled SLOG_Message data from parameters, write a message (perhaps with raw data attached) to the log by calling LOG_WriteInternal().

Note
Do not call this function directly, if possible. Instead, use the LOG_WRITE() and LOG_DATA() macros from <connect/ncbi_util.h>!
Parameters
codeError code of the message
subcodeError subcode of the message
levelThe message severity
moduleModule name (can be NULL)
funcFunction name (can be NULL)
fileSource file name (can be NULL)
lineSource line within the file (can be 0 to omit the line number)
messageMessage content
raw_dataRaw data to log (can be NULL)
raw_sizeSize of the raw data (can be zero)
See also
LOG_Create, ELOG_Level, LOG_WriteInternal, LOG_WRITE, LOG_DATA

Definition at line 423 of file ncbi_core.c.

References SLOG_Message::dynamic, SLOG_Message::err_code, SLOG_Message::err_subcode, SLOG_Message::file, file, SLOG_Message::func, SLOG_Message::level, SLOG_Message::line, LOG_WriteInternal(), SLOG_Message::message, SLOG_Message::module, SLOG_Message::raw_data, and SLOG_Message::raw_size.

Referenced by ConnNetInfo_Log().

◆ LOG_WriteInternal()

void LOG_WriteInternal ( LOG  lg,
const SLOG_Message mess 
)

Write message (perhaps with raw data attached) to the log by calling "lg->handler(lg->data, mess)".

Note
Do not call this function directly, if possible. Instead, use the LOG_WRITE() and LOG_DATA() macros from <ncbi_util.h>!
Warning
This call free()s "mess->message" when "mess->dynamic" is set non-zero!
Parameters
lgA log handle previously obtained from LOG_Create
Note
In case of a fatal error (eLOG_Fatal found in mess->code), it calls abort() (in Debug builds) or _exit(-1) (in Release builds). Note that no exit handlers are run or any other normal process run-down procedure performed.
See also
LOG_Create, ELOG_Level, FLOG_Handler, LOG_Write

Definition at line 391 of file ncbi_core.c.

References abort(), assert, LOG_tag::data, SLOG_Message::dynamic, eLOG_Fatal, free(), LOG_tag::handler, SLOG_Message::level, LOG_LOCK_READ, LOG_UNLOCK, LOG_VALID, SLOG_Message::message, SLOG_Message::raw_data, and SLOG_Message::raw_size.

Referenced by LOG_Write().

◆ Mark()

void CRateMonitor::Mark ( Uint8  pos,
double  time 
)

Submit a mark of the job progress.

Parameters
poscurrent position (0-based)
timetime spent from the beginning of the job (since time 0.0)

Definition at line 71 of file ncbi_misc.cpp.

References CRateMonitor::kMaxSpan, CRateMonitor::kSpan, CRateMonitor::m_Data, and CRateMonitor::m_Rate.

◆ MIME_ComposeContentTypeEx()

char* MIME_ComposeContentTypeEx ( EMIME_Type  type,
EMIME_SubType  subtype,
EMIME_Encoding  encoding,
char *  buf,
size_t  bufsize 
)

◆ MIME_ParseContentTypeEx()

int MIME_ParseContentTypeEx ( const char *  str,
EMIME_Type type,
EMIME_SubType subtype,
EMIME_Encoding encoding 
)

◆ MT_LOCK_AddRef()

MT_LOCK MT_LOCK_AddRef ( MT_LOCK  lk)

Increment internal reference count by 1, then return "lk".

Parameters
lkA handle previously obtained from MT_LOCK_Create
See also
MT_LOCK_Create, MT_LOCK_Delete

Definition at line 217 of file ncbi_core.c.

References MT_LOCK_tag::count, eMT_Lock, eMT_Unlock, g_CORE_MT_Lock_default, MT_LOCK_Do, and MT_LOCK_VALID.

Referenced by LOG_Create(), and REG_Create().

◆ MT_LOCK_Create()

MT_LOCK MT_LOCK_Create ( void *  data,
FMT_LOCK_Handler  handler,
FMT_LOCK_Cleanup  cleanup 
)

Create a new MT lock (with an internal reference count set to 1).

Parameters
dataUnspecified data to call "handler" and "cleanup" with
handlerLocking callback
cleanupCleanup callback
See also
FMT_LOCK_Handler, FMT_LOCK_Cleanup, MT_LOCK_Delete

Definition at line 198 of file ncbi_core.c.

References MT_LOCK_tag::cleanup, cleanup(), MT_LOCK_tag::count, MT_LOCK_tag::data, data, MT_LOCK_tag::handler, kMT_LOCK_magic, MT_LOCK_tag::magic, and malloc().

Referenced by Blast_CMT_LOCKInit(), and MT_LOCK_cxx2c().

◆ MT_LOCK_cxx2c()

MT_LOCK MT_LOCK_cxx2c ( CRWLock lock = 0,
bool  pass_ownership = false 
)

Convert a C++ Toolkit lock object to an MT_LOCK lock.

Parameters
lockExisting lock to convert (if NULL a new CRWLock will be used)
pass_ownershipTrue if the ownership of non-NULL lock gets passed to new MT_LOCK
Returns
New MT_LOCK lock (or NULL on error)
See also
MT_LOCK_Create, CONNECT_Init

Definition at line 429 of file ncbi_core_cxx.cpp.

References _TRACE, MT_LOCK_Create(), NStr::PtrToString(), s_LOCK_Cleanup(), and s_LOCK_Handler().

Referenced by CMergeyApp::Run(), and s_Init().

◆ MT_LOCK_Delete()

MT_LOCK MT_LOCK_Delete ( MT_LOCK  lk)

Decrement internal reference count by 1, and if it reaches 0, then destroy the handle, call "lk->cleanup(lk->data)", and return NULL; otherwise (if the reference count is still > 0), return "lk".

Parameters
lkA handle previously obtained from MT_LOCK_Create
See also
MT_LOCK_Create, FMT_LOCK_Cleanup

Definition at line 234 of file ncbi_core.c.

References MT_LOCK_tag::cleanup, MT_LOCK_tag::count, MT_LOCK_tag::data, eMT_Lock, eMT_Unlock, free(), g_CORE_MT_Lock_default, MT_LOCK_tag::handler, MT_LOCK_tag::magic, MT_LOCK_VALID, and verify.

Referenced by Blast_DiagnosticsFree(), BlastHSPStreamClose(), BlastHSPStreamFree(), BlastHSPStreamMappingClose(), BlastHSPStreamRegisterMTLock(), BlastHSPStreamSimpleClose(), CORE_SetLOCK(), LOG_Delete(), and REG_Delete().

◆ MT_LOCK_DoInternal()

int MT_LOCK_DoInternal ( MT_LOCK  lk,
EMT_Lock  how 
)

Definition at line 260 of file ncbi_core.c.

References MT_LOCK_tag::data, MT_LOCK_tag::handler, and MT_LOCK_VALID.

◆ NcbiBlowfishDecrypt()

void NcbiBlowfishDecrypt ( NCBI_BLOWFISH  ctx,
Uint8 data 
)

Decrypt a 64-bit of cipher data pointed to by "data" back into the clear text stored at the same location.

Parameters
ctxContext from NcbiBlowfishInit()
dataCipher data replaced with clear text

Definition at line 261 of file ncbi_blowfish.c.

References BF, F(), n, SNcbiBlowfish::P, R, SizeOf, and t.

◆ NcbiBlowfishEncrypt()

void NcbiBlowfishEncrypt ( NCBI_BLOWFISH  ctx,
Uint8 text 
)

Encrypt a 64-bit block of data pointed to by "text" with an encrypted scrambled cipher data stored back at the same location.

Parameters
ctxContext from NcbiBlowfishInit()
textClear text replaced with cipher data

Definition at line 220 of file ncbi_blowfish.c.

References BF, F(), n, SNcbiBlowfish::P, R, SizeOf, and t.

Referenced by NcbiBlowfishInit().

◆ NcbiBlowfishFini()

void NcbiBlowfishFini ( NCBI_BLOWFISH  ctx)

Destroy the context created by NcbiBlowfishInit().

Definition at line 354 of file ncbi_blowfish.c.

References free().

◆ NcbiBlowfishInit()

NCBI_BLOWFISH NcbiBlowfishInit ( const void *  key,
size_t  keylen 
)

Init the cipher context with a key of the specified length.

Note that Blowfish limits the key to be 448 bits (56 bytes) long, so the remainder of a longer key (if so provided) is ignored. A shorter key gets cyclically repeated as necessary to fill up the 56 bytes. To specify a shorter key explicitly pad with zero bits up to 448. Return 0 on memory allocation error.

Definition at line 302 of file ncbi_blowfish.c.

References assert, data, i, kBFInit, ncbi::grid::netcache::search::fields::key, malloc(), MAXKEYLEN, n, NcbiBlowfishEncrypt(), SNcbiBlowfish::P, SNcbiBlowfish::S, and SizeOf.

◆ NcbiMessagePlusError()

const char* NcbiMessagePlusError ( int dynamic,
const char *  message,
int  error,
const char *  descr 
)

Add current "error" (and maybe its description) to the message: <message>[ {error=[[<error>][,]][<descr>]}].

Parameters
dynamic[inout] non-zero pointed value means message was allocated from heap
message[in] message text (can be NULL)
error[in] error code (if it is zero, then use "descr" only if non-NULL/empty)
descr[in] error description (if NULL, then use "strerror(error)" if error!=0)
Returns
Always non-NULL message (perhaps, "") and re-set "*dynamic" as appropriate.
Warning
This routine may call "free(message)" if it had to reallocate the original message that had been allocated dynamically before the call (and "*dynamic" thus had been passed non-zero).
See also
LOG_ComposeMessage

Definition at line 334 of file ncbi_util.c.

References buf, free(), isspace(), kOutOfMemory, malloc(), NCBI_OS_MSWIN, s_WinStrerror(), strerror(), strncasecmp, UTIL_ReleaseBuffer, UTIL_ReleaseBufferOnHeap(), and UTIL_TcharToUtf8.

Referenced by s_HttpConnectorBuilder(), s_ServiceConnectorBuilder(), and x_FormatError().

◆ NcbiMsToTimeout()

STimeout* NcbiMsToTimeout ( STimeout timeout,
unsigned long  ms 
)

Definition at line 48 of file ncbi_types.c.

References int, STimeoutTag::sec, and STimeoutTag::usec.

Referenced by CPipe::ExecWait(), and CSeqUtils::GetAccessionPlacementsMsec().

◆ NcbiTimeoutToMs()

unsigned long NcbiTimeoutToMs ( const STimeout timeout)

◆ REG_AddRef()

REG REG_AddRef ( REG  rg)

Increment internal reference count by 1, then return "rg".

Parameters
rgRegistry handle as previously obtained from REG_Create
See also
REG_Create

Definition at line 528 of file ncbi_core.c.

References REG_tag::count, REG_LOCK_WRITE, REG_UNLOCK, and REG_VALID.

◆ REG_Create()

REG REG_Create ( void *  data,
FREG_Get  get,
FREG_Set  set,
FREG_Cleanup  cleanup,
MT_LOCK  lock 
)

Create a new registry (with an internal reference count set to 1).

Warning
if non-NULL "lock" is specified then MT_LOCK_AddRef() is called on it here, and MT_LOCK_Delete() will be called on it when this REG gets destroyed. Passing NULL callbacks below causes limiting the functionality only to those operations that have the callbacks set for.
Parameters
dataUnspecified data to call "set", "get" and "cleanup" with
getGetter callback
setSetter callback
cleanupCleanup callback
lockProtective MT lock (may be NULL)
See also
MT_LOCK, MT_LOCK_AddRef, REG_Get, REG_Set, REG_Reset, REG_Delete

Definition at line 483 of file ncbi_core.c.

References REG_tag::cleanup, cleanup(), REG_tag::count, REG_tag::data, data, REG_tag::get, kREG_magic, REG_tag::lock, REG_tag::magic, malloc(), MT_LOCK_AddRef(), and REG_tag::set.

Referenced by REG_cxx2c().

◆ REG_cxx2c() [1/2]

REG REG_cxx2c ( const IRWRegistry reg,
bool  pass_ownership = false 
)

Convert a C++ Toolkit read-only registry object to a REG registry.

Note
The returned registry won't have a set method available, and any attempt to set a parameter will fail.
The C++ registries are CObjects, so any we "own" will be deleted if and only if nothing else is still holding a reference to them.
Parameters
regA C++ toolkit registry, on top of which new REG registry is to be created
pass_ownershipTrue if the ownership of "reg" gets passed to new REG
Returns
New REG registry (or NULL on error)
See also
REG_Create, CONNECT_Init

Definition at line 216 of file ncbi_core_cxx.cpp.

References _TRACE, CObject::AddReference(), NStr::PtrToString(), REG_Create(), s_REG_Cleanup(), and s_REG_Get().

◆ REG_cxx2c() [2/2]

REG REG_cxx2c ( IRWRegistry reg,
bool  pass_ownership = false 
)

Convert a C++ Toolkit registry object to a REG registry.

Note
The C++ registries are CObjects, so any we "own" will be deleted if and only if nothing else is still holding a reference to them.
Parameters
regA C++ toolkit registry, on top of which new REG registry is to be created
pass_ownershipTrue if the ownership of "reg" gets passed to new REG
Returns
New REG registry (or NULL on error)
See also
REG_Create, CONNECT_Init

Definition at line 202 of file ncbi_core_cxx.cpp.

References _TRACE, CObject::AddReference(), NStr::PtrToString(), REG_Create(), s_REG_Cleanup(), s_REG_Get(), and s_REG_Set().

Referenced by GetAsnDataViaHTTP(), s_Init(), CBiosampleChkApp::Setup(), CTAbleValApp::Setup(), and CTLSApp::Setup().

◆ REG_Delete()

REG REG_Delete ( REG  rg)

Decrement internal reference count by 1, and if it reaches 0, then call "rg->cleanup(rg->data)", destroy the handle, and return NULL; otherwise (if the reference count is still > 0), return "rg".

Parameters
rgRegistry handle as previously obtained from REG_Create
See also
REG_Create

Definition at line 540 of file ncbi_core.c.

References REG_tag::count, free(), REG_tag::lock, REG_tag::magic, MT_LOCK_Delete(), REG_LOCK_WRITE, REG_Reset(), REG_UNLOCK, and REG_VALID.

Referenced by CORE_SetREG().

◆ REG_Get()

const char* REG_Get ( REG  rg,
const char *  section,
const char *  name,
char *  value,
size_t  value_size,
const char *  def_value 
)

Copy the registry value stored in "section" under name "name" to buffer "value"; if the entry is found in both transient and persistent storages, then copy the one from the transient storage.

If the specified entry is not found in the registry (or if there is no registry defined), and "def_value" is not NULL, then copy "def_value" to "value" (although, only up to "value_size" characters).

Parameters
rgRegistry handle as previously obtained from REG_Create
sectionRegistry section name
nameRegistry entry name
valueBuffer to receive the value of the requested entry, must be non-NULL
value_sizeMaximal size of buffer "value", must be greater than 0
def_valueDefault value (none if passed NULL or "")
Returns
Return "value" if the found value, including the default, and with its '\0' terminator, fits entirely within "value_size"; return NULL if there was an error retrieving the value, or if it had to be truncated (but regardless, "value" must always be kept '\0'-terminated unless "value_size" was zero).
See also
REG_Create, REG_Set

Definition at line 566 of file ncbi_core.c.

References REG_tag::data, REG_tag::get, len, REG_LOCK_READ, REG_UNLOCK, REG_VALID, strncpy0(), and rapidjson::value.

Referenced by g_CORE_RegistryGET().

◆ REG_Reset()

void REG_Reset ( REG  rg,
void *  data,
FREG_Get  get,
FREG_Set  set,
FREG_Cleanup  cleanup,
int  do_cleanup 
)

Reset the registry handle to use the new "data", "set", "get", and "cleanup".

Note
No change to the internal reference count.
Parameters
rgRegistry handle as previously obtained from REG_Create
dataNew user data
getNew getter callback
setNew setter callback
cleanupNew cleanup callback
do_cleanupWhether to call old cleanup (if any specified) for old data
See also
REG_Create, REG_Delete

Definition at line 505 of file ncbi_core.c.

References REG_tag::cleanup, cleanup(), REG_tag::data, data, REG_tag::get, REG_LOCK_WRITE, REG_UNLOCK, REG_VALID, and REG_tag::set.

Referenced by REG_Delete().

◆ REG_Set()

int REG_Set ( REG  rg,
const char *  section,
const char *  name,
const char *  value,
EREG_Storage  storage 
)

Store the "value" into the registry section "section" under the key "name", and according to "storage".

Parameters
rgRegistry handle as previously obtained from REG_Create
sectionSection name to store the value into
nameName to store the value under
valueThe value to store (NULL to unset the parameter)
storageWhether to store temporarily or permanently
Returns
Non-zero if successful (including replacing a value with itself)
See also
REG_Create, EREG_Storage, REG_Get

Definition at line 604 of file ncbi_core.c.

References REG_tag::data, REG_LOCK_READ, REG_UNLOCK, REG_VALID, REG_tag::set, and rapidjson::value.

Referenced by g_CORE_RegistrySET().

◆ SERV_GetServers()

vector<CSERV_Info> SERV_GetServers ( const string service,
TSERV_TypeOnly  types = fSERV_Any 
)

Get the servers for a given service.

Parameters
[in]serviceService name
[in]typesWhich service types to obtain
Returns
List of servers (ordered according to their rates)

Definition at line 76 of file ncbi_service_cxx.cpp.

References _TRACE, ConnNetInfo_Create(), eUnknown, fSERV_All, fSERV_Any, fSERV_Firewall, AutoPtr< X, Del >::get(), hex(), info, kEmptyStr, NCBI_THROW, NcbiIsEmptyIPv6(), NcbiIsIPv4(), NStr::NumericToString(), SERV_AddrOfInfo(), SERV_ANYHOST, SERV_Close(), SERV_GetNextInfo(), SERV_Open(), SERV_TypeStr(), types, and x_HostOfInfo().

◆ SetSize()

void CRateMonitor::SetSize ( Uint8  size)
inline

Set size of the anticipated job, clear all prior measurements.

Definition at line 133 of file ncbi_misc.hpp.

References CRateMonitor::m_Data, CRateMonitor::m_Rate, CRateMonitor::m_Size, and ncbi::grid::netcache::search::fields::size.

◆ SOCK_StripToPattern()

EIO_Status SOCK_StripToPattern ( SOCK  sock,
const void *  pattern,
size_t  pattern_size,
BUF discard,
size_t *  n_discarded 
)

Definition at line 3028 of file ncbi_connutil.c.

References s_SOCK_IO(), and s_StripToPattern().

Referenced by s_ReadHeader(), x_ReadChunkHead(), and x_ReadChunkTail().

◆ URL_Connect()

SOCK URL_Connect ( const char *  host,
unsigned short  port,
const char *  path,
const char *  args,
EReqMethod  req_method,
size_t  content_length,
const STimeout o_timeout,
const STimeout rw_timeout,
const char *  user_header,
int  encode_args,
TSOCK_Flags  flags 
)

◆ URL_ConnectEx()

EIO_Status URL_ConnectEx ( const char *  host,
unsigned short  port,
const char *  path,
const char *  args,
TReqMethod  req_method,
size_t  content_length,
const STimeout o_timeout,
const STimeout rw_timeout,
const char *  user_header,
SURLExtra extra,
TSOCK_Flags  flags,
SOCK sock 
)

◆ URL_Decode()

int URL_Decode ( const void *  src_buf,
size_t  src_size,
size_t *  src_read,
void *  dst_buf,
size_t  dst_size,
size_t *  dst_written 
)

Definition at line 3193 of file ncbi_connutil.c.

References URL_DecodeEx().

◆ URL_DecodeEx()

int URL_DecodeEx ( const void *  src_buf,
size_t  src_size,
size_t *  src_read,
void *  dst_buf,
size_t  dst_size,
size_t *  dst_written,
const char *  allow_symbols 
)

Definition at line 3134 of file ncbi_connutil.c.

References assert, s_HexChar(), and VALID_URL_SYMBOL.

Referenced by s_Read(), and URL_Decode().

◆ URL_Encode()

void URL_Encode ( const void *  src_buf,
size_t  src_size,
size_t *  src_read,
void *  dst_buf,
size_t  dst_size,
size_t *  dst_written 
)

Definition at line 3246 of file ncbi_connutil.c.

References URL_EncodeEx().

Referenced by s_Connect(), s_VT_Write(), URL_Connect(), and x_UpdateDtabInArgs().

◆ URL_EncodeEx()

void URL_EncodeEx ( const void *  src_buf,
size_t  src_size,
size_t *  src_read,
void *  dst_buf,
size_t  dst_size,
size_t *  dst_written,
const char *  allow_symbols 
)

Definition at line 3206 of file ncbi_connutil.c.

References assert, and s_EncodeTable.

Referenced by URL_Encode().

◆ UTIL_Adler32_Update()

unsigned int UTIL_Adler32_Update ( unsigned int  checksum,
const void *  ptr,
size_t  len 
)

Calculate/Update Adler-32 checksum NB: Initial checksum is "1".

Parameters
checksumChecksum to update (start with 1)
ptrBlock of data
lenSize of block of data
Returns
Return the checksum updated according to the contents of the block pointed to by "ptr" and having "len" bytes in it.

Definition at line 1174 of file ncbi_util.c.

References a, ADJUST_ADLER, b, data, FINALIZE_ADLER, i, len, and MAXLEN_ADLER.

Referenced by s_VerifyChecksum().

◆ UTIL_CRC32_Update()

unsigned int UTIL_CRC32_Update ( unsigned int  checksum,
const void *  ptr,
size_t  len 
)

Calculate/Update CRC-32 checksum NB: Initial checksum is "0".

Parameters
checksumChecksum to update (start with 0)
ptrBlock of data
lenSize of block of data
Returns
Return the checksum updated according to the contents of the block pointed to by "ptr" and having "len" bytes in it.

Definition at line 1149 of file ncbi_util.c.

References data, i, len, and s_CRC32Table.

Referenced by s_VerifyChecksum().

◆ UTIL_GenerateHMAC()

void* UTIL_GenerateHMAC ( const SHASH_Descriptor hash,
const void *  text,
size_t  text_len,
const void *  key,
size_t  key_len,
void *  digest 
)

Generate an RFC2401 digest (HMAC).

Parameters
hashHash function descriptor
textText to get a digest for
text_keyByte length of the text
keyKey to hash the text with
key_lenByte length of the key (recommended to be no less than "hash::digest_len")
digestThe resultant HMAC storage (must be of an adequate size)
Returns
NULL on errors ("digest" will not be valid), or "digest" on success.
See also
SHASH_Descriptor

Definition at line 1220 of file ncbi_util.c.

References ctx, free(), i, ncbi::grid::netcache::search::fields::key, malloc(), pad(), text(), and tmp.

◆ UTIL_HelpRequested()

int UTIL_HelpRequested ( int  argc,
char **  argv 
)

Given the main()'s argc and argv return non-zero (true) if the arguments specify that only a help option was requested.

Return 0 (false), otherwise.

Definition at line 1416 of file ncbi_util.c.

References strcasecmp, and util::strcmp().

◆ UTIL_MatchesMask()

int UTIL_MatchesMask ( const char *  text,
const char *  mask 
)

Shortcut for UTIL_MatchesMaskEx(text, mask, 1), that is matching is done case-insensitively for the letters (a-z).

See also
UTIL_MatchesMaskEx

Definition at line 1378 of file ncbi_util.c.

References mask, text(), and UTIL_MatchesMaskEx().

Referenced by s_LoadServices(), and x_NameMatch().

◆ UTIL_MatchesMaskEx()

int UTIL_MatchesMaskEx ( const char *  text,
const char *  mask,
int  ignore_case 
)

Match a given text with a given pattern mask.

Very similar to fnmatch(3), but there are differences (see also glob(7)). There's no special treatment for a slash character '/' in this call.

Parameters
textA text to match
maskA text pattern, which, along with ordinary characters that must match literally in the given "text", can contain: '*' to denote any sequence of characters (including none), '?' to denote any single character, and character classes in the forms of "[...]" or "[!...]" that must MATCH or NOT MATCH, respectively, a single character in "text". To cancel the special meaning of '*', '?' or '[', they can be prepended with a backslash '\' (the backslash in front of other characters does not change their meaning, so "\\\\" matches one graphical backslash in the "text"). Within a character class, to have its literal meaning a closing square bracket ']' must be used at the first position, whereas '?', '*', '[, and '\' stand just for themselves. Two characters separated by a minus sign '-' denote a range that can be used for contraction to include all characters in between: "[A-F]" is equivalent to "[ABCDEF]". For its literal meaning, the minus sign '-' can be used either at the very first position, or the last position before the closing bracket ']'. To have a range that begins with an exclamation point, one has to use a dummy empty range followed by that range with '!'. Examples: "!" matches a single '!' (note that just "[!]" is invalid); "[!!]" matches any character, which is not an exclamation point '!'; "[][!]" matches ']', '[', and '!'; "[!][-]" matches any character except for ']', '[', and '-'; "[-]" matches a minus sign '-' (same as '-' just by itself); "[?*\\]" matches either '?', or '*', or a backslash '\'; "[]-\\]" matches nothing as it defines an empty range (from ']' to '\'); "\\[a]\\*" matches a literal substring "[a]*"; "[![a-]" matches any char but '[', 'a' or '-' (same as "[!-[a]"; but not "[![-a]", which defines an empty range, thus matches any char!); "[]A]" matches either ']' or 'A' (NB: "[A]]" matches a substring "A]"); "[0-9-]" matches any decimal digit or a minus sign '-' (same: "[-0-9]"); "[9-0!-$]" matches '!', '"', '#', and '$' (as first range matches nothing).
Note
In the above, each double backslash denotes a single graphical backslash character (C string notation is used).
Unlike shell globbing, "[--0]" *does* match the slash character '/' (along with '-', '.', and '0' that all fall within the range).
Parameters
ignore_caseWhether to ignore the case of the letters (a-z) in comparisons
Returns
Non-zero if "text" matches "mask"; otherwise (including pattern errors), return zero
See also
UTIL_MatchesMask

Definition at line 1371 of file ncbi_util.c.

References mask, text(), and x_MatchesMask().

Referenced by UTIL_MatchesMask().

◆ UTIL_NcbiLocalHostName()

char* UTIL_NcbiLocalHostName ( char *  hostname)

Cut off well-known NCBI domain suffix out of the passed "hostname".

Parameters
hostnameHostname to shorten (if possible)
Returns
NULL if the hostname wasn't modified; otherwise, return "hostname" (shortened in place)

Definition at line 1384 of file ncbi_util.c.

References assert, i, len, and strncasecmp.

Referenced by x_ClientAddress().

◆ UTIL_PrintableStringEx()

char* UTIL_PrintableStringEx ( const char *  data,
size_t  size,
char *  buf,
TUTIL_PrintableFlags  flags,
int  width 
)

Create a printable representation of a block of data of the specified size (or, if size is 0, strlen(data)), and return the buffer pointer past the last stored character (non '\0'-terminated).

Non-printable characters can be represented in a reduced octal form as long as the result is unambiguous (unless "full" passed true (non-zero), in which case all non-printable characters get represented by full octal tetrads).

Note
Hexadecimal output is not used because it is ambiguous by the standard (can contain arbitrary number of hex digits, which may be indistiguishable from the following text[a-z][A-Z] or numerals[0-9]).
The input buffer "buf" where to store the printable representation is assumed to be of adequate size to hold the resultant string (use UTIL_PrintableStringSize() to obtain the size prior to this call).
Parameters
dataBlock of data (NULL causes NULL to return regardless of "size" or "buf")
sizeSize of block (0 causes strlen(data) to be used)
bufBuffer to store the result (NULL always causes NULL to return)
flagsHow to print representations of certain non-printable characters
widthInsert escaped line breaks when output line exceeds "width"; no-op if 0
Returns
Next position in the buffer past the last stored character
Warning
The call *does not* '\0'-terminate its output!
Successive calls of UTIL_PrintableString() that append to the same buffer one after another may not produce a well-formed C string literal, in all.
See also
UTIL_PrintableStringSize, EUTIL_PrintableFlags

Definition at line 219 of file ncbi_util.c.

References flags, fUTIL_PrintableFullOctal, fUTIL_PrintableNoNewLine, isprint(), ncbi::grid::netcache::search::fields::size, and UTIL_PRINTABLE_WIDTH_MIN.

Referenced by LOG_ComposeMessage(), and s_LOG_Handler().

◆ UTIL_PrintableStringSize()

size_t UTIL_PrintableStringSize ( const char *  data,
size_t  size 
)

Calculate size of buffer needed to store printable representation of the block of data of the specified size (or, if size is 0, strlen(data)) but without the '\0' terminator.

Warning
The calculated size does not account for a terminating '\0'!
Parameters
dataBlock of data (NULL causes 0 to return regardless of "size")
sizeSize of the block (0 causes strlen(data) to be used)
Returns
The buffer size needed (0 for NULL or empty data)
See also
UTIL_PrintableStringEx, UTIL_PrintableString

Definition at line 198 of file ncbi_util.c.

References data, isprint(), ncbi::grid::netcache::search::fields::size, and UTIL_PRINTABLE_WIDTH_MIN.

Referenced by ConnNetInfo_Log(), LOG_ComposeMessage(), and s_LOG_Handler().

◆ UTIL_ReleaseBufferOnHeap()

void UTIL_ReleaseBufferOnHeap ( const void *  ptr)

Variable Documentation

◆ block_len

size_t SHASH_Descriptor::block_len

Definition at line 579 of file ncbi_util.h.

◆ client_host

char SConnNetInfo::client_host[255+1]

Definition at line 195 of file ncbi_connutil.h.

Referenced by ConnNetInfo_CloneInternal(), and x_SetDefaultReferer().

◆ CORE_GetNcbiRequestDtab

char* CORE_GetNcbiRequestDtab
extern

NCBI request "DTab-Local" header.

◆ cred

NCBI_CRED SURLExtra::cred

SSL credentials (if any)

Definition at line 738 of file ncbi_connutil.h.

Referenced by URL_ConnectEx().

◆ credentials

NCBI_CRED SConnNetInfo::credentials

Definition at line 223 of file ncbi_connutil.h.

Referenced by ConnNetInfo_CloneInternal(), s_Connect(), and s_SocketConnectorBuilder().

◆ debug_printout

EBDebugPrintout SConnNetInfo::debug_printout

◆ digest_len

size_t SHASH_Descriptor::digest_len

Definition at line 580 of file ncbi_util.h.

◆ dynamic

int SLOG_Message::dynamic

Definition at line 339 of file ncbi_core.h.

Referenced by LOG_Write(), and LOG_WriteInternal().

◆ err_code

int SLOG_Message::err_code

Definition at line 348 of file ncbi_core.h.

Referenced by LOG_Write().

◆ err_subcode

int SLOG_Message::err_subcode

Definition at line 349 of file ncbi_core.h.

Referenced by LOG_Write().

◆ external

unsigned SConnNetInfo::external

◆ file

const char* SLOG_Message::file

Definition at line 344 of file ncbi_core.h.

Referenced by LOG_ComposeMessage(), and LOG_Write().

◆ fini

void(* SHASH_Descriptor::fini) (void *ctx, void *digest)

Definition at line 584 of file ncbi_util.h.

◆ firewall

EBFWMode SConnNetInfo::firewall

◆ func

const char* SLOG_Message::func

Definition at line 343 of file ncbi_core.h.

Referenced by LOG_ComposeMessage(), and LOG_Write().

◆ host [1/2]

char SConnNetInfo::host[255+1]

◆ host [2/2]

const char* SURLExtra::host

SSL host id (aka SNI) (if differs from "host")

Definition at line 739 of file ncbi_connutil.h.

Referenced by URL_ConnectEx().

◆ http_proxy_host

char SConnNetInfo::http_proxy_host[255+1]

◆ http_proxy_leak

unsigned SConnNetInfo::http_proxy_leak

◆ http_proxy_mask

EBProxyType SConnNetInfo::http_proxy_mask

◆ http_proxy_pass

char SConnNetInfo::http_proxy_pass[63+1]

◆ http_proxy_port

unsigned short SConnNetInfo::http_proxy_port

◆ http_proxy_skip

unsigned SConnNetInfo::http_proxy_skip

Definition at line 206 of file ncbi_connutil.h.

Referenced by ConnNetInfo_CloneInternal(), s_SocketConnectorBuilder(), and s_VT_Open().

◆ http_proxy_user

char SConnNetInfo::http_proxy_user[63+1]

◆ http_push_auth

unsigned SConnNetInfo::http_push_auth

◆ http_referer

const char* SConnNetInfo::http_referer

◆ http_user_header

const char* SConnNetInfo::http_user_header

◆ http_version

unsigned SConnNetInfo::http_version

◆ init

int(* SHASH_Descriptor::init) (void **ctx)

Definition at line 582 of file ncbi_util.h.

◆ kMaxSpan

const double CRateMonitor::kMaxSpan
protected

Definition at line 123 of file ncbi_misc.hpp.

Referenced by CRateMonitor::Mark().

◆ kMinSpan

const double CRateMonitor::kMinSpan
protected

Definition at line 122 of file ncbi_misc.hpp.

Referenced by CRateMonitor::GetETA(), and CRateMonitor::GetTimeRemaining().

◆ kSpan

const double CRateMonitor::kSpan
protected

Definition at line 125 of file ncbi_misc.hpp.

Referenced by CRateMonitor::GetRate(), and CRateMonitor::Mark().

◆ kWeight

const double CRateMonitor::kWeight
protected

Definition at line 124 of file ncbi_misc.hpp.

Referenced by CRateMonitor::GetRate().

◆ lb_disable

unsigned SConnNetInfo::lb_disable

◆ level

ELOG_Level SLOG_Message::level

Definition at line 341 of file ncbi_core.h.

Referenced by LOG_ComposeMessage(), LOG_Write(), LOG_WriteInternal(), and s_LOG_FileHandler().

◆ line

int SLOG_Message::line

Definition at line 345 of file ncbi_core.h.

Referenced by LOG_ComposeMessage(), and LOG_Write().

◆ m_Data

list<TMark> CRateMonitor::m_Data
protected

◆ m_Host

string CSERV_Info::m_Host
private

Definition at line 66 of file ncbi_service.hpp.

Referenced by CSERV_Info::GetHost().

◆ m_Port

unsigned short CSERV_Info::m_Port
private

Definition at line 67 of file ncbi_service.hpp.

Referenced by CSERV_Info::GetPort().

◆ m_Rate [1/2]

double CRateMonitor::m_Rate
mutableprotected

Cached rate from last calculation.

Definition at line 127 of file ncbi_misc.hpp.

Referenced by CRateMonitor::GetRate(), CRateMonitor::Mark(), and CRateMonitor::SetSize().

◆ m_Rate [2/2]

double CSERV_Info::m_Rate
private

Definition at line 68 of file ncbi_service.hpp.

Referenced by CSERV_Info::GetRate().

◆ m_Size

Uint8 CRateMonitor::m_Size
protected

Total size of job to be performed.

Definition at line 129 of file ncbi_misc.hpp.

Referenced by CRateMonitor::GetETA(), CRateMonitor::GetSize(), CRateMonitor::GetTimeRemaining(), and CRateMonitor::SetSize().

◆ m_Type

ESERV_Type CSERV_Info::m_Type
private

Definition at line 69 of file ncbi_service.hpp.

Referenced by CSERV_Info::GetType().

◆ magic

unsigned int SConnNetInfo::magic

Definition at line 226 of file ncbi_connutil.h.

Referenced by ConnNetInfo_CloneInternal().

◆ max_try

unsigned short SConnNetInfo::max_try

◆ message

const char* SLOG_Message::message

Definition at line 340 of file ncbi_core.h.

Referenced by LOG_ComposeMessage(), LOG_Write(), and LOG_WriteInternal().

◆ module

const char* SLOG_Message::module

Definition at line 342 of file ncbi_core.h.

Referenced by LOG_ComposeMessage(), and LOG_Write().

◆ pass

char SConnNetInfo::pass[63+1]

◆ path

char SConnNetInfo::path[4095+1]

◆ port

unsigned short SConnNetInfo::port

◆ raw_data

const void* SLOG_Message::raw_data

Definition at line 346 of file ncbi_core.h.

Referenced by LOG_ComposeMessage(), LOG_Write(), and LOG_WriteInternal().

◆ raw_size

size_t SLOG_Message::raw_size

Definition at line 347 of file ncbi_core.h.

Referenced by LOG_ComposeMessage(), LOG_Write(), and LOG_WriteInternal().

◆ req_method

TReqMethod SConnNetInfo::req_method

◆ reserved

unsigned SConnNetInfo::reserved

Definition at line 208 of file ncbi_connutil.h.

Referenced by ConnNetInfo_CloneInternal().

◆ scheme

EBURLScheme SConnNetInfo::scheme

◆ sec

unsigned int STimeoutTag::sec

◆ stateless

unsigned SConnNetInfo::stateless

◆ svc

const char SConnNetInfo::svc[1]

◆ timeout

const STimeout* SConnNetInfo::timeout

◆ tmo

STimeout SConnNetInfo::tmo

Definition at line 227 of file ncbi_connutil.h.

Referenced by ConnNetInfo_CloneInternal().

◆ unused

unsigned short SConnNetInfo::unused

Definition at line 219 of file ncbi_connutil.h.

Referenced by ConnNetInfo_CloneInternal().

◆ update

void(* SHASH_Descriptor::update) (void *ctx, const void *data, size_t data_len)

Definition at line 583 of file ncbi_util.h.

◆ usec

unsigned int STimeoutTag::usec

◆ user

char SConnNetInfo::user[63+1]
Modified on Mon Apr 22 04:04:09 2024 by modify_doxy.py rev. 669887