1 /* cdconfig.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 * RCS $Id: cdconfig.h,v 6.0 1997/08/25 18:12:48 madden Exp $
27 *
28 * Author:  Jonathan Epstein
29 *
30 * Version Creation Date: 11/24/92
31 *
32 * File Description:
33 	header for cdrom-library complex configuration mechanism
34 *
35 * Modifications:
36 * --------------------------------------------------------------------------
37 * Date     Name        Description of modification
38 * -------  ----------  -----------------------------------------------------
39 * 05-16-94 Schuler     Added RCS Log directive.  Comments will henceforth
40 *                      be inserted automatically into the source at the
41 *                      time it is checked into the system.
42 
43 $Log: cdconfig.h,v $
44 Revision 6.0  1997/08/25 18:12:48  madden
45 Revision changed to 6.0
46 
47 Revision 5.1  1997/06/26 21:55:27  vakatov
48 [PC] DLL'd "ncbicdr.lib", "ncbiacc.lib", "ncbinacc.lib" and "ncbicacc.lib"
49 
50 Revision 5.0  1996/05/28 13:55:34  ostell
51 Set to revision 5.0
52 
53  * Revision 4.0  1995/07/26  13:50:32  ostell
54  * force revision to 4.0
55  *
56  * Revision 1.7  1995/05/16  14:12:46  schuler
57  * Automatic comment insertion enabled
58  *
59 
60 
61 
62 *
63 * ==========================================================================
64 */
65 
66 #ifndef _CDCONFIG_
67 
68 #define _CDCONFIG_ 1
69 
70 #define ENTR_REF_CHAN        "ENTR_REF"
71 #define ENTR_SEQ_CHAN        "ENTR_SEQ"
72 #define ENTR_LINKS_CHAN      "ENTR_LINK"
73 
74 typedef Boolean (* ConfCtlProc) PROTO((VoidPtr parm));
75 
76 typedef struct Media {
77 	CharPtr media_alias; /* name in config file */
78 	Int2    media_type;  /* CD or NET or ... */
79 #define MEDIUM_UNKNOWN  0
80 #define MEDIUM_CD       1
81 #define MEDIUM_NETWORK  2
82 #define MEDIUM_DISK     4
83 	Boolean inited_partial; /* e.g., initialization which can be performed */
84 							/* without actually inserting the CD-ROM       */
85 	Boolean invalid;
86 	Boolean inited_total;
87 	Boolean in_use;
88 	Boolean is_live;     /* Is the device "live", e.g., a CD-ROM which is  */
89 	                     /* assumed to be currently inserted?              */
90 	CharPtr formal_name; /* Formal name to be used when talking to user */
91 	EntrezInfoPtr entrez_info;
92     ConfCtlProc swapOutMedia;
93     ConfCtlProc swapInMedia;
94     ConfCtlProc finiMedia;
95 	VoidPtr media_info;  /* media-specific information */
96 	struct Media PNTR next;
97 	struct Media PNTR next_lru; /* doubly-linked pointers in LRU chain */
98 	struct Media PNTR prev_lru;
99 	Boolean LRUineligible;      /* media ineligible for Least Recently Used */
100 } Media, PNTR MediaPtr;
101 
102 typedef struct DrasticActions {
103 	MediaPtr from_media;
104 	MediaPtr to_media;
105 	Boolean  is_drastic;
106 	struct DrasticActions PNTR next; /* next in linked list */
107 } DrasticActions, PNTR DrasticActionsPtr;
108 
109 typedef struct DataSourceDbKey {
110     CharPtr section;
111     CharPtr field1;
112     CharPtr field2;
113 } DataSourceDbKey;
114 
115 typedef struct DataSource {
116 	Int2            priority;
117 	Boolean         no_drastic_action;
118 	Boolean         already_searched; /* reset upon each call to SelectDataSource */
119 	MediaPtr        media;
120 	CharPtr         channel; /* name in config file */
121 	struct DataSource PNTR next;
122 } DataSource, PNTR DataSourcePtr;
123 
124 typedef struct DataSourceDb {
125 	DataSourceDbKey key;
126 	DataSourcePtr   list;
127 	struct DataSourceDb PNTR next;
128 } DataSourceDb, PNTR DataSourceDbPtr;
129 
130 
131 #undef NLM_EXTERN
132 #ifdef NLM_IMPORT
133 #define NLM_EXTERN NLM_IMPORT
134 #else
135 #define NLM_EXTERN extern
136 #endif
137 
138 #ifdef __cplusplus
139 extern "C" {
140 #endif
141 
142 NLM_EXTERN void    SetSoleMedia               PROTO((void));
143 NLM_EXTERN Boolean SelectDataSource           PROTO((CharPtr section,
144 											  CharPtr field1, CharPtr field2));
145 NLM_EXTERN Boolean SelectDataSourceByType     PROTO((DocType type,
146 											  CharPtr field1, CharPtr field2));
147 NLM_EXTERN Boolean SelectDataLinksByTypes     PROTO((DocType type,
148 											  DocType link_to_type));
149 NLM_EXTERN Boolean SelectNextDataSource       PROTO((void));
150 NLM_EXTERN void ConfigInit                    PROTO((void));
151 NLM_EXTERN void ConfigFini                    PROTO((void));
152 NLM_EXTERN MediaPtr GetCurMedia               PROTO((void));
153 NLM_EXTERN Int2     CurMediaType              PROTO((void));
154 NLM_EXTERN MediaPtr SetCurMedia               PROTO((MediaPtr NewMedia));
155 NLM_EXTERN MediaPtr PreInitMedia              PROTO((CharPtr buf));
156 NLM_EXTERN Boolean  CdIsInserted              PROTO((MediaPtr media));
157 NLM_EXTERN Int2     ParseMedia                PROTO((ConfCtlProc initfunc, Int2 media_mask));
158 NLM_EXTERN EntrezInfoPtr EntrezInfoMerge      PROTO((void));
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #undef NLM_EXTERN
165 #ifdef NLM_EXPORT
166 #define NLM_EXTERN NLM_EXPORT
167 #else
168 #define NLM_EXTERN
169 #endif
170 
171 #endif /* _CDCONFIG_ */
172