Beispiel #1
0
            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);
            }
Beispiel #2
0
        protected internal static void SendRejectedReply(RpcCall call, EndPoint remoteAddress
                                                         , ChannelHandlerContext ctx)
        {
            XDR            @out  = new XDR();
            RpcDeniedReply reply = new RpcDeniedReply(call.GetXid(), RpcReply.ReplyState.MsgDenied
                                                      , RpcDeniedReply.RejectState.AuthError, new VerifierNone());

            reply.Write(@out);
            ChannelBuffer buf = ChannelBuffers.WrappedBuffer(@out.AsReadOnlyWrap().Buffer());
            RpcResponse   rsp = new RpcResponse(buf, remoteAddress);

            RpcUtil.SendRpcResponse(ctx, rsp);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 /// <exception cref="System.Exception"/>
 public ChannelPipeline GetPipeline()
 {
     return(Channels.Pipeline(RpcUtil.ConstructRpcFrameDecoder(), RpcUtil.StageRpcMessageParser
                              , this._enclosing.rpcProgram, RpcUtil.StageRpcTcpResponse));
 }
Beispiel #5
0
 public ChannelPipeline GetPipeline()
 {
     return(Channels.Pipeline(RpcUtil.ConstructRpcFrameDecoder(), new SimpleTcpClientHandler
                                  (this._enclosing.request)));
 }