Beispiel #1
0
 protected internal virtual void ValidateMessageType(RpcMessage.Type expected)
 {
     if (expected != messageType)
     {
         throw new ArgumentException("Message type is expected to be " + expected + " but got "
                                     + messageType);
     }
 }
Beispiel #2
0
 internal RpcMessage(int xid, RpcMessage.Type messageType)
 {
     if (messageType != RpcMessage.Type.RpcCall && messageType != RpcMessage.Type.RpcReply)
     {
         throw new ArgumentException("Invalid message type " + messageType);
     }
     this.xid         = xid;
     this.messageType = messageType;
 }
Beispiel #3
0
 protected internal RpcCall(int xid, RpcMessage.Type messageType, int rpcVersion,
                            int program, int version, int procedure, Credentials credential, Verifier verifier
                            )
     : base(xid, messageType)
 {
     this.rpcVersion  = rpcVersion;
     this.program     = program;
     this.version     = version;
     this.procedure   = procedure;
     this.credentials = credential;
     this.verifier    = verifier;
     if (Log.IsTraceEnabled())
     {
         Log.Trace(this);
     }
     Validate();
 }
Beispiel #4
0
        public static RpcReply Read(XDR xdr)
        {
            int xid = xdr.ReadInt();

            RpcMessage.Type messageType = RpcMessage.Type.FromValue(xdr.ReadInt());
            Preconditions.CheckState(messageType == RpcMessage.Type.RpcReply);
            RpcReply.ReplyState stat = RpcReply.ReplyState.FromValue(xdr.ReadInt());
            switch (stat)
            {
            case RpcReply.ReplyState.MsgAccepted:
            {
                return(RpcAcceptedReply.Read(xid, stat, xdr));
            }

            case RpcReply.ReplyState.MsgDenied:
            {
                return(RpcDeniedReply.Read(xid, stat, xdr));
            }
            }
            return(null);
        }
Beispiel #5
0
 public _RpcMessage_28(int baseArg1, RpcMessage.Type baseArg2)
     : base(baseArg1, baseArg2)
 {
 }
Beispiel #6
0
 private RpcMessage GetRpcMessage(int xid, RpcMessage.Type msgType)
 {
     return(new _RpcMessage_28(xid, msgType));
 }
Beispiel #7
0
 public virtual void TestInvalidRpcMessageType()
 {
     RpcMessage.Type invalidMessageType = RpcMessage.Type.RpcReply;
     // Message typ is not RpcMessage.RPC_CALL
     new RpcCall(0, invalidMessageType, RpcCall.RpcVersion, 2, 3, 4, null, null);
 }