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