AIX: Fix undefined symbols
[openafs.git] / src / xstat / xstat_fs.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef _xstat_fs_h_
11 #define _xstat_fs_h_  1
12
13 /*------------------------------------------------------------------------
14  * xstat_fs.h
15  *
16  * Interface to the AFS File Server extended statistics facility.  With
17  * the routines defined here, the importer can gather extended statistics
18  * from the given group of File Servers at regular intervals, or force
19  * immediate collection.
20  *
21  *------------------------------------------------------------------------*/
22
23 #include <sys/types.h>          /*Basic system types */
24 #ifndef AFS_NT40_ENV
25 #ifndef IPPROTO_IP
26 #include <netinet/in.h>         /*Internet definitions */
27 #endif
28
29 #ifndef _netdb_h_
30 #define _netdb_h_
31 #include <netdb.h>              /*Network database library */
32 #endif
33
34 #ifndef _socket_h_
35 #define _socket_h_
36 #include <sys/socket.h>         /*Socket definitions */
37 #endif
38 #endif /* AFS_NT40_ENV */
39
40 #include <rx/rx.h>              /*Rx definitions */
41 #include <afs/afsint.h>         /*AFS FileServer interface */
42 #define FSINT_COMMON_XG         /* to allow the inclusion of
43                                  * xstat_cm.h with this file in an application. */
44 #include <afs/fs_stats.h>       /*AFS FileServer statistics interface */
45
46
47 /*
48  * ---------------------- Exported definitions ------------------------
49  */
50 /*
51  * Define the initialization flags used within the xstat_fs_Init() call.
52  *      XSTAT_FS_INITFLAG_DEBUGGING     Turn debugging output on?
53  *      XSTAT_FS_INITFLAG_ONE_SHOT      Do a one-shot collection?
54  */
55 #define XSTAT_FS_INITFLAG_DEBUGGING     0x1
56 #define XSTAT_FS_INITFLAG_ONE_SHOT      0x2
57
58
59 /*
60  * ----------------------- Exported structures ------------------------
61  */
62 /*
63  * Connection information per File Server host being probed.
64  */
65 struct xstat_fs_ConnectionInfo {
66     struct sockaddr_in skt;     /*Socket info */
67     struct rx_connection *rxconn;       /*Rx connection */
68     char hostName[256];         /*Computed hostname */
69 };
70
71 /*
72  * The results of a probe of one of the File Servers in the set being
73  * watched.
74  */
75 struct xstat_fs_ProbeResults {
76     int probeNum;               /*Probe number */
77     afs_int32 probeTime;        /*Time probe initiated */
78     struct xstat_fs_ConnectionInfo *connP;      /*Connection polled */
79     afs_int32 collectionNumber; /*Collection received */
80     AFS_CollData data;          /*Ptr to data collected */
81     int probeOK;                /*Latest probe successful? */
82 };
83
84 /*
85  * ------------------- Externally-visible variables -------------------
86  */
87 extern int xstat_fs_numServers; /*# connected servers */
88 extern struct xstat_fs_ConnectionInfo
89  *xstat_fs_ConnInfo;            /*Ptr to connections */
90 extern struct xstat_fs_ProbeResults
91   xstat_fs_Results;             /*Latest probe results */
92
93 /*
94  * ------------------------ Exported functions ------------------------
95  */
96 extern int xstat_fs_Init(int, struct sockaddr_in *, int, int (*)(void),
97                          int, int, afs_int32 *);
98     /*
99      * Summary:
100      *    Initialize the xstat_fs module: set up Rx connections to the
101      *    given set of File Servers, start up the probe and callback LWPs,
102      *    and associate the routine to be called when a probe completes.
103      *    Also, let it know which collections you're interested in.
104      *
105      * Args:
106      *    int a_numServers                  : Num. servers to connect.
107      *    struct sockaddr_in *a_socketArray : Array of server sockets.
108      *    int a_ProbeFreqInSecs             : Probe frequency in seconds.
109      *    int (*a_ProbeHandler)(void)       : Ptr to probe handler fcn.
110      *    int a_flags                       : Various flags.
111      *    int a_numCollections              : Number of collections desired.
112      *    afs_int32 *a_collIDP              : Ptr to collection IDs.
113      *
114      * Returns:
115      *    0 on success,
116      *    Error value otherwise.
117      */
118
119 extern int xstat_fs_ForceProbeNow(void);
120     /*
121      * Summary:
122      *    Force an immediate probe to the connected File Servers.
123      *
124      * Args:
125      *    None.
126      *
127      * Returns:
128      *    0 on success,
129      *    Error value otherwise.
130      */
131
132 extern int xstat_fs_Cleanup(int);
133     /*
134      * Summary:
135      *    Clean up our memory and connection state.
136      *
137      * Args:
138      *    int a_releaseMem : Should we free up malloc'ed areas?
139      *
140      * Returns:
141      *    0 on total success,
142      *    -1 if the module was never initialized, or there was a problem
143      *          with the xstat_fs connection array.
144      */
145
146 extern int xstat_fs_Wait(int sleep_secs);
147     /*
148      * Summary:
149      *    Wait for the collection to complete.
150      *
151      * Args:
152      *    int sleep_secs : time to wait in seconds when running
153      *                     in continuous mode. 0 means wait forever.
154      *
155      * Returns:
156      *    0 on success
157      */
158
159 /*
160  * Decode the full performance statistics collection data.
161  */
162 extern int xstat_fs_DecodeFullPerfStats(struct fs_stats_FullPerfStats **stats,
163                                         afs_int32 * ain, afs_int32 alen,
164                                         struct fs_stats_FullPerfStats
165                                         *buffer);
166
167 #endif /* _xstat_fs_h_ */