~ubuntu-branches/ubuntu/maverick/ncbi-tools6/maverick

« back to all changes in this revision

Viewing changes to connect/ncbi_servicep.h

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2008-07-14 19:43:15 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080714194315-ed44u9ek7txva2rz
Tags: 6.1.20080302-3
tools/readdb.c: enable madvise()-based code on all glibc (hence all
Debian) systems, not just Linux.  (Closes: #490437.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef CONNECT___NCBI_SERVICEP__H
2
2
#define CONNECT___NCBI_SERVICEP__H
3
3
 
4
 
/*  $Id: ncbi_servicep.h,v 6.40 2006/06/07 20:06:02 lavr Exp $
 
4
/*  $Id: ncbi_servicep.h,v 6.43 2007/04/20 01:55:30 kazimird Exp $
5
5
 * ===========================================================================
6
6
 *
7
7
 *                            PUBLIC DOMAIN NOTICE
57
57
/* Iterator structure
58
58
 */
59
59
struct SSERV_IterTag {
60
 
    const char*       name;  /* requested service name, private storage      */
61
 
    TSERV_Type        type;  /* requested server type(s), specials stripped  */
62
 
    unsigned int      host;  /* preferred host to select, network b.o.       */
63
 
    unsigned short    port;  /* preferred port to select, host b.o.          */
64
 
    double            pref;  /* range [0..100] %%                            */
65
 
    size_t          n_skip;  /* actual number of servers in the array        */
66
 
    size_t          a_skip;  /* number of allocated slots in the array       */
67
 
    SSERV_Info**      skip;  /* servers to skip (w/names)                    */
68
 
    const SSERV_Info* last;  /* last server info taken out                   */
69
 
 
70
 
    const SSERV_VTable* op;  /* table of virtual functions                   */
71
 
 
72
 
    void*             data;  /* private data field                           */
73
 
    unsigned      ismask:1;  /* whether the name is to be treated as a mask  */
74
 
    unsigned promiscuous:1;  /* as taken from..                              */
75
 
    unsigned reverse_dns:1;  /*            ..types passed..                  */
76
 
    unsigned   stateless:1;  /*                        .. in SERV_*() calls  */
77
 
    unsigned    external:1;  /* whether this is an external request          */
78
 
    const char*        arg;  /* argument to match; original pointer          */
79
 
    size_t          arglen;  /* == 0 for NULL pointer above                  */
80
 
    const char*        val;  /* value to match; original pointer             */
81
 
    size_t          vallen;  /* == 0 for NULL pointer above                  */
82
 
    TNCBI_Time        time;  /* the time of call                             */
 
60
    const char*         name; /* requested service name, private storage     */
 
61
    TSERV_Type          type; /* requested server type(s), specials stripped */
 
62
    unsigned int        host; /* preferred host to select, network b.o.      */
 
63
    unsigned short      port; /* preferred port to select, host b.o.         */
 
64
    double              pref; /* range [0..100] %%                           */
 
65
    size_t            n_skip; /* actual number of servers in the array       */
 
66
    size_t            a_skip; /* number of allocated slots in the array      */
 
67
    SSERV_Info**        skip; /* servers to skip (w/names)                   */
 
68
    const SSERV_Info*   last; /* last server info taken out                  */
 
69
    const SSERV_VTable*   op; /* table of virtual functions                  */
 
70
 
 
71
    void*               data; /* private data field                          */
 
72
    unsigned        ismask:1; /* whether the name is to be treated as a mask */
 
73
    unsigned       ok_down:1; /* as taken..                                  */
 
74
    unsigned ok_suppressed:1; /*      ..from types..                         */
 
75
    unsigned   reverse_dns:1; /*               ..as passed into..            */
 
76
    unsigned     stateless:1; /*                            ..SERV_*() calls */
 
77
    unsigned      external:1; /* whether this is an external request         */
 
78
    const char*          arg; /* argument to match; original pointer         */
 
79
    size_t            arglen; /* == 0 for NULL pointer above                 */
 
80
    const char*          val; /* value to match; original pointer            */
 
81
    size_t            vallen; /* == 0 for NULL pointer above                 */
 
82
    TNCBI_Time          time; /* the time of call                            */
83
83
};
84
84
 
85
85
 
 
86
/* Control whether to skip using registry/environment when opening iterators,
 
87
 * and doing fast track lookups.  Default is eOff.
 
88
 */
 
89
extern NCBI_XCONNECT_EXPORT ESwitch SERV_DoFastOpens(ESwitch on);
 
90
 
 
91
 
86
92
/* Modified "fast track" routine for obtaining of a server info in one-shot.
87
93
 * Please see <connect/ncbi_service.h> for explanations [SERV_GetInfoEx()].
88
94
 *
105
111
 *       only -- servers, which are down, don't get returned).
106
112
 */
107
113
extern NCBI_XCONNECT_EXPORT SSERV_Info* SERV_GetInfoP
108
 
(const char*          service,       /* service name (may not be a mask)     */
 
114
(const char*          service,       /* service name (may not be a mask here)*/
109
115
 TSERV_Type           types,         /* mask of type(s) of servers requested */
110
116
 unsigned int         preferred_host,/* preferred host to use service on, nbo*/
111
117
 unsigned short       preferred_port,/* preferred port to use service on, hbo*/
124
130
 * service is that they _must_ be created having a name (perhaps, empty "")
125
131
 * attached, like if done by SERV_ReadInfoEx() or SERV_CopyInfoEx() */
126
132
extern NCBI_XCONNECT_EXPORT SERV_ITER SERV_OpenP
127
 
(const char*          service,       /* service name (can be a mask)         */
 
133
(const char*          service,       /* service name (here: can be a mask!)  */
128
134
 TSERV_Type           types,
129
135
 unsigned int         preferred_host,
130
136
 unsigned short       preferred_port,
196
202
}  /* extern "C" */
197
203
#endif
198
204
 
199
 
 
200
 
/*
201
 
 * --------------------------------------------------------------------------
202
 
 * $Log: ncbi_servicep.h,v $
203
 
 * Revision 6.40  2006/06/07 20:06:02  lavr
204
 
 * SERV_Print() to set referer (if absent) via its second argument
205
 
 *
206
 
 * Revision 6.39  2006/03/06 20:28:37  lavr
207
 
 * Comments
208
 
 *
209
 
 * Revision 6.38  2006/03/05 17:47:55  lavr
210
 
 * +SERV_ITER::time, new VT::Update proto, SERV_OpenP() to return HINFO
211
 
 *
212
 
 * Revision 6.37  2006/01/11 16:26:10  lavr
213
 
 * SERV_Update() and SERV_ITER's VT::Update() have got addt'l "code" argument
214
 
 *
215
 
 * Revision 6.36  2005/12/23 18:12:15  lavr
216
 
 * New bitfields in SERV_ITER (corresponding to special service flags)
217
 
 * SERV_OpenP() special requirements for "skip" entries documented
218
 
 *
219
 
 * Revision 6.35  2005/12/14 22:04:01  lavr
220
 
 * ESERV_SpecialType reinstated public
221
 
 *
222
 
 * Revision 6.34  2005/12/14 21:27:49  lavr
223
 
 * SERV_GetInfoP() and SERV_OpenP():  New signatures (changed parameteres)
224
 
 *
225
 
 * Revision 6.33  2005/07/11 18:49:11  lavr
226
 
 * Hashed preference generation algorithm retired (proven to fail often)
227
 
 *
228
 
 * Revision 6.32  2005/07/11 18:15:10  lavr
229
 
 * Revised to allow wildcard searches thru service iterator
230
 
 *
231
 
 * Revision 6.31  2005/05/04 16:14:57  lavr
232
 
 * -SERV_GetConfig()
233
 
 *
234
 
 * Revision 6.30  2005/05/02 16:04:52  lavr
235
 
 * Added export prefixes for most of internal API calls
236
 
 *
237
 
 * Revision 6.29  2005/04/25 18:47:29  lavr
238
 
 * Private API to accept SConnNetInfo* for network dispatching to work too
239
 
 *
240
 
 * Revision 6.28  2005/04/19 16:33:00  lavr
241
 
 * More comments on how things work (SERV_{GetInfo|Open}P)
242
 
 *
243
 
 * Revision 6.27  2005/03/05 21:05:07  lavr
244
 
 * +SERV_ITER::current;  +SERV_GetCurrentName()
245
 
 *
246
 
 * Revision 6.26  2005/01/31 17:09:34  lavr
247
 
 * Argument affinity moved into service iterator
248
 
 *
249
 
 * Revision 6.25  2004/08/19 15:48:04  lavr
250
 
 * SERV_ITER::type renamed into SERV_ITER::types to reflect its bitmask nature
251
 
 *
252
 
 * Revision 6.23  2003/06/26 15:19:56  lavr
253
 
 * Additional parameter "external" for SERV_{Open|GetInfo}P()
254
 
 *
255
 
 * Revision 6.22  2003/06/09 19:53:11  lavr
256
 
 * +SERV_OpenP()
257
 
 *
258
 
 * Revision 6.21  2003/03/07 22:21:55  lavr
259
 
 * Explain what is "preference" for SERV_GetInfoP()
260
 
 *
261
 
 * Revision 6.20  2003/02/28 14:49:09  lavr
262
 
 * SERV_Preference(): redeclare last argument 'unsigned'
263
 
 *
264
 
 * Revision 6.19  2003/02/13 21:37:28  lavr
265
 
 * Comment SERV_Preference(), change last argument
266
 
 *
267
 
 * Revision 6.18  2003/01/31 21:19:41  lavr
268
 
 * +SERV_Preference()
269
 
 *
270
 
 * Revision 6.17  2002/10/28 20:16:00  lavr
271
 
 * Take advantage of host info API
272
 
 *
273
 
 * Revision 6.16  2002/10/11 19:48:25  lavr
274
 
 * +SERV_GetConfig()
275
 
 * const dropped in return value of SERV_ServiceName()
276
 
 *
277
 
 * Revision 6.15  2002/09/19 18:08:43  lavr
278
 
 * Header file guard macro changed; log moved to end
279
 
 *
280
 
 * Revision 6.14  2002/05/06 19:17:04  lavr
281
 
 * +SERV_ServiceName() - translation of service name
282
 
 *
283
 
 * Revision 6.13  2001/09/28 20:50:41  lavr
284
 
 * Update VT method changed - now called on per-line basis
285
 
 *
286
 
 * Revision 6.12  2001/09/24 20:23:39  lavr
287
 
 * Reset() method added to VT
288
 
 *
289
 
 * Revision 6.11  2001/06/25 15:38:00  lavr
290
 
 * Heap of services is now not homogeneous, but can
291
 
 * contain entries of different types. As of now,
292
 
 * Service and Host entry types are introduced and defined
293
 
 *
294
 
 * Revision 6.10  2001/05/11 15:30:02  lavr
295
 
 * Correction in comment
296
 
 *
297
 
 * Revision 6.9  2001/04/26 14:18:45  lavr
298
 
 * SERV_MapperName moved to the private header
299
 
 *
300
 
 * Revision 6.8  2001/04/24 21:33:58  lavr
301
 
 * Added members of mapper V-table: penalize(method) and name(data).
302
 
 * Service iterator has got new field 'last' to keep the latest given info.
303
 
 *
304
 
 * Revision 6.7  2001/03/06 23:57:49  lavr
305
 
 * Minor beautifications
306
 
 *
307
 
 * Revision 6.6  2000/12/29 18:12:51  lavr
308
 
 * SERV_Print added to private interface
309
 
 *
310
 
 * Revision 6.5  2000/12/06 22:21:27  lavr
311
 
 * SERV_Print added to private interface
312
 
 *
313
 
 * Revision 6.4  2000/10/20 17:22:55  lavr
314
 
 * VTable changed to have 'Update' method
315
 
 * 'SERV_Update' added to private interface
316
 
 *
317
 
 * Revision 6.3  2000/10/05 21:37:51  lavr
318
 
 * Mapper-specific private data field added
319
 
 *
320
 
 * Revision 6.2  2000/05/22 16:53:12  lavr
321
 
 * Rename service_info -> server_info everywhere (including
322
 
 * file names) as the latter name is more relevant
323
 
 *
324
 
 * Revision 6.1  2000/05/12 18:38:16  lavr
325
 
 * First working revision
326
 
 *
327
 
 * ==========================================================================
328
 
 */
329
 
 
330
205
#endif /* CONNECT___NCBI_SERVICEP__H */