1 /*   netlib.h
2 * ===========================================================================
3 *
4 *                            PUBLIC DOMAIN NOTICE
5 *               National Center for Biotechnology Information
6 *
7 *  This software/database is a "United States Government Work" under the
8 *  terms of the United States Copyright Act.  It was written as part of
9 *  the author's official duties as a United States Government employee and
10 *  thus cannot be copyrighted.  This software/database is freely available
11 *  to the public for use. The National Library of Medicine and the U.S.
12 *  Government have not placed any restriction on its use or reproduction.
13 *
14 *  Although all reasonable efforts have been taken to ensure the accuracy
15 *  and reliability of the software and data, the NLM and the U.S.
16 *  Government do not and cannot warrant the performance or results that
17 *  may be obtained by using this software or data. The NLM and the U.S.
18 *  Government disclaim all warranties, express or implied, including
19 *  warranties of performance, merchantability or fitness for any particular
20 *  purpose.
21 *
22 *  Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * File Name:  netlib.h
27 *
28 * Author:  Epstein
29 *
30 * Version Creation Date:   06/05/92
31 *
32 * $Revision: 6.0 $
33 *
34 * File Description:
35 *   	header file for miscellaneous library for Network Entrez
36 *
37 * Modifications:
38 * --------------------------------------------------------------------------
39 * $Log: netlib.h,v $
40 * Revision 6.0  1997/08/25 18:35:03  madden
41 * Revision changed to 6.0
42 *
43 * Revision 5.2  1997/07/29 21:24:17  vakatov
44 * [WIN32,DLL]  DLL'zation of "netentr.lib"
45 *
46 * Revision 5.1  1997/06/05 15:51:42  epstein
47 * change name of NetInit function per Eric Hackborn's request
48 *
49 * Revision 5.0  1996/05/28 14:10:21  ostell
50 * Set to revision 5.0
51 *
52  * Revision 4.0  1995/07/26  13:54:59  ostell
53  * force revision to 4.0
54  *
55  * Revision 1.3  1995/05/17  17:53:22  epstein
56  * add RCS log revision history
57  *
58 */
59 
60 #ifndef _NETLIB_
61 #define _NETLIB_
62 
63 #ifndef _NCBI_Access_
64 #include <objacces.h>
65 #endif
66 
67 #ifndef _NETENTREZ_
68 #include <netentr.h>
69 #endif
70 #include <cdconfig.h>
71 
72 #undef NLM_EXTERN
73 #ifdef NLM_IMPORT
74 #define NLM_EXTERN NLM_IMPORT
75 #else
76 #define NLM_EXTERN extern
77 #endif
78 
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
83 /* --- Macros --- */
84 #define LOG_STAT(subsys,label,dat) { static NetStatPtr _p = NULL; LogNetStats(subsys, label, (Int4) (dat), &_p, 0); }
85 #define LOG_STAT_M(subsys,label,dat) { static NetStatPtr _p = NULL; LogNetStats(subsys, label, (Int4) (dat), &_p, STAT_MEAN); }
86 #define LOG_STAT_S(subsys,label,dat) { static NetStatPtr _p = NULL; LogNetStats(subsys, label, (Int4) (dat), &_p, STAT_MEAN | STAT_STDEV); }
87 
88 /* Subsystems for statistics management */
89 #define SUBSYS_SRV_ENTREZ    1
90 #define SUBSYS_SRV_ML        2
91 #define SUBSYS_SRV_SEQ       3
92 
93 #define SUBSYS_CLI_ENTREZ    4
94 #define SUBSYS_CLI_ML        5
95 #define SUBSYS_CLI_SEQ       6
96 
97 #define STAT_MEAN            1
98 #define STAT_STDEV           2
99 
100 typedef struct NetStat {
101     Int2 subsys;
102     CharPtr label;
103     double total;
104     double sum_of_squares;
105     Int4 n;
106     Int2 flags;
107 } NetStat, PNTR NetStatPtr;
108 
109 typedef void (* StatsCallBack) PROTO((CharPtr s));
110 
111 
112 /* --- Function Prototypes --- */
113 
114 Boolean CDECL NetInitialize PROTO((CharPtr,CharPtr,Int2Ptr));
115 NLM_EXTERN Boolean CDECL NetEInit		PROTO((void));
116 NLM_EXTERN Boolean CDECL NetFini       PROTO((void));
117 
118 NLM_EXTERN Boolean CDECL ForceNetInit PROTO((void));
119 
120 EntrezInfoPtr NetGetInfo PROTO((void));
121 
122 Int2 CDECL NetLinkUidGet PROTO((LinkSetPtr PNTR result, DocType type,
123 DocType link_to_type, Int2 numuid, DocUidPtr uids, Boolean mark_missing,
124 Int4 maxlink));
125 
126 NLM_EXTERN TermRespPtr CDECL TermRespNew PROTO((void));
127 NLM_EXTERN TermRespPtr CDECL TermRespFree PROTO((TermRespPtr p));
128 NLM_EXTERN TermRespPtr CDECL TermRespAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
129 
130 NLM_EXTERN ValNodePtr CDECL BoolExprAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
131 NLM_EXTERN Boolean CDECL BoolExprAsnWrite PROTO((ValNodePtr ufp, AsnIoPtr aip, AsnTypePtr atp));
132 NLM_EXTERN void CDECL LogNetStats PROTO((Int2 subsys, CharPtr label, Int4 dat, NetStatPtr PNTR statHandle, Int2 flags));
133 NLM_EXTERN void CDECL DumpNetStats PROTO((Int2 subsys, StatsCallBack callBack));
134 NLM_EXTERN void CDECL GetClientInfo PROTO((CharPtr buf));
135 
136 /* The following mechanism must be re-worked after the ASN.1 tools are    */
137 /* modified to allow multiple includes and loads of the same include file */
138 #if defined(OS_MAC) || defined(OS_DOS)  /* dynamic load */
139 #define NET_ENTR_DYNAMIC_LOAD 1
140 #endif
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #undef NLM_EXTERN
147 #ifdef NLM_EXPORT
148 #define NLM_EXTERN NLM_EXPORT
149 #else
150 #define NLM_EXTERN
151 #endif
152 
153 #endif
154