This is the code that implements the NULL procedure and calls the server side implementation routines for queued procedures.
Please note that some implementations of rpcgen omit the "_svc" suffix on the names of the server side procedures. To accommodate these, you must specify the AutoGen command line option, "-DXDR_NO_SVC_SUFFIX" or set the XDR_NO_SVC_SUFFIX environment variable before generating the output. Also please note that in such an environment there is a naming conflict between the client side stubs and the server side implementation routines. It may be necessary to hand edit these modules to be able to link them into a single executable for debugging.
The following example is from NFSv4 with all but one queued call removed:
/* * DO NOT EDIT THIS FILE (nfsv4-server.c) * * It has been AutoGen-ed Saturday May 26, 2001 at 04:36:08 PM PDT * From the definitions nfsv4.def * and the template file autoxdr.tpl * * This file has been generated by the AutoXDR AutoGen template suite. * * These files are compatible with: * RFC1831 - Remote Procedure Call Protocol Specification Version 2 * RFC1832 - External Data Representation Standard * and are intended to be used as a layer on top of the ONC IDL * in conjunction with RPCGEN. * */ #include <stdio.h> #include <errno.h> #include "nfsv4-svhdr.h" #include "nfsv4.h" /* * NULL Server Routine */ void* nfs4_null_4_svc( void* arg, struct svc_req *rqstp ) { static char z; return (void*)&z; } /* * COMPOUND Server Dispatch Routine */ nfs4_compound_res* nfs4_compound_4_svc( nfs4_compound_args* args, struct svc_req *rqstp ) { static nfs4_compound_res res; nfs4_status stat = NFS4_STATUS_OK; if (res.resarray.resarray_len != 0) xdr_free( (xdrproc_t)xdr_nfs4_compound_res, (void*)&res ); memset( (void*)&res, 0, sizeof( res )); { u_nfs4_compound_args* p_op = args->argarray.argarray_val; int ct = args->argarray.argarray_len / sizeof( *p_op ); int idx = 0; u_nfs4_compound_res* p_res = (u_nfs4_compound_res*)malloc( ct * sizeof( *p_res )); if (p_res == NULL) return (nfs4_compound_res*)NULL; res.resarray.resarray_val = p_res; while (--ct >= 0) { p_res[idx].resop = p_op->argop; switch (p_op->argop) { case NFS4_ACCESS4: stat = nfs4_access4_svc( args, &(p_res[idx].u_nfs4_compound_res_u.op_access4), &(p_op->u_nfs4_compound_args_u.op_access4) ); break; default: stat = EINVAL; } /* * The status field is always defined to be in the same place for * all the commands: the start of the reply structure */ *(nfs4_status*)(void*)(p_res + idx) = stat; if (stat != NFS4_STATUS_OK) break; idx++; p_op++; } res.resarray.resarray_len = idx * sizeof( *p_res ); res.status = stat; } return &res; }