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 int numCollections
; /*Num data collections */
91 extern struct xstat_fs_ProbeResults
92 xstat_fs_Results
; /*Latest probe results */
93 extern char terminationEvent
; /*One-shot termination event */
96 * ------------------------ Exported functions ------------------------
98 extern int xstat_fs_Init(int, struct sockaddr_in
*, int, int (*)(void),
99 int, int, afs_int32
*);
102 * Initialize the xstat_fs module: set up Rx connections to the
103 * given set of File Servers, start up the probe and callback LWPs,
104 * and associate the routine to be called when a probe completes.
105 * Also, let it know which collections you're interested in.
108 * int a_numServers : Num. servers to connect.
109 * struct sockaddr_in *a_socketArray : Array of server sockets.
110 * int a_ProbeFreqInSecs : Probe frequency in seconds.
111 * int (*a_ProbeHandler)(void) : Ptr to probe handler fcn.
112 * int a_flags : Various flags.
113 * int a_numCollections : Number of collections desired.
114 * afs_int32 *a_collIDP : Ptr to collection IDs.
118 * Error value otherwise.
121 extern int xstat_fs_ForceProbeNow(void);
124 * Force an immediate probe to the connected File Servers.
131 * Error value otherwise.
134 extern int xstat_fs_Cleanup(int);
137 * Clean up our memory and connection state.
140 * int a_releaseMem : Should we free up malloc'ed areas?
143 * 0 on total success,
144 * -1 if the module was never initialized, or there was a problem
145 * with the xstat_fs connection array.
149 * Decode the full performance statistics collection data.
151 extern int xstat_fs_DecodeFullPerfStats(struct fs_stats_FullPerfStats
**stats
,
152 afs_int32
* ain
, afs_int32 alen
,
153 struct fs_stats_FullPerfStats
156 #endif /* _xstat_fs_h_ */