/// <summary>Dispatch incomming ONC/RPC calls to the individual handler functions.</summary> /// <remarks> /// Dispatch incomming ONC/RPC calls to the individual handler functions. /// The CALLIT method is currently unimplemented. /// </remarks> /// <param name="call"> /// The ONC/RPC call, with references to the transport and /// XDR streams to use for retrieving parameters and sending replies. /// </param> /// <param name="program">the portmap's program number, 100000</param> /// <param name="version">the portmap's protocol version, 2</param> /// <param name="procedure">the procedure to call.</param> /// <exception cref="org.acplt.oncrpc.OncRpcException">if an ONC/RPC error occurs.</exception> /// <exception cref="System.IO.IOException">if an I/O error occurs.</exception> public virtual void dispatchOncRpcCall(org.acplt.oncrpc.server.OncRpcCallInformation call, int program, int version, int procedure) { // // Make sure it's the right program and version that we can handle. // (defensive programming) // if (program == PMAP_PROGRAM) { if (version == PMAP_VERSION) { switch (procedure) { case 0: { // handle NULL call. call.retrieveCall(org.acplt.oncrpc.XdrVoid.XDR_VOID); call.reply(org.acplt.oncrpc.XdrVoid.XDR_VOID); break; } case OncRpcPortmapServices.PMAP_GETPORT: { // handle port query org.acplt.oncrpc.OncRpcServerIdent @params = new org.acplt.oncrpc.OncRpcServerIdent (); call.retrieveCall(@params); org.acplt.oncrpc.OncRpcGetPortResult result = getPort(@params); call.reply(result); break; } case OncRpcPortmapServices.PMAP_SET: { // handle port registration // // ensure that no remote client tries to register // OncRpcServerIdent @params = new OncRpcServerIdent (); call.retrieveCall(@params); org.acplt.oncrpc.XdrBoolean result; if (isLocalAddress(call.peerAddress)) { result = setPort(@params); } else { result = new XdrBoolean(false); } call.reply(result); break; } case OncRpcPortmapServices.PMAP_UNSET: { // handle port deregistration OncRpcServerIdent @params = new OncRpcServerIdent (); call.retrieveCall(@params); org.acplt.oncrpc.XdrBoolean result; if (isLocalAddress(call.peerAddress)) { result = unsetPort(@params); } else { result = new XdrBoolean(false); } call.reply(result); break; } case OncRpcPortmapServices.PMAP_DUMP: { // list all registrations call.retrieveCall(org.acplt.oncrpc.XdrVoid.XDR_VOID); org.acplt.oncrpc.OncRpcDumpResult result = listServers(); call.reply(result); break; } default: { // unknown/unimplemented procedure call.failProcedureUnavailable(); break; } } } else { call.failProgramMismatch(PMAP_VERSION, PMAP_VERSION); } } else { call.failProgramUnavailable(); } }