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