Пример #1
0
        /*const int MODE_FMT = 0170000;
        const int MODE_DIR = 0040000;
        const int MODE_CHR = 0020000;
        const int MODE_BLK = 0060000;
        const int MODE_REG = 0100000;
        const int MODE_LNK = 0120000;
        const int MODE_SOCK = 0140000;
        const int MODE_FIFO = 0010000;*/

        #endregion

        #region Methods

        public void Connect(IPAddress Address, int UserID, int GroupID, int ClientTimeout, System.Text.Encoding characterEncoding, bool useSecurePort)
        {
            if (ClientTimeout == 0)
            { ClientTimeout = 60000; }

            if (characterEncoding == null)
            { characterEncoding = System.Text.Encoding.ASCII; }

            _RootDirectoryHandleObject = null;
            _CurrentItemHandleObject = null;

            _MountedDevice = String.Empty;
            _CurrentItem = String.Empty;

            _GroupID = GroupID;
            _UserID = UserID;

            _MountProtocolV2 = new NFSv2MountProtocolClient(Address, OncRpcProtocols.ONCRPC_UDP, useSecurePort);
            _ProtocolV2 = new NFSv2ProtocolClient(Address, OncRpcProtocols.ONCRPC_UDP, useSecurePort);

            OncRpcClientAuthUnix authUnix = new OncRpcClientAuthUnix(System.Environment.MachineName, UserID, GroupID);

            _MountProtocolV2.GetClient().setAuth(authUnix);
            _MountProtocolV2.GetClient().setTimeout(ClientTimeout);
            _MountProtocolV2.GetClient().setCharacterEncoding(characterEncoding.WebName);

            _ProtocolV2.GetClient().setAuth(authUnix);
            _ProtocolV2.GetClient().setTimeout(ClientTimeout);
            _ProtocolV2.GetClient().setCharacterEncoding(characterEncoding.WebName);
        }
Пример #2
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._fhandle = new NFSHandle();
     this._fhandle.Version = NFSv3MountProtocol.MOUNTVERS;
     this._fhandle.xdrDecode(xdr);
     this._auth_flavors = xdr.xdrDecodeIntVector();
 }
Пример #3
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._file = new NFSHandle();
     this._file.Version = V3.RPC.NFSv3Protocol.NFS_V3;
     this._file.xdrDecode(xdr);
     this._link = new ItemOperationArguments(xdr);
 }
Пример #4
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._dir = new NFSHandle();
     this._dir.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
     this._dir.xdrDecode(xdr);
     this._name = new Name(xdr);
 }
Пример #5
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._file = new NFSHandle();
     this._file.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
     this._file.xdrDecode(xdr);
     this._attributes = new CreateAttributes(xdr);
 }
Пример #6
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._from = new NFSHandle();
     this._from.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
     this._from.xdrDecode(xdr);
     this._to = new ItemOperationArguments(xdr);
 }
Пример #7
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._obj = new NFSHandle();
     this._obj.Version = V3.RPC.NFSv3Protocol.NFS_V3;
     this._obj.xdrDecode(xdr);
     this._access = xdr.xdrDecodeInt();
 }
Пример #8
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._hostname = new Name(xdr);
     this._directory = new NFSHandle();
     this._directory.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
     this._directory.xdrDecode(xdr);
     this._nextentry = new MountList(xdr);
 }
Пример #9
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._item = new NFSHandle();
     this._item.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
     this._item.xdrDecode(xdr);
     this._cookie = new NFSCookie(xdr);
     this._count = xdr.xdrDecodeInt();
 }
Пример #10
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._handle = new NFSHandle();
     this._handle.Version = V3.RPC.NFSv3Protocol.NFS_V3;
     this._handle.xdrDecode(xdr);
     this._attributes = new PostOperationAttributes(xdr);
     this._dir_wcc = new WritingData(xdr);
 }
Пример #11
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._file = new NFSHandle();
     this._file.Version = V3.RPC.NFSv3Protocol.NFS_V3;
     this._file.xdrDecode(xdr);
     this._offset = xdr.xdrDecodeLong();
     this._count = xdr.xdrDecodeInt();
 }
Пример #12
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._obj = new NFSHandle();
     this._obj.Version = V3.RPC.NFSv3Protocol.NFS_V3;
     this._obj.xdrDecode(xdr);
     this._obj_attributes = new PostOperationAttributes(xdr);
     this._dir_attributes = new PostOperationAttributes(xdr);
 }
Пример #13
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._file = new NFSHandle();
     this._file.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
     this._file.xdrDecode(xdr);
     this._offset = xdr.xdrDecodeInt();
     this._count = xdr.xdrDecodeInt();
     this._totalcount = xdr.xdrDecodeInt();
 }
Пример #14
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._item = new NFSHandle();
     this._item.Version = V3.RPC.NFSv3Protocol.NFS_V3;
     this._item.xdrDecode(xdr);
     this._cookie = new NFSCookie(xdr);
     this._cookieverf = xdr.xdrDecodeOpaque(NFSv3Protocol.NFS3_COOKIEVERFSIZE);
     this._count = xdr.xdrDecodeInt();
 }
Пример #15
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._obj = new NFSHandle();
     this._obj.Version = V3.RPC.NFSv3Protocol.NFS_V3;
     this._obj.xdrDecode(xdr);
     this._new_attributes = new MakeAttributes(xdr);
     this._guardcheck = xdr.xdrDecodeBoolean();
     if (this._guardcheck)
     { this._guardctime = new NFSTimeValue(xdr); }
 }
Пример #16
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._file = new NFSHandle();
     this._file.Version = V3.RPC.NFSv3Protocol.NFS_V3;
     this._file.xdrDecode(xdr);
     this._offset = xdr.xdrDecodeLong();
     this._count = xdr.xdrDecodeInt();
     this._stable = (StableHow)xdr.xdrDecodeInt();
     this._data = xdr.xdrDecodeDynamicOpaque();
 }
Пример #17
0
        public void Disconnect()
        {
            _RootDirectoryHandleObject = null;
            _CurrentItemHandleObject = null;

            _MountedDevice = String.Empty;
            _CurrentItem = String.Empty;

            if (_MountProtocolV2 != null)
            { _MountProtocolV2.close(); }

            if (_ProtocolV2 != null)
            { _ProtocolV2.close(); }
        }
Пример #18
0
        public void xdrDecode(XdrDecodingStream xdr)
        {
            this._status = (NFSMountStats)xdr.xdrDecodeInt();

            switch (this._status)
            {
                case NFSMountStats.MNT_OK:
                    this._handle = new NFSHandle();
                    this._handle.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
                    this._handle.xdrDecode(xdr);

                    break;
                default:
                    break;
            }
        }
Пример #19
0
 public void CompleteIO()
 {
     _CurrentItemHandleObject = null;
     _CurrentItem = string.Empty;
 }
Пример #20
0
        public void dispatchOncRpcCall(OncRpcCallInformation call, int program, int version, int procedure)
        {
            if (version == 2)
            {
                switch (procedure)
                {
                    case 0:
                        {
                            call.retrieveCall(XdrVoid.XDR_VOID);
                            NFSPROC_NULL();
                            call.reply(XdrVoid.XDR_VOID);

                            break;
                        }
                    case 1:
                        {
                            NFSHandle args_ = new NFSHandle();
                            args_.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
                            call.retrieveCall(args_);

                            FileStatus result_ = NFSPROC_GETATTR(args_);
                            call.reply(result_);

                            break;
                        }
                    case 2:
                        {
                            CreateArguments args_ = new CreateArguments();
                            call.retrieveCall(args_);

                            FileStatus result_ = NFSPROC_SETATTR(args_);
                            call.reply(result_);

                            break;
                        }
                    case 3:
                        {
                            call.retrieveCall(XdrVoid.XDR_VOID);
                            NFSPROC_ROOT();
                            call.reply(XdrVoid.XDR_VOID);

                            break;
                        }
                    case 4:
                        {
                            ItemOperationArguments args_ = new ItemOperationArguments();
                            call.retrieveCall(args_);

                            ItemOperationStatus result_ = NFSPROC_LOOKUP(args_);
                            call.reply(result_);

                            break;
                        }
                    case 5:
                        {
                            NFSHandle args_ = new NFSHandle();
                            args_.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
                            call.retrieveCall(args_);

                            LinkStatus result_ = NFSPROC_READLINK(args_);
                            call.reply(result_);

                            break;
                        }
                    case 6:
                        {
                            ReadArguments args_ = new ReadArguments();
                            call.retrieveCall(args_);

                            ReadStatus result_ = NFSPROC_READ(args_);
                            call.reply(result_);

                            break;
                        }
                    case 7:
                        {
                            call.retrieveCall(XdrVoid.XDR_VOID);
                            NFSPROC_WRITECACHE();
                            call.reply(XdrVoid.XDR_VOID);

                            break;
                        }
                    case 8:
                        {
                            WriteArguments args_ = new WriteArguments();
                            call.retrieveCall(args_);

                            FileStatus result_ = NFSPROC_WRITE(args_);
                            call.reply(result_);

                            break;
                        }
                    case 9:
                        {
                            CreateArguments args_ = new CreateArguments();
                            call.retrieveCall(args_);

                            ItemOperationStatus result_ = NFSPROC_CREATE(args_);
                            call.reply(result_);

                            break;
                        }
                    case 10:
                        {
                            ItemOperationArguments args_ = new ItemOperationArguments();
                            call.retrieveCall(args_);

                            XdrInt result_ = new XdrInt(NFSPROC_REMOVE(args_));
                            call.reply(result_);

                            break;
                        }
                    case 11:
                        {
                            RenameArguments args_ = new RenameArguments();
                            call.retrieveCall(args_);

                            XdrInt result_ = new XdrInt(NFSPROC_RENAME(args_));
                            call.reply(result_);

                            break;
                        }
                    case 12:
                        {
                            LinkArguments args_ = new LinkArguments();
                            call.retrieveCall(args_);

                            XdrInt result_ = new XdrInt(NFSPROC_LINK(args_));
                            call.reply(result_);

                            break;
                        }
                    case 13:
                        {
                            SymlinkArguments args_ = new SymlinkArguments();
                            call.retrieveCall(args_);

                            XdrInt result_ = new XdrInt(NFSPROC_SYMLINK(args_));
                            call.reply(result_);

                            break;
                        }
                    case 14:
                        {
                            CreateArguments args_ = new CreateArguments();
                            call.retrieveCall(args_);

                            ItemOperationStatus result_ = NFSPROC_MKDIR(args_);
                            call.reply(result_);

                            break;
                        }
                    case 15:
                        {
                            ItemOperationArguments args_ = new ItemOperationArguments();
                            call.retrieveCall(args_);

                            XdrInt result_ = new XdrInt(NFSPROC_RMDIR(args_));
                            call.reply(result_);

                            break;
                        }
                    case 16:
                        {
                            ItemArguments args_ = new ItemArguments();
                            call.retrieveCall(args_);

                            ItemStatus result_ = NFSPROC_READDIR(args_);
                            call.reply(result_);

                            break;
                        }
                    case 17:
                        {
                            NFSHandle args_ = new NFSHandle();
                            args_.Version = V2.RPC.NFSv2Protocol.NFS_VERSION;
                            call.retrieveCall(args_);

                            FSStatStatus result_ = NFSPROC_STATFS(args_);
                            call.reply(result_);

                            break;
                        }
                    default:
                        {
                            call.failProcedureUnavailable();

                            break;
                        }
                }
            }
            else
            { call.failProgramUnavailable(); }
        }
Пример #21
0
        public void MountDevice(String DeviceName)
        {
            if (_ProtocolV2 == null)
            { 
                throw new NFSConnectionException("NFS Client not connected!"); 
            }

            MountStatus mnt =
                _MountProtocolV2.MOUNTPROC_MNT(new Name(DeviceName));

            if (mnt.Status == 0)
            {
                _MountedDevice = DeviceName;
                _RootDirectoryHandleObject = mnt.Handle;
            }
            else
            { 
                MountExceptionHelpers.ThrowException(mnt.Status); 
            }
        }
Пример #22
0
        /**
         * Call remote procedure NFSPROC_STATFS_2.
         * @param arg1 parameter (of type nfshandle) to the remote procedure call.
         * @return Result from remote procedure call (of type statfsres).
         * @throws OncRpcException if an ONC/RPC error occurs.
         * @throws IOException if an I/O error occurs.
         */
        public FSStatStatus NFSPROC_STATFS(NFSHandle arg1)
        {
            FSStatStatus result_ = new FSStatStatus();

            client.call(NFSv2Protocol.NFSPROC_STATFS, NFSv2Protocol.NFS_VERSION, arg1, result_);

            return result_;
        }
Пример #23
0
        /**
         * Call remote procedure NFSPROC_READLINK_2.
         * @param arg1 parameter (of type nfshandle) to the remote procedure call.
         * @return Result from remote procedure call (of type readlinkres).
         * @throws OncRpcException if an ONC/RPC error occurs.
         * @throws IOException if an I/O error occurs.
         */
        public LinkStatus NFSPROC_READLINK(NFSHandle arg1)
        {
            LinkStatus result_ = new LinkStatus();

            client.call(NFSv2Protocol.NFSPROC_READLINK, NFSv2Protocol.NFS_VERSION, arg1, result_);

            return result_;
        }
Пример #24
0
        /**
         * Call remote procedure NFSPROC_GETATTR_2.
         * @param arg1 parameter (of type nfshandle) to the remote procedure call.
         * @return Result from remote procedure call (of type attrstat).
         * @throws OncRpcException if an ONC/RPC error occurs.
         * @throws IOException if an I/O error occurs.
         */
        public FileStatus NFSPROC_GETATTR(NFSHandle arg1)
        {
            FileStatus result_ = new FileStatus();

            client.call(NFSv2Protocol.NFSPROC_GETATTR, NFSv2Protocol.NFS_VERSION, arg1, result_);

            return result_;
        }
Пример #25
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     this._fsroot = new NFSHandle();
     this._fsroot.Version = V3.RPC.NFSv3Protocol.NFS_V3;
     this._fsroot.xdrDecode(xdr);
 }
Пример #26
0
 public abstract FSStatStatus NFSPROC_STATFS(NFSHandle arg1);
Пример #27
0
        public int Write(String FileFullName, long Offset, int Count, Byte[] Buffer)
        {
            if (_ProtocolV2 == null)
            { 
                throw new NFSConnectionException("NFS Client not connected!"); 
            }

            if (_MountProtocolV2 == null)
            {
                throw new NFSMountConnectionException("NFS Device not connected!"); 
            }

            int rCount = 0;

            if (_CurrentItem != FileFullName)
            {
                NFSAttributes Attributes = GetItemAttributes(FileFullName);
                _CurrentItemHandleObject = new NFSHandle(Attributes.Handle, V2.RPC.NFSv2Protocol.NFS_VERSION);
                _CurrentItem = FileFullName;
            }

            if (Count < Buffer.Length)
            { 
                Array.Resize<byte>(ref Buffer, Count); 
            }

            WriteArguments dpArgWrite = new WriteArguments();
            dpArgWrite.File = _CurrentItemHandleObject;
            dpArgWrite.Offset = (int)Offset;
            dpArgWrite.Data = Buffer;

            FileStatus pAttrStat =
                _ProtocolV2.NFSPROC_WRITE(dpArgWrite);

            if (pAttrStat != null)
            {
                if (pAttrStat.Status != NFSStats.NFS_OK)
                { 
                    ExceptionHelpers.ThrowException(pAttrStat.Status); 
                }

                rCount = Count;
            }
            else
            { 
                throw new NFSGeneralException("NFSPROC_WRITE: failure"); 
            }

            return rCount;
        }
Пример #28
0
        public int Read(String FileFullName, long Offset, int Count, ref Byte[] Buffer)
        {
            if (_ProtocolV2 == null)
            { 
                throw new NFSConnectionException("NFS Client not connected!"); 
            }

            if (_MountProtocolV2 == null)
            { 
                throw new NFSMountConnectionException("NFS Device not connected!"); 
            }

            int rCount = 0;

            if (_CurrentItem != FileFullName)
            {
                NFSAttributes Attributes = GetItemAttributes(FileFullName);
                _CurrentItemHandleObject = new NFSHandle(Attributes.Handle, V2.RPC.NFSv2Protocol.NFS_VERSION);
                _CurrentItem = FileFullName;
            }

            ReadArguments dpArgRead = new ReadArguments();
            dpArgRead.File = _CurrentItemHandleObject;
            dpArgRead.Offset = (int)Offset;
            dpArgRead.Count = Count;

            ReadStatus pReadRes =
                _ProtocolV2.NFSPROC_READ(dpArgRead);

            if (pReadRes != null)
            {
                if (pReadRes.Status != NFSStats.NFS_OK)
                { ExceptionHelpers.ThrowException(pReadRes.Status); }

                rCount = pReadRes.OK.Data.Length;

                Array.Copy(pReadRes.OK.Data, Buffer, rCount);
            }
            else
            { 
                throw new NFSGeneralException("NFSPROC_READ: failure"); 
            }

            return rCount;
        }
Пример #29
0
        public void UnMountDevice()
        {
            if (_MountedDevice != null)
            {
                _MountProtocolV2.MOUNTPROC_UMNT(new Name(_MountedDevice));

                _RootDirectoryHandleObject = null;
                _CurrentItemHandleObject = null;

                _MountedDevice = String.Empty;
                _CurrentItem = String.Empty;
            }
        }
Пример #30
0
 public abstract LinkStatus NFSPROC_READLINK(NFSHandle arg1);