/*
 * Automatically generated by jrpcgen 1.0.7 on 29.11.2012
 * jrpcgen is part of the "Remote Tea.Net" ONC/RPC package for C#
 * See http://remotetea.sourceforge.net for details
 */
using NFSLibrary.Protocols.Commons;
using org.acplt.oncrpc;

namespace NFSLibrary.Protocols.V3.RPC
{
    public class MakeFileArguments : XdrAble
    {
        private ItemOperationArguments _where;
        private MakeFileHow _how;

        public MakeFileArguments()
        { }

        public MakeFileArguments(XdrDecodingStream xdr)
        { xdrDecode(xdr); }

        public void xdrEncode(XdrEncodingStream xdr)
        {
            this._where.xdrEncode(xdr);
            this._how.xdrEncode(xdr);
        }

        public void xdrDecode(XdrDecodingStream xdr)
        {
            this._where = new ItemOperationArguments(xdr);
            this._how = new MakeFileHow(xdr);
        }

        public ItemOperationArguments Where
        {
            get
            { return this._where; }
            set
            { this._where = value; }
        }

        public MakeFileHow How
        {
            get
            { return this._how; }
            set
            { this._how = value; }
        }
    }

    public class MakeFileHow : XdrAble
    {
        private MakeFileModes _mode;
        private MakeAttributes _obj_attributes;
        private byte[] _verf;

        public enum MakeFileModes
        {
            UNCHECKED = 0,
            GUARDED = 1,
            EXCLUSIVE = 2
        }

        public MakeFileHow()
        { }

        public MakeFileHow(XdrDecodingStream xdr)
        { xdrDecode(xdr); }

        public void xdrEncode(XdrEncodingStream xdr)
        {
            xdr.xdrEncodeInt((int)this._mode);

            switch (this._mode)
            {
                case MakeFileModes.UNCHECKED:
                case MakeFileModes.GUARDED:
                    this._obj_attributes.xdrEncode(xdr);
                    break;
                case MakeFileModes.EXCLUSIVE:
                    xdr.xdrEncodeOpaque(this._verf, NFSv3Protocol.NFS3_CREATEVERFSIZE);
                    break;
            }
        }

        public void xdrDecode(XdrDecodingStream xdr)
        {
            this._mode = (MakeFileModes)xdr.xdrDecodeInt();

            switch (this._mode)
            {
                case MakeFileModes.UNCHECKED:
                case MakeFileModes.GUARDED:
                    this._obj_attributes = new MakeAttributes(xdr);
                    break;
                case MakeFileModes.EXCLUSIVE:
                    this._verf = xdr.xdrDecodeOpaque(NFSv3Protocol.NFS3_CREATEVERFSIZE);
                    break;
            }
        }

        public MakeFileModes Mode
        {
            get
            { return this._mode; }
            set
            { this._mode = value; }
        }

        public MakeAttributes Attributes
        {
            get
            { return this._obj_attributes; }
            set
            { this._obj_attributes = value; }
        }

        public byte[] Verification
        {
            get
            { return this._verf; }
            set
            { this._verf = value; }
        }
    }
    // End of CREATE3args.cs
}