Пример #1
0
        internal void HandleCall(Caller clientInfo)
        {
            var rpcMessage = new RpcMessage(this.xdrReader);

            this.xid = rpcMessage.Xid;
            if (rpcMessage.Body.MessageType != MessageType.Call)
            {
                throw new RpcException(
                          $"Message type should be {nameof(MessageType.Call)} but was {rpcMessage.Body.MessageType}.");
            }

            if (rpcMessage.Body.CallBody.RpcVersion != 2)
            {
                RpcMessage reply = this.GenerateRpcVersionMismatch(2, 2);
                reply.WriteTo(this.xdrWriter);
                return;
            }

            if (rpcMessage.Body.CallBody.Program != this.program)
            {
                RpcMessage reply = this.GenerateReply(AcceptStatus.ProgramUnavailable);
                reply.WriteTo(this.xdrWriter);
                return;
            }

            this.Version   = rpcMessage.Body.CallBody.Version;
            this.Procedure = rpcMessage.Body.CallBody.Procedure;
            this.Caller    = clientInfo;

            this.receivedCallDispatcher(this);
        }
Пример #2
0
        public void Reply(IXdrWritable result)
        {
            RpcMessage reply = this.GenerateReply(AcceptStatus.Success);

            reply.WriteTo(this.xdrWriter);
            result.WriteTo(this.xdrWriter);
        }
Пример #3
0
        public void ProgramMismatch()
        {
            RpcMessage reply = this.GenerateProgramMismatch(this.lowVersion, this.highVersion);

            reply.WriteTo(this.xdrWriter);
        }
Пример #4
0
        public void ProcedureUnavailable()
        {
            RpcMessage reply = this.GenerateReply(AcceptStatus.ProcedureUnavailable);

            reply.WriteTo(this.xdrWriter);
        }