xstat-printf-ptr-format-20090320
[openafs.git] / src / xstat / xstat_fs_callback.c
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 /*
11  * Description:
12  *      Implementation of the xstat_fs callback routines.  These are the
13  *      server-side functions that the File Server expects to invoke on
14  *      the client machine via the afsint interface.  In this case, the
15  *      client process is acting as a callback listener, so it has to
16  *      be prepared to answer these calls.
17  *
18  * Environment:
19  *      The afsint server stubs expect the functions defined here to
20  *      be provided.  There is no .h file for this code, since the
21  *      linker really does all the work for us, and these don't really
22  *      need to be ``visible'' to anyone else.
23  *------------------------------------------------------------------------*/
24
25 #include <afsconfig.h>
26 #include <afs/param.h>
27 #ifdef AFS_NT40_ENV
28 #include <windows.h>
29 #include <rpc.h>
30 #endif
31
32 RCSID
33     ("$Header$");
34
35 #include <errno.h>
36 #include <stdio.h>              /*Standard I/O stuff */
37 #include <string.h>
38
39 #include <afs/afscbint.h>       /*Callback interface defs */
40
41 int afs_cb_inited = 0;
42 struct interfaceAddr afs_cb_interface;
43
44 #define XSTAT_FS_CALLBACK_VERBOSE 0
45
46 /*
47  * Initialize the callback interface structure
48  */
49 static int
50 init_afs_cb()
51 {
52     int count;
53
54 #ifdef AFS_NT40_ENV
55     UuidCreate((UUID *)&afs_cb_interface.uuid);
56 #else
57     afs_uuid_create(&afs_cb_interface.uuid);
58 #endif
59     count = rx_getAllAddr(&afs_cb_interface.addr_in, AFS_MAX_INTERFACE_ADDR);
60     if (count <= 0)
61         afs_cb_interface.numberOfInterfaces = 0;
62     else
63         afs_cb_interface.numberOfInterfaces = count;
64     afs_cb_inited = 1;
65     return 0;
66 }
67
68 /*
69  * Routines we need that don't have explicit include file definitions.
70  */
71 extern char *hostutil_GetNameByINet();  /*Host parsing utility */
72
73 static char mn[] = "xstat_fs_callback"; /*Module name */
74
75 /*------------------------------------------------------------------------
76  * SRXAFSCB_CallBack
77  *
78  * Description:
79  *      Handle a set of callbacks from the File Server.
80  *
81  * Arguments:
82  *      struct rx_call *rxcall  : Ptr to the associated Rx call structure.
83  *      AFSCBFids *Fids_Array   : Ptr to the set of Fids.
84  *      AFSCBs *CallBacks_Array : Ptr to the set of callbacks.
85  *
86  * Returns:
87  *      0 on success,
88  *      Error value otherwise.
89  *
90  * Environment:
91  *      Nothing interesting.
92  *
93  * Side Effects:
94  *      As advertised.
95  *------------------------------------------------------------------------*/
96
97 afs_int32
98 SRXAFSCB_CallBack(struct rx_call *rxcall, AFSCBFids * Fids_Array,
99                   AFSCBs * CallBack_Array)
100 {                               /*SRXAFSCB_CallBack */
101
102 #if XSTAT_FS_CALLBACK_VERBOSE
103     static char rn[] = "SRXAFSCB_CallBack";     /*Routine name */
104     char hostName[256];         /*Host name buffer */
105     char *hostNameResult;       /*Ptr to static */
106
107     fprintf(stderr, "[%s:%s] Called\n", mn, rn);
108
109     if (rxcall != (struct rx_call *)0) {
110         hostNameResult =
111             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
112         strcpy(hostName, hostNameResult);
113         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
114                 hostName, rxcall->conn->peer->port);
115     }                           /*Valid rxcall param */
116 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
117
118     /*
119      * Return successfully.
120      */
121     return (0);
122
123 }                               /*SRXAFSCB_CallBack */
124
125 /*------------------------------------------------------------------------
126  * SRXAFSCB_InitCallBackState
127  *
128  * Description:
129  *      Initialize callback state on this ``Cache Manager''.
130  *
131  * Arguments:
132  *      struct rx_call *rxcall  : Ptr to the associated Rx call structure.
133  *
134  * Returns:
135  *      0 on success,
136  *      Error value otherwise.
137  *
138  * Environment:
139  *      This will definitely be called by the File Server (exactly once),
140  *      since it will think we are another new ``Cache Manager''.
141  *
142  * Side Effects:
143  *      As advertised.
144  *------------------------------------------------------------------------*/
145
146 afs_int32
147 SRXAFSCB_InitCallBackState(struct rx_call * rxcall)
148 {                               /*SRXAFSCB_InitCallBackState */
149
150 #if XSTAT_FS_CALLBACK_VERBOSE
151     static char rn[] = "SRXAFSCB_InitCallBackState";    /*Routine name */
152     char hostName[256];         /*Host name buffer */
153     char *hostNameResult;       /*Ptr to static */
154
155     fprintf(stderr, "[%s:%s] Called\n", mn, rn);
156
157     if (rxcall != (struct rx_call *)0) {
158         hostNameResult =
159             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
160         strcpy(hostName, hostNameResult);
161         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
162                 hostName, rxcall->conn->peer->port);
163     }                           /*Valid rxcall param */
164 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
165
166     /*
167      * Return successfully.
168      */
169     return (0);
170
171 }                               /*SRXAFSCB_InitCallBackState */
172
173 /*------------------------------------------------------------------------
174  * SRXAFSCB_Probe
175  *
176  * Description:
177  *      Respond to a probe from the File Server.  If a File Server
178  *      doesn't hear from you every so often, it will send you a probe
179  *      to make sure you're there, just like any other ``Cache Manager''
180  *      it's keeping track of.
181  *
182  * Arguments:
183  *      struct rx_call *rxcall  : Ptr to the associated Rx call structure.
184  *
185  * Returns:
186  *      0 on success,
187  *      Error value otherwise.
188  *
189  * Environment:
190  *      This may be called by the File Server if we don't call it often
191  *      enough.
192  *
193  * Side Effects:
194  *      As advertised.
195  *------------------------------------------------------------------------*/
196
197 afs_int32
198 SRXAFSCB_Probe(struct rx_call * rxcall)
199 {                               /*SRXAFSCB_Probe */
200
201 #if XSTAT_FS_CALLBACK_VERBOSE
202     static char rn[] = "SRXAFSCB_Probe";        /*Routine name */
203     char hostName[256];         /*Host name buffer */
204     char *hostNameResult;       /*Ptr to static */
205
206     fprintf(stderr, "[%s:%s] Called\n", mn, rn);
207
208     if (rxcall != (struct rx_call *)0) {
209         hostNameResult =
210             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
211         strcpy(hostName, hostNameResult);
212         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
213                 hostName, rxcall->conn->peer->port);
214     }                           /*Valid rxcall param */
215 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
216
217     /*
218      * Return successfully.
219      */
220     return (0);
221
222 }                               /*SRXAFSCB_Probe */
223
224
225 /*------------------------------------------------------------------------
226  * SRXAFSCB_GetCE64
227  *
228  * Description:
229  *      Respond minimally to a request for returning the contents of
230  *      a cache entry, since someone out there thinks you're a Cache
231  *      Manager.
232  *
233  * Arguments:
234  *      struct rx_call *rxcall: Ptr to the associated Rx call structure.
235  *
236  * Returns:
237  *      0 (always)
238  *
239  * Environment:
240  *      Nothing interesting.
241  *
242  * Side Effects:
243  *      As advertised.
244  *------------------------------------------------------------------------*/
245
246 afs_int32
247 SRXAFSCB_GetCE64(struct rx_call * rxcall, afs_int32 index,
248                  AFSDBCacheEntry64 * ce)
249 {                               /*SRXAFSCB_GetCE64 */
250
251 #if XSTAT_FS_CALLBACK_VERBOSE
252     static char rn[] = "SRXAFSCB_GetCE64";      /*Routine name */
253     char hostName[256];         /*Host name buffer */
254     char *hostNameResult;       /*Ptr to static */
255
256     if (rxcall != (struct rx_call *)0) {
257         hostNameResult =
258             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
259         strcpy(hostName, hostNameResult);
260         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
261                 hostName, rxcall->conn->peer->port);
262     }                           /*Valid rxcall param */
263 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
264
265     return (0);
266
267 }                               /*SRXAFSCB_GetCE64 */
268
269 afs_int32
270 SRXAFSCB_GetCE(struct rx_call * rxcall, afs_int32 index, AFSDBCacheEntry * ce)
271 {                               /*SRXAFSCB_GetCE */
272
273 #if XSTAT_FS_CALLBACK_VERBOSE
274     static char rn[] = "SRXAFSCB_GetCE";        /*Routine name */
275     char hostName[256];         /*Host name buffer */
276     char *hostNameResult;       /*Ptr to static */
277
278     if (rxcall != (struct rx_call *)0) {
279         hostNameResult =
280             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
281         strcpy(hostName, hostNameResult);
282         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
283                 hostName, rxcall->conn->peer->port);
284     }                           /*Valid rxcall param */
285 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
286
287     return (0);
288
289 }                               /*SRXAFSCB_GetCE */
290
291
292 /*------------------------------------------------------------------------
293  * SRXAFSCB_GetLock
294  *
295  * Description:
296  *      Respond minimally to a request for returning the contents of
297  *      a cache lock, since someone out there thinks you're a Cache
298  *      Manager.
299  *
300  * Arguments:
301  *      struct rx_call *rxcall: Ptr to the associated Rx call structure.
302  *
303  * Returns:
304  *      0 (always)
305  *
306  * Environment:
307  *      Nothing interesting.
308  *
309  * Side Effects:
310  *      As advertised.
311  *------------------------------------------------------------------------*/
312
313 afs_int32
314 SRXAFSCB_GetLock(struct rx_call * rxcall, afs_int32 index, AFSDBLock * lock)
315 {                               /*SRXAFSCB_GetLock */
316
317 #if XSTAT_FS_CALLBACK_VERBOSE
318     static char rn[] = "SRXAFSCB_GetLock";      /*Routine name */
319     char hostName[256];         /*Host name buffer */
320     char *hostNameResult;       /*Ptr to static */
321
322     if (rxcall != (struct rx_call *)0) {
323         hostNameResult =
324             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
325         strcpy(hostName, hostNameResult);
326         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
327                 hostName, rxcall->conn->peer->port);
328     }                           /*Valid rxcall param */
329 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
330
331     return (0);
332
333 }                               /*SRXAFSCB_GetLock */
334
335
336 /*------------------------------------------------------------------------
337  * SRXAFSCB_XStatsVersion
338  *
339  * Description:
340  *      Respond minimally to a request for fetching the version of
341  *      extended Cache Manager statistics offered, since someone out
342  *      there thinks you're a Cache Manager.
343  *
344  * Arguments:
345  *      struct rx_call *rxcall: Ptr to the associated Rx call structure.
346  *
347  * Returns:
348  *      0 (always)
349  *
350  * Environment:
351  *      Nothing interesting.
352  *
353  * Side Effects:
354  *      As advertised.
355  *------------------------------------------------------------------------*/
356
357 afs_int32
358 SRXAFSCB_XStatsVersion(struct rx_call * rxcall, afs_int32 * versionNumberP)
359 {                               /*SRXAFSCB_XStatsVersion */
360
361 #if XSTAT_FS_CALLBACK_VERBOSE
362     static char rn[] = "SRXAFSCB_XStatsVersion";        /*Routine name */
363     char hostName[256];         /*Host name buffer */
364     char *hostNameResult;       /*Ptr to static */
365
366     if (rxcall != (struct rx_call *)0) {
367         hostNameResult =
368             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
369         strcpy(hostName, hostNameResult);
370         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
371                 hostName, rxcall->conn->peer->port);
372     }                           /*Valid rxcall param */
373 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
374
375     return (0);
376
377 }                               /*SRXAFSCB_XStatsVersion */
378
379
380 /*------------------------------------------------------------------------
381  * SRXAFSCB_GetXStats
382  *
383  * Description:
384  *      Respond minimally to a request for returning extended
385  *      statistics for a Cache Manager, since someone out there thinks
386  *      you're a Cache Manager.
387  *
388  * Arguments:
389  *      struct rx_call *rxcall: Ptr to the associated Rx call structure.
390  *
391  * Returns:
392  *      0 (always)
393  *
394  * Environment:
395  *      Nothing interesting.
396  *
397  * Side Effects:
398  *      As advertised.
399  *------------------------------------------------------------------------*/
400
401 afs_int32
402 SRXAFSCB_GetXStats(struct rx_call * rxcall, afs_int32 clientVersionNumber,
403                    afs_int32 collectionNumber, afs_int32 * srvVersionNumberP,
404                    afs_int32 * timeP, AFSCB_CollData * dataP)
405 {                               /*SRXAFSCB_GetXStats */
406
407 #if XSTAT_FS_CALLBACK_VERBOSE
408     static char rn[] = "SRXAFSCB_GetXStats";    /*Routine name */
409     char hostName[256];         /*Host name buffer */
410     char *hostNameResult;       /*Ptr to static */
411
412     if (rxcall != (struct rx_call *)0) {
413         hostNameResult =
414             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
415         strcpy(hostName, hostNameResult);
416         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
417                 hostName, rxcall->conn->peer->port);
418     }                           /*Valid rxcall param */
419 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
420
421     return (0);
422
423 }                               /*SRXAFSCB_GetXStats */
424
425 /*------------------------------------------------------------------------
426  * EXPORTED SRXAFSCB_InitCallBackState2
427  *
428  * Description:
429  *      This routine was used in the AFS 3.5 beta release, but not anymore.
430  *      It has since been replaced by SRXAFSCB_InitCallBackState3.
431  *
432  * Arguments:
433  *      rxcall : Ptr to Rx call on which this request came in.
434  *
435  * Returns:
436  *      RXGEN_OPCODE (always). 
437  *
438  * Environment:
439  *      Nothing interesting.
440  *
441  * Side Effects:
442  *      None
443  *------------------------------------------------------------------------*/
444
445 afs_int32
446 SRXAFSCB_InitCallBackState2(struct rx_call * rxcall,
447                             struct interfaceAddr * addr)
448 {
449
450 #if XSTAT_FS_CALLBACK_VERBOSE
451     static char rn[] = "SRXAFSCB_InitCallBackState2";   /*Routine name */
452     char hostName[256];         /*Host name buffer */
453     char *hostNameResult;       /*Ptr to static */
454
455     if (rxcall != (struct rx_call *)0) {
456         hostNameResult =
457             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
458         strcpy(hostName, hostNameResult);
459         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
460                 hostName, rxcall->conn->peer->port);
461     }                           /*Valid rxcall param */
462 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
463     return RXGEN_OPCODE;
464 }
465
466 /*------------------------------------------------------------------------
467  * EXPORTED SRXAFSCB_WhoAreYou
468  *
469  * Description:
470  *      Routine called by the server-side callback RPC interface to
471  *      obtain a unique identifier for the client. The server uses
472  *      this identifier to figure out whether or not two RX connections
473  *      are from the same client, and to find out which addresses go
474  *      with which clients.
475  *
476  * Arguments:
477  *      rxcall : Ptr to Rx call on which this request came in.
478  *      addr: Ptr to return the list of interfaces for this client.
479  *
480  * Returns:
481  *      0 (Always)
482  *
483  * Environment:
484  *      Nothing interesting.
485  *
486  * Side Effects:
487  *      As advertised.
488  *------------------------------------------------------------------------*/
489
490 afs_int32
491 SRXAFSCB_WhoAreYou(struct rx_call * rxcall, struct interfaceAddr * addr)
492 {
493     int code = 0;
494
495 #if XSTAT_FS_CALLBACK_VERBOSE
496     static char rn[] = "SRXAFSCB_WhoAreYou";    /*Routine name */
497     char hostName[256];         /*Host name buffer */
498     char *hostNameResult;       /*Ptr to static */
499
500     if (rxcall != (struct rx_call *)0) {
501         hostNameResult =
502             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
503         strcpy(hostName, hostNameResult);
504         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
505                 hostName, rxcall->conn->peer->port);
506     }                           /*Valid rxcall param */
507 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
508
509     if (rxcall && addr) {
510         if (!afs_cb_inited)
511             init_afs_cb();
512         *addr = afs_cb_interface;
513     }
514
515     /*
516      * Return successfully.
517      */
518     return (0);
519 }
520
521
522 /*------------------------------------------------------------------------
523  * EXPORTED SRXAFSCB_InitCallBackState3
524  *
525  * Description:
526  *      Routine called by the server-side callback RPC interface to
527  *      implement clearing all callbacks from this host.
528  *
529  * Arguments:
530  *      rxcall : Ptr to Rx call on which this request came in.
531  *
532  * Returns:
533  *      0 (always).
534  *
535  * Environment:
536  *      Nothing interesting.
537  *
538  * Side Effects:
539  *      As advertised.
540  *------------------------------------------------------------------------*/
541
542 afs_int32
543 SRXAFSCB_InitCallBackState3(struct rx_call * rxcall, afsUUID * uuidp)
544 {
545 #if XSTAT_FS_CALLBACK_VERBOSE
546     static char rn[] = "SRXAFSCB_InitCallBackState3";   /*Routine name */
547     char hostName[256];         /*Host name buffer */
548     char *hostNameResult;       /*Ptr to static */
549
550     if (rxcall != (struct rx_call *)0) {
551         hostNameResult =
552             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
553         strcpy(hostName, hostNameResult);
554         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
555                 hostName, rxcall->conn->peer->port);
556     }                           /*Valid rxcall param */
557 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
558
559     /*
560      * Return successfully.
561      */
562     return (0);
563 }
564
565
566 /*------------------------------------------------------------------------
567  * EXPORTED SRXAFSCB_ProbeUuid
568  *
569  * Description:
570  *      Routine called by the server-side callback RPC interface to
571  *      implement ``probing'' the Cache Manager, just making sure it's
572  *      still there is still the same client it used to be.
573  *
574  * Arguments:
575  *      rxcall : Ptr to Rx call on which this request came in.
576  *      uuidp : Ptr to UUID that must match the client's UUID.
577  *
578  * Returns:
579  *      0 if uuidp matches the UUID for this client
580  *      Non-zero otherwize
581  *
582  * Environment:
583  *      Nothing interesting.
584  *
585  * Side Effects:
586  *      As advertised.
587  *------------------------------------------------------------------------*/
588
589 afs_int32
590 SRXAFSCB_ProbeUuid(struct rx_call * rxcall, afsUUID * uuidp)
591 {
592     int code = 0;
593
594 #if XSTAT_FS_CALLBACK_VERBOSE
595     static char rn[] = "SRXAFSCB_ProbeUuid";    /*Routine name */
596     char hostName[256];         /*Host name buffer */
597     char *hostNameResult;       /*Ptr to static */
598
599     if (rxcall != (struct rx_call *)0) {
600         hostNameResult =
601             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
602         strcpy(hostName, hostNameResult);
603         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
604                 hostName, rxcall->conn->peer->port);
605     }                           /*Valid rxcall param */
606 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
607
608     if (!afs_cb_inited)
609         init_afs_cb();
610     if (!afs_uuid_equal(uuidp, &afs_cb_interface.uuid))
611         code = 1;               /* failure */
612     return code;
613 }
614
615 /*------------------------------------------------------------------------
616  * EXPORTED SRXAFSCB_GetServerPrefs
617  *
618  * Description:
619  *      Routine to list server preferences used by this client.
620  *
621  * Arguments:
622  *      a_call  : Ptr to Rx call on which this request came in.
623  *      a_index : Input server index
624  *      a_srvr_addr  : Output server address (0xffffffff on last server)
625  *      a_srvr_rank  : Output server rank
626  *
627  * Returns:
628  *      RXGEN_OPCODE   (always)
629  *
630  * Environment:
631  *      Nothing interesting.
632  *
633  * Side Effects:
634  *      As advertised.
635  *------------------------------------------------------------------------*/
636
637 afs_int32
638 SRXAFSCB_GetServerPrefs(struct rx_call * a_call, afs_int32 a_index,
639                         afs_int32 * a_srvr_addr, afs_int32 * a_srvr_rank)
640 {
641     return RXGEN_OPCODE;
642 }
643
644 /*------------------------------------------------------------------------
645  * EXPORTED SRXAFSCB_GetCellServDB
646  *
647  * Description:
648  *      Routine to list cells configured for this client
649  *
650  * Arguments:
651  *      a_call  : Ptr to Rx call on which this request came in.
652  *      a_index : Input cell index
653  *      a_name  : Output cell name ("" on last cell)
654  *      a_hosts : Output cell database servers
655  *
656  * Returns:
657  *      0 on success
658  *
659  * Environment:
660  *      Nothing interesting.
661  *
662  * Side Effects:
663  *      As advertised.
664  *------------------------------------------------------------------------*/
665
666 afs_int32
667 SRXAFSCB_GetCellServDB(struct rx_call * a_call, afs_int32 a_index,
668                        char **a_name, serverList * a_hosts)
669 {
670     return RXGEN_OPCODE;
671 }
672
673
674 afs_int32
675 SRXAFSCB_GetCellByNum(struct rx_call * a_call, afs_int32 a_cellnum,
676                       char **a_name, serverList * a_hosts)
677 {
678     return RXGEN_OPCODE;
679 }
680
681
682 /*------------------------------------------------------------------------
683  * EXPORTED SRXAFSCB_GetLocalCell
684  *
685  * Description:
686  *      Routine to return name of client's local cell
687  *
688  * Arguments:
689  *      a_call  : Ptr to Rx call on which this request came in.
690  *      a_name  : Output cell name
691  *
692  * Returns:
693  *      RXGEN_OPCODE   (always)
694  *
695  * Environment:
696  *      Nothing interesting.
697  *
698  * Side Effects:
699  *      As advertised.
700  *------------------------------------------------------------------------*/
701
702 afs_int32
703 SRXAFSCB_GetLocalCell(struct rx_call * a_call, char **a_name)
704 {
705     char *t_name;
706
707     t_name = (char *)malloc(AFSNAMEMAX);
708     if (!t_name)
709         return ENOMEM;
710     strcpy(t_name, "This is xstat_fs");
711     *a_name = t_name;
712     return 0;
713 }
714
715
716 /*------------------------------------------------------------------------
717  * EXPORTED SRXAFSCB_GetCacheConfig
718  *
719  * Description:
720  *      Routine to return parameters used to initialize client cache.
721  *      Client may request any format version. Server may not return
722  *      format version greater than version requested by client.
723  *
724  * Arguments:
725  *      a_call:        Ptr to Rx call on which this request came in.
726  *      callerVersion: Data format version desired by the client.
727  *      serverVersion: Data format version of output data.
728  *      configCount:   Number bytes allocated for output data.
729  *      config:        Client cache configuration.
730  *
731  * Returns:
732  *      RXGEN_OPCODE   (always)
733  *
734  * Environment:
735  *      Nothing interesting.
736  *
737  * Side Effects:
738  *      As advertised.
739  *------------------------------------------------------------------------*/
740
741 afs_int32
742 SRXAFSCB_GetCacheConfig(struct rx_call * a_call, afs_uint32 callerVersion,
743                         afs_uint32 * serverVersion, afs_uint32 * configCount,
744                         cacheConfig * config)
745 {
746     return RXGEN_OPCODE;
747 }
748
749 afs_int32
750 SRXAFSCB_TellMeAboutYourself(struct rx_call * rxcall,
751                              struct interfaceAddr * addr,
752                              Capabilities * capabilites)
753 {
754     int code = 0;
755
756 #if XSTAT_FS_CALLBACK_VERBOSE
757     static char rn[] = "SRXAFSCB_TellMeAboutYourself";  /*Routine name */
758     char hostName[256];         /*Host name buffer */
759     char *hostNameResult;       /*Ptr to static */
760
761     if (rxcall != (struct rx_call *)0) {
762         hostNameResult =
763             hostutil_GetNameByINet((afs_int32) (rxcall->conn->peer->host));
764         strcpy(hostName, hostNameResult);
765         fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", mn, rn,
766                 hostName, rxcall->conn->peer->port);
767     }                           /*Valid rxcall param */
768 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
769
770     if (rxcall && addr) {
771         if (!afs_cb_inited)
772             init_afs_cb();
773         *addr = afs_cb_interface;
774     }
775
776     /*
777      * Return successfully.
778      */
779     return (0);
780 }
781
782 int SRXAFSCB_GetDE(a_call, a_index, addr, inode, flags, time, fileName)
783      struct rx_call *a_call;
784      afs_int32 a_index;
785      afs_int32 addr;
786      afs_int32 inode;
787      afs_int32 flags;
788      afs_int32 time;
789      char ** fileName;
790 {
791     return RXGEN_OPCODE;
792 }