⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ncbi_server_info.h

📁 ncbi源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * =========================================================================== * PRODUCTION $Log: ncbi_server_info.h,v $ * PRODUCTION Revision 1000.0  2003/10/29 16:32:13  gouriano * PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R6.37 * PRODUCTION * =========================================================================== */#ifndef CONNECT___NCBI_SERVER_INFO__H#define CONNECT___NCBI_SERVER_INFO__H/*  $Id: ncbi_server_info.h,v 1000.0 2003/10/29 16:32:13 gouriano Exp $ * =========================================================================== * *                            PUBLIC DOMAIN NOTICE *               National Center for Biotechnology Information * *  This software/database is a "United States Government Work" under the *  terms of the United States Copyright Act.  It was written as part of *  the author's official duties as a United States Government employee and *  thus cannot be copyrighted.  This software/database is freely available *  to the public for use. The National Library of Medicine and the U.S. *  Government have not placed any restriction on its use or reproduction. * *  Although all reasonable efforts have been taken to ensure the accuracy *  and reliability of the software and data, the NLM and the U.S. *  Government do not and cannot warrant the performance or results that *  may be obtained by using this software or data. The NLM and the U.S. *  Government disclaim all warranties, express or implied, including *  warranties of performance, merchantability or fitness for any particular *  purpose. * *  Please cite the author in any work or product based on this material. * * =========================================================================== * * Author:  Anton Lavrentiev, Denis Vakatov * * File Description: *   NCBI server meta-address info *   Note that all server meta-addresses are allocated as *   single contiguous pieces of memory, which can be copied in whole *   with the use of 'SERV_SizeOfInfo' call. Dynamically allocated *   server infos can be freed with a direct call to 'free'. *   Assumptions on the fields: all fields in the server info come in *   host byte order except 'host', which comes in network byte order. * */#include <connect/ncbi_connutil.h>/** @addtogroup ServiceSupport * * @{ */#ifdef __cplusplusextern "C" {#endif/* Server types */typedef enum {    fSERV_Ncbid      = 0x1,    fSERV_Standalone = 0x2,    fSERV_HttpGet    = 0x4,    fSERV_HttpPost   = 0x8,    fSERV_Http       = fSERV_HttpGet | fSERV_HttpPost,    fSERV_Firewall   = 0x10,    fSERV_Dns        = 0x20} ESERV_Type;#define fSERV_Any           0#define fSERV_StatelessOnly 0x80typedef unsigned int TSERV_Type;  /* bit-wise OR of "ESERV_Type" flags *//* Flags to specify the algorithm for selecting the most preferred * server from the set of available servers */typedef enum {    fSERV_Regular = 0x0,    fSERV_Blast   = 0x1} ESERV_Flags;#define SERV_DEFAULT_FLAG           fSERV_Regular#define SERV_MIME_TYPE_UNDEFINED    ((EMIME_Type)(-1))#define SERV_MIME_SUBTYPE_UNDEFINED ((EMIME_SubType)(-1))                                 /* Verbal representation of a server type (no internal spaces allowed) */extern NCBI_XCONNECT_EXPORT const char* SERV_TypeStr(ESERV_Type type );/* Read server info type. * If successful, assign "type" and return pointer to the position * in the "str" immediately following the type tag. * On error, return NULL. */extern NCBI_XCONNECT_EXPORT const char* SERV_ReadType(const char* str, ESERV_Type* type );/* Meta-addresses for various types of NCBI servers */typedef struct {    TNCBI_Size     args;#define SERV_NCBID_ARGS(ui)     ((char*) (ui) + (ui)->args)} SSERV_NcbidInfo;typedef struct {    char           dummy;       /* placeholder, not used                     */} SSERV_StandaloneInfo;typedef struct {    TNCBI_Size     path;    TNCBI_Size     args;#define SERV_HTTP_PATH(ui)      ((char*) (ui) + (ui)->path)#define SERV_HTTP_ARGS(ui)      ((char*) (ui) + (ui)->args)} SSERV_HttpInfo;typedef struct {    ESERV_Type     type;        /* type of original server                   */} SSERV_FirewallInfo;typedef struct {    char         pad[8];        /* reserved for the future use, must be zero */} SSERV_DnsInfo;/* Generic NCBI server meta-address */typedef union {    SSERV_NcbidInfo      ncbid;    SSERV_StandaloneInfo standalone;    SSERV_HttpInfo       http;    SSERV_FirewallInfo   firewall;    SSERV_DnsInfo        dns;} USERV_Info;typedef struct {    ESERV_Type            type; /* type of server                            */    unsigned int          host; /* host the server running on, network b.o.  */    unsigned short        port; /* port the server running on, host b.o.     */    unsigned char/*bool*/ sful; /* true for stateful-only server (default=no)*/    unsigned char/*bool*/ locl; /* true for local (LBSMD-only) server(def=no)*/    TNCBI_Time            time; /* relaxation period / expiration time       */    double                coef; /* bonus coefficient for server run locally  */    double                rate; /* rate of the server                        */    EMIME_Type          mime_t; /* type,                                     */    EMIME_SubType       mime_s; /*     subtype,                              */    EMIME_Encoding      mime_e; /*         and encoding for content-type     */    ESERV_Flags           flag; /* algorithm flag for the server             */    unsigned char reserved[14]; /* zeroed reserved area - do not use!        */    unsigned short      quorum; /* quorum required to override this entry    */    USERV_Info               u; /* server type-specific data/params          */} SSERV_Info;/* Constructors for the various types of NCBI server meta-addresses */extern NCBI_XCONNECT_EXPORT SSERV_Info* SERV_CreateNcbidInfo(unsigned int   host,           /* network byte order                        */ unsigned short port,           /* host byte order                           */ const char*    args );extern NCBI_XCONNECT_EXPORT SSERV_Info* SERV_CreateStandaloneInfo(unsigned int   host,           /* network byte order                        */ unsigned short port            /* host byte order                           */ );extern NCBI_XCONNECT_EXPORT SSERV_Info* SERV_CreateHttpInfo(ESERV_Type     type,           /* verified, must be one of fSERV_Http*      */ unsigned int   host,           /* network byte order                        */ unsigned short port,           /* host byte order                           */ const char*    path, const char*    args );extern NCBI_XCONNECT_EXPORT SSERV_Info* SERV_CreateFirewallInfo(unsigned int   host,           /* original server's host in net byte order  */ unsigned short port,           /* original server's port in host byte order */ ESERV_Type     type            /* type of original server, wrapped into     */ );extern NCBI_XCONNECT_EXPORT SSERV_Info* SERV_CreateDnsInfo(unsigned int   host            /* the only parameter                        */ );/* Dump server info to a string. * The server type goes first, and it is followed by a single space. * The returned string is '\0'-terminated, and must be deallocated by 'free()'. */extern NCBI_XCONNECT_EXPORT char* SERV_WriteInfo(const SSERV_Info* info );/* Server specification consists of the following: * TYPE [host][:port] [server-specific_parameters] [tags] * * TYPE := { STANDALONE | NCBID | HTTP{|_GET|_POST} | FIREWALL | DNS } * * Host should be specified as either an IP address (in dotted notation), * or as a host name (using domain notation if necessary). * Port number must be preceded by a colon. * Both host and port get their default values if not specified. * * Server-specific parameters: * *    Standalone servers: None *                        Servers of this type do not take any arguments. * *    NCBID servers: Arguments to CGI in addition to specified by application. *                   Empty additional arguments denoted as '' (double quotes). *                   Note that arguments must not contain space characters. * *    HTTP* servers: Path (required) and args (optional) in the form *                   path[?args] (here brackets denote the optional part). *                   Note that no spaces allowed within this parameter. * *    FIREWALL servers: Servers of this type are converted real servers of *                      the above types, when only accessible via FIREWALL *                      mode of NCBI dispatcher. The purpose of this fake *                      server type is just to let the client know that *                      the service exists. Additional parameter the original *                      type of the server before conversion. Note that servers *                      of type FIREWALL cannot be configured in LBSMD. * *    DNS servers: Experimental (as of now) services for load-balancing *                 DNS mapping at the NCBI Web entry point. *                 Never exported to the outside world. * * Tags may follow in no particular order but no more than one instance * of each flag is allowed: * *    Load average calculation for the server: *       Regular        (default) *       Blast * *    Bonus coefficient: *       B=double       [0.0 = default] *           specifies a multiplicative bonus given to a server run locally, *           when calculating reachability rate. *           Special rules apply to negative/zero values: *           0.0 means not to use the described rate increase at all (default *           rate calculation is used, which only slightly increases rates *           of locally run servers). *           Negative value denotes that locally run server should *           be taken in first place, regardless of its rate, if that rate

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -