home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / nfs / amd / amd-5.2 / rpcx / amq_svc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-23  |  3.0 KB  |  109 lines

  1. /*
  2.  * $Id: amq_svc.c,v 5.2 90/06/23 22:20:17 jsp Rel $
  3.  *
  4.  * Copyright (c) 1990 Jan-Simon Pendry
  5.  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
  6.  * Copyright (c) 1990 The Regents of the University of California.
  7.  * All rights reserved.
  8.  *
  9.  * This code is derived from software contributed to Berkeley by
  10.  * Jan-Simon Pendry at Imperial College, London.
  11.  *
  12.  * Redistribution and use in source and binary forms are permitted provided
  13.  * that: (1) source distributions retain this entire copyright notice and
  14.  * comment, and (2) distributions including binaries display the following
  15.  * acknowledgement:  ``This product includes software developed by the
  16.  * University of California, Berkeley and its contributors'' in the
  17.  * documentation or other materials provided with the distribution and in
  18.  * all advertising materials mentioning features or use of this software.
  19.  * Neither the name of the University nor the names of its contributors may
  20.  * be used to endorse or promote products derived from this software without
  21.  * specific prior written permission.
  22.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  23.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  24.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  25.  *
  26.  *    %W% (Berkeley) %G%
  27.  */
  28.  
  29. #include "am.h"
  30. #include "amq.h"
  31. extern bool_t xdr_amq_mount_info_qelem();
  32.  
  33. void
  34. amq_program_1(rqstp, transp)
  35.     struct svc_req *rqstp;
  36.     SVCXPRT *transp;
  37. {
  38.     union {
  39.         amq_string amqproc_mnttree_1_arg;
  40.         amq_string amqproc_umnt_1_arg;
  41.         amq_setopt amqproc_setopt_1_arg;
  42.     } argument;
  43.     char *result;
  44.     bool_t (*xdr_argument)(), (*xdr_result)();
  45.     char *(*local)();
  46.  
  47.     switch (rqstp->rq_proc) {
  48.     case AMQPROC_NULL:
  49.         xdr_argument = xdr_void;
  50.         xdr_result = xdr_void;
  51.         local = (char *(*)()) amqproc_null_1;
  52.         break;
  53.  
  54.     case AMQPROC_MNTTREE:
  55.         xdr_argument = xdr_amq_string;
  56.         xdr_result = xdr_amq_mount_tree_p;
  57.         local = (char *(*)()) amqproc_mnttree_1;
  58.         break;
  59.  
  60.     case AMQPROC_UMNT:
  61.         xdr_argument = xdr_amq_string;
  62.         xdr_result = xdr_void;
  63.         local = (char *(*)()) amqproc_umnt_1;
  64.         break;
  65.  
  66.     case AMQPROC_STATS:
  67.         xdr_argument = xdr_void;
  68.         xdr_result = xdr_amq_mount_stats;
  69.         local = (char *(*)()) amqproc_stats_1;
  70.         break;
  71.  
  72.     case AMQPROC_EXPORT:
  73.         xdr_argument = xdr_void;
  74.         xdr_result = xdr_amq_mount_tree_list;
  75.         local = (char *(*)()) amqproc_export_1;
  76.         break;
  77.  
  78.     case AMQPROC_SETOPT:
  79.         xdr_argument = xdr_amq_setopt;
  80.         xdr_result = xdr_int;
  81.         local = (char *(*)()) amqproc_setopt_1;
  82.         break;
  83.  
  84.     case AMQPROC_GETMNTFS:
  85.         xdr_argument = xdr_void;
  86.         xdr_result = xdr_amq_mount_info_qelem;
  87.         local = (char *(*)()) amqproc_getmntfs_1;
  88.         break;
  89.  
  90.     default:
  91.         svcerr_noproc(transp);
  92.         return;
  93.     }
  94.     bzero((char *)&argument, sizeof(argument));
  95.     if (!svc_getargs(transp, xdr_argument, &argument)) {
  96.         svcerr_decode(transp);
  97.         return;
  98.     }
  99.     result = (*local)(&argument, rqstp);
  100.     if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
  101.         svcerr_systemerr(transp);
  102.     }
  103.     if (!svc_freeargs(transp, xdr_argument, &argument)) {
  104.         plog(XLOG_FATAL, "unable to free rpc arguments in amqprog_1");
  105.         going_down(1);
  106.     }
  107. }
  108.  
  109.