/// <summary>
        /// Initializes a new <code>OncRpcReplyMessage</code> object and initializes
        /// its complete state from the given parameters.
        /// </summary>
        /// <remarks>
        /// Initializes a new <code>OncRpcReplyMessage</code> object and initializes
        /// its complete state from the given parameters.
        /// <p>Note that depending on the reply, acceptance and rejectance status
        /// some parameters are unused and can be specified as
        /// <code>UNUSED_PARAMETER</code>.
        /// </remarks>
        /// <param name="call">The ONC/RPC call this reply message corresponds to.</param>
        /// <param name="replyStatus">
        /// The reply status (see
        /// <see cref="org.acplt.oncrpc.OncRpcReplyStatus">org.acplt.oncrpc.OncRpcReplyStatus
        /// 	</see>
        /// ).
        /// </param>
        /// <param name="acceptStatus">
        /// The acceptance state (see
        /// <see cref="org.acplt.oncrpc.OncRpcAcceptStatus">org.acplt.oncrpc.OncRpcAcceptStatus
        /// 	</see>
        /// ).
        /// </param>
        /// <param name="rejectStatus">
        /// The rejectance state (see
        /// <see cref="org.acplt.oncrpc.OncRpcRejectStatus">org.acplt.oncrpc.OncRpcRejectStatus
        /// 	</see>
        /// ).
        /// </param>
        /// <param name="lowVersion">lowest supported version.</param>
        /// <param name="highVersion">highest supported version.</param>
        /// <param name="authStatus">
        /// The autentication state (see
        /// <see cref="org.acplt.oncrpc.OncRpcAuthStatus">org.acplt.oncrpc.OncRpcAuthStatus</see>
        /// ).
        /// </param>
        public OncRpcServerReplyMessage(org.acplt.oncrpc.server.OncRpcServerCallMessage call
			, int replyStatus, int acceptStatus, int rejectStatus, int lowVersion, int highVersion
			, int authStatus)
            : base(call, replyStatus, acceptStatus, rejectStatus, lowVersion
			, highVersion, authStatus)
        {
            this.auth = call.auth;
        }
 /// <summary>
 /// Decodes -- that is: deserializes -- a ONC/RPC message header object
 /// from a XDR stream according to RFC 1831.
 /// </summary>
 /// <remarks>
 /// Decodes -- that is: deserializes -- a ONC/RPC message header object
 /// from a XDR stream according to RFC 1831.
 /// </remarks>
 /// <param name="xdr">A decoding XDR stream from which to receive all the mess.</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 xdrDecode(org.acplt.oncrpc.XdrDecodingStream xdr)
 {
     messageId = xdr.xdrDecodeInt();
     //
     // Make sure that we are really decoding an ONC/RPC message call
     // header. Otherwise, throw the appropriate OncRpcException exception.
     //
     messageType = xdr.xdrDecodeInt();
     if (messageType != org.acplt.oncrpc.OncRpcMessageType.ONCRPC_CALL)
     {
         throw (new org.acplt.oncrpc.OncRpcException(org.acplt.oncrpc.OncRpcException.RPC_WRONGMESSAGE
             ));
     }
     //
     // Make sure that the other side is talking the right slang --
     // we will only understand version 2 slang of ONC/RPC.
     //
     oncRpcVersion = xdr.xdrDecodeInt();
     if (oncRpcVersion != ONCRPC_VERSION)
     {
         throw (new org.acplt.oncrpc.OncRpcException(org.acplt.oncrpc.OncRpcException.RPC_VERSMISMATCH
             ));
     }
     //
     // Now decode the remaining fields of the call header.
     //
     program = xdr.xdrDecodeInt();
     version = xdr.xdrDecodeInt();
     procedure = xdr.xdrDecodeInt();
     //
     // Last comes the authentication data. Note that the "factory" hidden
     // within xdrNew() will graciously recycle any old authentication
     // protocol handling object if it is of the same authentication type
     // as the new one just coming in from the XDR wire.
     //
     auth = org.acplt.oncrpc.server.OncRpcServerAuth.xdrNew(xdr, auth);
 }
示例#3
0
        /// <summary>Restores (deserializes) an authentication object from an XDR stream.</summary>
        /// <remarks>Restores (deserializes) an authentication object from an XDR stream.</remarks>
        /// <param name="xdr">
        /// XDR stream from which the authentication object is
        /// restored.
        /// </param>
        /// <param name="recycle">
        /// old authtentication object which is intended to be
        /// reused in case it is of the same authentication type as the new
        /// one just arriving from the XDR stream.
        /// </param>
        /// <returns>
        /// Authentication information encapsulated in an object, whose class
        /// is derived from <code>OncRpcServerAuth</code>.
        /// </returns>
        /// <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 static org.acplt.oncrpc.server.OncRpcServerAuth xdrNew(org.acplt.oncrpc.XdrDecodingStream
                                                                      xdr, org.acplt.oncrpc.server.OncRpcServerAuth recycle)
        {
            org.acplt.oncrpc.server.OncRpcServerAuth auth;
            //
            // In case we got an old authentication object and we are just about
            // to receive an authentication with the same type, we reuse the old
            // object.
            //
            int authType = xdr.xdrDecodeInt();

            if ((recycle != null) && (recycle.getAuthenticationType() == authType))
            {
                //
                // Simply recycle authentication object and pull its new state
                // of the XDR stream.
                //
                auth = recycle;
                auth.xdrDecodeCredVerf(xdr);
            }
            else
            {
                switch (authType)
                {
                case org.acplt.oncrpc.OncRpcAuthType.ONCRPC_AUTH_NONE:
                {
                    //
                    // Create a new authentication object and pull its state off
                    // the XDR stream.
                    //
                    auth = org.acplt.oncrpc.server.OncRpcServerAuthNone.AUTH_NONE;
                    auth.xdrDecodeCredVerf(xdr);
                    break;
                }

                case org.acplt.oncrpc.OncRpcAuthType.ONCRPC_AUTH_SHORT:
                {
                    auth = new org.acplt.oncrpc.server.OncRpcServerAuthShort(xdr);
                    break;
                }

                case org.acplt.oncrpc.OncRpcAuthType.ONCRPC_AUTH_UNIX:
                {
                    auth = new org.acplt.oncrpc.server.OncRpcServerAuthUnix(xdr);
                    break;
                }

                default:
                {
                    //
                    // In case of an unknown or unsupported type, throw an exception.
                    // Note: using AUTH_REJECTEDCRED is in sync with the way Sun's
                    // ONC/RPC implementation does it. But don't ask me why they do
                    // it this way...!
                    //
                    throw (new org.acplt.oncrpc.OncRpcAuthenticationException(org.acplt.oncrpc.OncRpcAuthStatus
                                                                              .ONCRPC_AUTH_REJECTEDCRED));
                }
                }
            }
            return(auth);
        }