protected internal override void HandleInternal(ChannelHandlerContext ctx, RpcInfo info) { // This is just like what's done in RpcProgramMountd#handleInternal and // RpcProgramNfs3#handleInternal. RpcCall rpcCall = (RpcCall)info.Header(); int procedure = rpcCall.GetProcedure(); if (procedure != 0) { bool portMonitorSuccess = DoPortMonitoring(info.RemoteAddress()); if (!portMonitorSuccess) { SendRejectedReply(rpcCall, info.RemoteAddress(), ctx); return; } } resultSize = info.Data().ReadableBytes(); RpcAcceptedReply reply = RpcAcceptedReply.GetAcceptInstance(1234, new VerifierNone ()); XDR @out = new XDR(); reply.Write(@out); ChannelBuffer b = ChannelBuffers.WrappedBuffer(@out.AsReadOnlyWrap().Buffer()); RpcResponse rsp = new RpcResponse(b, info.RemoteAddress()); RpcUtil.SendRpcResponse(ctx, rsp); }
private void SendAcceptedReply(RpcCall call, EndPoint remoteAddress, RpcAcceptedReply.AcceptState acceptState, ChannelHandlerContext ctx) { RpcAcceptedReply reply = RpcAcceptedReply.GetInstance(call.GetXid(), acceptState, Verifier.VerifierNone); XDR @out = new XDR(); reply.Write(@out); if (acceptState == RpcAcceptedReply.AcceptState.ProgMismatch) { @out.WriteInt(lowProgVersion); @out.WriteInt(highProgVersion); } ChannelBuffer b = ChannelBuffers.WrappedBuffer(@out.AsReadOnlyWrap().Buffer()); RpcResponse rsp = new RpcResponse(b, remoteAddress); RpcUtil.SendRpcResponse(ctx, rsp); }