2 * Copyright 2000, International Business Machines Corporation and others.
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
11 #define _xstat_fs_h_ 1
13 /*------------------------------------------------------------------------
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.
21 *------------------------------------------------------------------------*/
23 #include <sys/types.h> /*Basic system types */
26 #include <netinet/in.h> /*Internet definitions */
31 #include <netdb.h> /*Network database library */
36 #include <sys/socket.h> /*Socket definitions */
38 #endif /* AFS_NT40_ENV */
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 */
48 * ---------------------- Exported definitions ------------------------
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?
55 #define XSTAT_FS_INITFLAG_DEBUGGING 0x1
56 #define XSTAT_FS_INITFLAG_ONE_SHOT 0x2
60 * ----------------------- Exported structures ------------------------
63 * Connection information per File Server host being probed.
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 */
72 * The results of a probe of one of the File Servers in the set being
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? */
85 * ------------------- Externally-visible variables -------------------
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 */
94 * ------------------------ Exported functions ------------------------
96 extern int xstat_fs_Init(int, struct sockaddr_in *, int, int (*)(void),
97 int, int, afs_int32 *);
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.
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.
116 * Error value otherwise.
119 extern int xstat_fs_ForceProbeNow(void);
122 * Force an immediate probe to the connected File Servers.
129 * Error value otherwise.
132 extern int xstat_fs_Cleanup(int);
135 * Clean up our memory and connection state.
138 * int a_releaseMem : Should we free up malloc'ed areas?
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.
146 extern int xstat_fs_Wait(int sleep_secs);
149 * Wait for the collection to complete.
152 * int sleep_secs : time to wait in seconds when running
153 * in continuous mode. 0 means wait forever.
160 * Decode the full performance statistics collection data.
162 extern int xstat_fs_DecodeFullPerfStats(struct fs_stats_FullPerfStats **stats,
163 afs_int32 * ain, afs_int32 alen,
164 struct fs_stats_FullPerfStats
167 #endif /* _xstat_fs_h_ */