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