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_cm_h_ 1
13 /*------------------------------------------------------------------------
16 * Interface to the AFS Cache Manager extended statistics facility. With
17 * the routines defined here, the importer can gather extended statistics
18 * from the given group of Cache Managers at regular intervals, or force
19 * immediate collection.
21 *------------------------------------------------------------------------*/
23 #include <sys/types.h> /*Basic system types */
25 #include <netinet/in.h> /*Internet definitions */
30 #include <netdb.h> /*Network database library */
35 #include <sys/socket.h> /*Socket definitions */
38 #include <rx/rx.h> /*Rx definitions */
39 #include <afs/afscbint.h> /*AFS CM callback interface */
40 #define FSINT_COMMON_XG /* to allow the inclusion of
41 * xstat_cm.h with this file in an application. */
42 #include <afs/afs_stats.h> /*AFS statistics interface */
45 * ---------------------- Exported definitions ------------------------
48 * Define the initialization flags used within the xstat_fs_Init() call.
49 * XSTAT_CM_INITFLAG_DEBUGGING Turn debugging output on?
50 * XSTAT_CM_INITFLAG_ONE_SHOT Do a one-shot collection?
52 #define XSTAT_CM_INITFLAG_DEBUGGING 0x1
53 #define XSTAT_CM_INITFLAG_ONE_SHOT 0x2
57 * ----------------------- Exported structures ------------------------
60 * Connection information per Cache Manager host being probed.
62 struct xstat_cm_ConnectionInfo {
63 struct sockaddr_in skt; /*Socket info */
64 struct rx_connection *rxconn; /*Rx connection */
65 char hostName[256]; /*Computed hostname */
69 * The results of a probe of one of the Cache Managers in the set being
72 struct xstat_cm_ProbeResults {
73 int probeNum; /*Probe number */
74 afs_int32 probeTime; /*Time probe initiated */
75 struct xstat_cm_ConnectionInfo *connP; /*Connection polled */
76 afs_int32 collectionNumber; /*Collection received */
77 AFSCB_CollData data; /*Ptr to data collected */
78 int probeOK; /*Latest probe successful? */
82 * ------------------- Externally-visible variables -------------------
84 extern int xstat_cm_numServers; /*# connected servers */
85 extern struct xstat_cm_ConnectionInfo
86 *xstat_cm_ConnInfo; /*Ptr to connections */
87 extern int numCollections; /*Num data collections */
88 extern struct xstat_cm_ProbeResults
89 xstat_cm_Results; /*Latest probe results */
90 extern char terminationEvent; /*One-shot termination event */
93 * ------------------------ Exported functions ------------------------
95 extern int xstat_cm_Init();
98 * Initialize the xstat_cm module: set up Rx connections to the
99 * given set of Cache Managers, start up the probe LWP, and
100 * associate the routine to be called when a probe completes.
101 * Also, let it know which collections you're interested in.
104 * int a_numServers : Num. servers to connect.
105 * struct sockaddr_in *a_socketArray : Array of server sockets.
106 * int a_ProbeFreqInSecs : Probe frequency in seconds.
107 * int (*a_ProbeHandler)() : Ptr to probe handler fcn.
108 * int a_flags : Various flags.
109 * int a_numCollections : Number of collections desired.
110 * afs_int32 *a_collIDP : Ptr to collection IDs.
114 * Error value otherwise.
117 extern int xstat_cm_ForceProbeNow();
120 * Force an immediate probe to the connected Cache Managers.
127 * Error value otherwise.
130 extern int xstat_cm_Cleanup();
133 * Clean up our memory and connection state.
136 * int a_releaseMem : Should we free up malloc'ed areas?
139 * 0 on total success,
140 * -1 if the module was never initialized, or there was a problem
141 * with the xstat_cm connection array.
144 #endif /* _xstat_cm_h_ */