~ubuntu-branches/ubuntu/natty/ncbi-tools6/natty

« back to all changes in this revision

Viewing changes to connect/lbapi/lbapi.h

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2002-04-04 22:13:09 UTC
  • Revision ID: james.westby@ubuntu.com-20020404221309-vfze028rfnlrldct
Tags: upstream-6.1.20011220a
ImportĀ upstreamĀ versionĀ 6.1.20011220a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <ncbilcl.h>
 
2
 
 
3
#if defined(LB_DIRECT) && !defined(OS_UNIX_SOL) && !defined(OS_UNIX_IRIX) && !defined(OS_UNIX_LINUX)
 
4
#undef LB_DIRECT
 
5
#endif
 
6
 
 
7
#ifndef LB_DIRECT
 
8
#define LBAPI__H
 
9
#endif
 
10
 
 
11
#ifndef LBAPI__H
 
12
#define LBAPI__H
 
13
 
 
14
/* $Id: lbapi.h,v 1.10 2001/06/07 21:09:33 beloslyu Exp $
 
15
* ===========================================================================
 
16
*
 
17
*                            PUBLIC DOMAIN NOTICE
 
18
*               National Center for Biotechnology Information
 
19
*
 
20
*  This software/database is a "United States Government Work" under the
 
21
*  terms of the United States Copyright Act.  It was written as part of
 
22
*  the author's official duties as a United States Government employee and
 
23
*  thus cannot be copyrighted.  This software/database is freely available
 
24
*  to the public for use. The National Library of Medicine and the U.S.
 
25
*  Government have not placed any restriction on its use or reproduction.
 
26
*
 
27
*  Although all reasonable efforts have been taken to ensure the accuracy
 
28
*  and reliability of the software and data, the NLM and the U.S.
 
29
*  Government do not and cannot warrant the performance or results that
 
30
*  may be obtained by using this software or data. The NLM and the U.S.
 
31
*  Government disclaim all warranties, express or implied, including
 
32
*  warranties of performance, merchantability or fitness for any particular
 
33
*  purpose.
 
34
*
 
35
*  Please cite the author in any work or product based on this material.
 
36
*
 
37
* ===========================================================================
 
38
*
 
39
* File Name:  $RCSfile: lbapi.h,v $
 
40
*
 
41
* Author:  Sergei Shavirin
 
42
*
 
43
* Initial Version Creation Date: 03/24/1997
 
44
*
 
45
* $Revision: 1.10 $
 
46
*
 
47
* File Description:
 
48
*        Definitions for the load-balancing API.
 
49
*
 
50
* $Log: lbapi.h,v $
 
51
* Revision 1.10  2001/06/07 21:09:33  beloslyu
 
52
* we really need this for linux
 
53
*
 
54
* Revision 1.9  1999/01/22 22:02:38  vakatov
 
55
* Added important NOTE for LBGetIPAddress()
 
56
*
 
57
* Revision 1.8  1998/05/08 15:26:58  vakatov
 
58
* [LB_DIRECT]  now can skip IP addresses(for the dispatcher hosts) which
 
59
* were already offered by the load-balancing daemon but failed by some reason
 
60
*
 
61
* Revision 1.7  1998/04/30 19:57:22  vakatov
 
62
* included <ncbilcl.h> to get #OS_UNIX_SOL and #OS_UNIX_IRIX
 
63
*
 
64
* Revision 1.6  1998/04/30 16:27:14  vakatov
 
65
* [IRIX] fixed a typo that(erroneously) did not allow LB_DIRECT on IRIX
 
66
*
 
67
* Revision 1.5  1998/04/07 14:40:32  vakatov
 
68
* added missing #endif
 
69
*
 
70
* Revision 1.4  1998/04/07 14:17:28  vakatov
 
71
* Skip all code(#ifdef'd) if LB_DIRECT is not defined or if compiled on
 
72
* any platform but Solaris and IRIX
 
73
*
 
74
* Revision 1.3  1998/04/03 21:16:48  vakatov
 
75
* Cleaned up the code and prepared "lbapi.[ch]" to be moved to "netcli" lib
 
76
*
 
77
* Revision 1.2  1998/04/02 17:36:06  yaschenk
 
78
* Adding dispd-ncbid shortcut when they are on the same server, adding preference to same server in stateless mode
 
79
*
 
80
* Revision 1.1  1998/03/06 18:55:01  shavirin
 
81
* Initial revision
 
82
* ==========================================================================
 
83
*/
 
84
 
 
85
#ifdef __cplusplus
 
86
extern "C" {
 
87
#endif
 
88
 
 
89
#define MAX_NUM_HOSTS       100
 
90
#define NUM_LOAD_PARAMETERS 4
 
91
#define MAX_NUM_SERVICES    16
 
92
#define MAX_SERVICE_LEN     32
 
93
#define LB_SHARED_KEY       34523
 
94
#define LB_SEMA_KEY         8766564
 
95
 
 
96
typedef struct LB_Message {
 
97
    unsigned int address; /* actually, char[4], but for UNIXes... it is okay */
 
98
    int load[NUM_LOAD_PARAMETERS];
 
99
    char service[MAX_NUM_SERVICES][MAX_SERVICE_LEN];
 
100
} LB_Message, *LB_MessagePtr;
 
101
 
 
102
extern int LBPrintTable(void);
 
103
 
 
104
/* Using the info from the local load-balancing daemon,
 
105
 * get IP address of the host where the specified "service" is running.
 
106
 * Return "preferred_ip" if the specified "service" is available on the
 
107
 * host with IP address = "preferred_ip".
 
108
 * Do not consider first "n_skip" hosts enlisted in the "skip_ip" array.
 
109
 * On any error, return zero.
 
110
 * NOTE:  all IP addresses here are in the network byte order
 
111
 */
 
112
extern unsigned LBGetIPAddress
 
113
(const char* service,
 
114
 unsigned    preferred_ip,
 
115
 unsigned*   skip_ip,
 
116
 size_t      n_skip
 
117
 );
 
118
 
 
119
#ifdef __cplusplus
 
120
}
 
121
#endif
 
122
 
 
123
#endif /* LBAPI__H */