Пример #1
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     claim = xdr.xdrDecodeInt();
     switch ( claim ) {
     case open_claim_type4.CLAIM_NULL:
         file = new component4(xdr);
         break;
     case open_claim_type4.CLAIM_PREVIOUS:
         delegate_type = xdr.xdrDecodeInt();
         break;
     case open_claim_type4.CLAIM_DELEGATE_CUR:
         delegate_cur_info = new open_claim_delegate_cur4(xdr);
         break;
     case open_claim_type4.CLAIM_DELEGATE_PREV:
         file_delegate_prev = new component4(xdr);
         break;
     case open_claim_type4.CLAIM_FH:
         break;
     case open_claim_type4.CLAIM_DELEG_PREV_FH:
         break;
     case open_claim_type4.CLAIM_DELEG_CUR_FH:
         oc_delegate_stateid = new stateid4(xdr);
         break;
     }
 }
Пример #2
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     stateid = new stateid4(xdr);
     offset = new offset4(xdr);
     stable = xdr.xdrDecodeInt();
     data = xdr.xdrDecodeDynamicOpaque();
 }
Пример #3
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     lrs_present = xdr.xdrDecodeBoolean();
     if (lrs_present == true)
     {
         lrs_stateid = new stateid4(xdr);
     }
 }
Пример #4
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     stateid = new stateid4(xdr);
     cinfo = new change_info4(xdr);
     rflags = new uint32_t(xdr);
     attrset = new bitmap4(xdr);
     delegation = new open_delegation4(xdr);
 }
Пример #5
0
 public void xdrDecode(XdrDecodingStream xdr) {
     loca_length = new length4(xdr);
     loca_reclaim = xdr.xdrDecodeBoolean();
     loca_stateid = new stateid4(xdr);
     loca_last_write_offset = new newoffset4(xdr);
     loca_time_modify = new newtime4(xdr);
     loca_layoutupdate = new layoutupdate4(xdr);
 }
Пример #6
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     stateid = new stateid4(xdr);
     cinfo = new change_info4(xdr);
     rflags = new uint32_t(xdr);
     attrset = new bitmap4(xdr);
     delegation = new open_delegation4(xdr);
 }
Пример #7
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     logr_stateid = new stateid4(xdr);
     { int _size = xdr.xdrDecodeInt(); logr_layout = new layout4[_size]; for (int _idx = 0; _idx < _size; ++_idx)
       {
           logr_layout[_idx] = new layout4(xdr);
       }
     }
 }
Пример #8
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     loca_length            = new length4(xdr);
     loca_reclaim           = xdr.xdrDecodeBoolean();
     loca_stateid           = new stateid4(xdr);
     loca_last_write_offset = new newoffset4(xdr);
     loca_time_modify       = new newtime4(xdr);
     loca_layoutupdate      = new layoutupdate4(xdr);
 }
Пример #9
0
 public void xdrDecode(XdrDecodingStream xdr) {
     loga_layout_type = xdr.xdrDecodeInt();
     loga_iomode = xdr.xdrDecodeInt();
     loga_offset = new offset4(xdr);
     loga_length = new length4(xdr);
     loga_minlength = new length4(xdr);
     loga_stateid = new stateid4(xdr);
     loga_maxcount = new count4(xdr);
 }
Пример #10
0
 public void xdrDecode(XdrDecodingStream xdr) {
     status = xdr.xdrDecodeInt();
     switch ( status ) {
     case nfsstat4.NFS4_OK:
         open_stateid = new stateid4(xdr);
         break;
     default:
         break;
     }
 }
Пример #11
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     loga_layout_type = xdr.xdrDecodeInt();
     loga_iomode = xdr.xdrDecodeInt();
     loga_offset = new offset4(xdr);
     loga_length = new length4(xdr);
     loga_minlength = new length4(xdr);
     loga_stateid = new stateid4(xdr);
     loga_maxcount = new count4(xdr);
 }
Пример #12
0
        public void xdrDecode(XdrDecodingStream xdr)
        {
            status = xdr.xdrDecodeInt();
            switch (status)
            {
            case nfsstat4.NFS4_OK:
                open_stateid = new stateid4(xdr);
                break;

            default:
                break;
            }
        }
Пример #13
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     open_stateid = new stateid4(xdr);
     lock_seqid   = new seqid4(xdr);
     lock_owner   = new lock_owner4(xdr);
 }
Пример #14
0
        private void closeFile(nfs_fh4 fh,stateid4 stateid)
        {
         List<nfs_argop4> ops = new List<nfs_argop4>();
            
        ops.Add(SequenceStub.generateRequest(false, _sessionid.value,
                _sequenceID.value.value, 12, 0));

        ops.Add(PutfhStub.generateRequest(fh));
        ops.Add(CloseStub.generateRequest(stateid) );

        COMPOUND4res compound4res = sendCompound(ops, "");

        if (compound4res.status == nfsstat4.NFS4_OK) {
            //close file ok
        }
        else {
            throw new NFSConnectionException(nfsstat4.getErrorString(compound4res.status));
        }
        }
Пример #15
0
 public void xdrDecode(XdrDecodingStream xdr)
  {
     seqid = new seqid4(xdr);
     open_stateid = new stateid4(xdr);
 }
Пример #16
0
 public void xdrDecode(XdrDecodingStream xdr) {
     gddr_stateid = new stateid4(xdr);
     gddr_notification = new bitmap4(xdr);
     gddr_child_attributes = new bitmap4(xdr);
     gddr_dir_attributes = new bitmap4(xdr);
 }
Пример #17
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     lrf_length  = new length4(xdr);
     lrf_stateid = new stateid4(xdr);
     lrf_body    = xdr.xdrDecodeDynamicOpaque();
 }
Пример #18
0
 public void xdrDecode(XdrDecodingStream xdr) {
     seqid = new seqid4(xdr);
     lock_stateid = new stateid4(xdr);
     offset = new offset4(xdr);
     length = new length4(xdr);
 }
Пример #19
0
 public void xdrDecode(XdrDecodingStream xdr) {
     logr_stateid = new stateid4(xdr);
     { int _size = xdr.xdrDecodeInt(); logr_layout = new layout4[_size]; for ( int _idx = 0; _idx < _size; ++_idx ) { logr_layout[_idx] = new layout4(xdr); } }
 }
Пример #20
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     seqid        = new seqid4(xdr);
     open_stateid = new stateid4(xdr);
 }
Пример #21
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     stateid = new stateid4(xdr);
     offset = new offset4(xdr);
     count = new count4(xdr);
 }
Пример #22
0
        public int Read(String FileFullName, long Offset, int Count, ref Byte[] Buffer)
        {
            if (_ProtocolV4 == null)
            { throw new NFSConnectionException("NFS Client not connected!"); }

            int rCount = 0;

            if (Count == 0)
               return 0;
            
           
            if (_CurrentItem != FileFullName)
            {
                NFSAttributes Attributes = GetItemAttributes(FileFullName);
                _cwf = new nfs_fh4(Attributes.Handle);
                _CurrentItem = FileFullName;

                string ParentDirectory = System.IO.Path.GetDirectoryName(FileFullName);
                NFSAttributes ParentAttributes = GetItemAttributes(ParentDirectory);

                String[] PathTree = FileFullName.Split(@"\".ToCharArray());


                //make open here
                List<nfs_argop4> ops = new List<nfs_argop4>();
                ops.Add(SequenceStub.generateRequest(false, _sessionid.value,
            _sequenceID.value.value, 12, 0));
                //dir  herez
                //ops.Add(PutfhStub.generateRequest(_cwd));
                ops.Add(PutfhStub.generateRequest(new nfs_fh4(ParentAttributes.Handle)));
                //let's try with sequence 0
                ops.Add(OpenStub.normalREAD(PathTree[PathTree.Length-1],0,_clientIdByServer,NFSv4Protocol.OPEN4_SHARE_ACCESS_READ));


                COMPOUND4res compound4res = sendCompound(ops, "");
                if (compound4res.status == nfsstat4.NFS4_OK)
                {
                    //open ok
                     currentState = compound4res.resarray[2].opopen.resok4.stateid;
                }
                else
                {
                    throw new NFSConnectionException(nfsstat4.getErrorString(compound4res.status));
                }



                //check the acess also
                if (get_fh_acess(_cwf) % 2 != 1)
                {
                    //we don't have read acess give error
                    throw new NFSConnectionException("Sorry no file READ acess !!!");
                }
   
            }
            
            List<nfs_argop4> ops2 = new List<nfs_argop4>();
            ops2.Add(SequenceStub.generateRequest(false, _sessionid.value,
        _sequenceID.value.value, 12, 0));
            ops2.Add(PutfhStub.generateRequest(_cwf));
            ops2.Add(ReadStub.generateRequest(Count,Offset,currentState));



            COMPOUND4res compound4res2 = sendCompound(ops2, "");
            if (compound4res2.status == nfsstat4.NFS4_OK)
            {
                //read of offset complete
                rCount = compound4res2.resarray[2].opread.resok4.data.Length;

                ///copy the data to the output
                Array.Copy(compound4res2.resarray[2].opread.resok4.data, Buffer, rCount);

            }
            else
            {
                throw new NFSConnectionException(nfsstat4.getErrorString(compound4res2.status));
            }

            return rCount;
        }
Пример #23
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     delegate_stateid = new stateid4(xdr);
     file             = new component4(xdr);
 }
Пример #24
0
        public int Write(String FileFullName, long Offset, int Count, Byte[] Buffer)
        {
            if (_ProtocolV4 == null)
            { throw new NFSConnectionException("NFS Client not connected!"); }


            int rCount = 0;
            //nfs_fh4 current = _cwd;


            
            if (_CurrentItem != FileFullName)
            {

                _CurrentItem = FileFullName;


                String[] PathTree = FileFullName.Split(@"\".ToCharArray());

                string ParentDirectory = System.IO.Path.GetDirectoryName(FileFullName);
                NFSAttributes ParentAttributes = GetItemAttributes(ParentDirectory);


                //make open here
                List<nfs_argop4> ops = new List<nfs_argop4>();
                ops.Add(SequenceStub.generateRequest(false, _sessionid.value,
            _sequenceID.value.value, 12, 0));
                //dir  herez
                ops.Add(PutfhStub.generateRequest(new nfs_fh4(ParentAttributes.Handle)));
                //let's try with sequence 0
                ops.Add(OpenStub.normalOPENonly(PathTree[PathTree.Length - 1], _sequenceID.value.value, _clientIdByServer, NFSv4Protocol.OPEN4_SHARE_ACCESS_WRITE));
                ops.Add(GetfhStub.generateRequest());


                COMPOUND4res compound4res = sendCompound(ops, "");
                if (compound4res.status == nfsstat4.NFS4_OK)
                {
                    //open ok
                    currentState = compound4res.resarray[2].opopen.resok4.stateid;

                    _cwf = compound4res.resarray[3].opgetfh.resok4.object1;


                }
                else
                {
                    throw new NFSConnectionException(nfsstat4.getErrorString(compound4res.status));
                }





            }

            List<nfs_argop4> ops2 = new List<nfs_argop4>();
            ops2.Add(SequenceStub.generateRequest(false, _sessionid.value,
        _sequenceID.value.value, 12, 0));
            ops2.Add(PutfhStub.generateRequest(_cwf));

            //make better buffer
            Byte[] Buffer2 = new Byte[Count];
            Array.Copy(Buffer, Buffer2, Count);
            ops2.Add(WriteStub.generateRequest(Offset, Buffer2, currentState));



            COMPOUND4res compound4res2 = sendCompound(ops2, "");
            if (compound4res2.status == nfsstat4.NFS4_OK)
            {
                //write of offset complete
                rCount = compound4res2.resarray[2].opwrite.resok4.count.value.value;
            }
            else
            {
                throw new NFSConnectionException(nfsstat4.getErrorString(compound4res2.status));
            }

            return rCount;
        }
Пример #25
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     delegate_stateid = new stateid4(xdr);
     file = new component4(xdr);
 }
Пример #26
0
 public void xdrDecode(XdrDecodingStream xdr) {
     lrs_present = xdr.xdrDecodeBoolean();
     if ( lrs_present == true ) {
         lrs_stateid = new stateid4(xdr);
     }
 }
Пример #27
0
 public void xdrDecode(XdrDecodingStream xdr) {
     lrf_length = new length4(xdr);
     lrf_stateid = new stateid4(xdr);
     lrf_body = xdr.xdrDecodeDynamicOpaque();
 }
Пример #28
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     stateid = new stateid4(xdr);
     offset = new offset4(xdr);
     count = new count4(xdr);
 }
Пример #29
0
 public void xdrDecode(XdrDecodingStream xdr)
 {
     open_stateid = new stateid4(xdr);
     lock_seqid = new seqid4(xdr);
     lock_owner = new lock_owner4(xdr);
 }
Пример #30
0
        public void CreateFile(string FileFullName, NFSPermission Mode)
        {
            if (_CurrentItem != FileFullName)
            {
                _CurrentItem = FileFullName;


                String[] PathTree = FileFullName.Split(@"\".ToCharArray());

                string ParentDirectory = System.IO.Path.GetDirectoryName(FileFullName);
                NFSAttributes ParentAttributes = GetItemAttributes(ParentDirectory);





                //make open here
                List<nfs_argop4> ops = new List<nfs_argop4>();
                ops.Add(SequenceStub.generateRequest(false, _sessionid.value,
            _sequenceID.value.value, 12, 0));
                //dir  herez
                ops.Add(PutfhStub.generateRequest(new nfs_fh4(ParentAttributes.Handle)));
                //let's try with sequence 0
                ops.Add(OpenStub.normalCREATE(PathTree[PathTree.Length - 1], _sequenceID.value.value, _clientIdByServer, NFSv4Protocol.OPEN4_SHARE_ACCESS_WRITE));
                ops.Add(GetfhStub.generateRequest());


                COMPOUND4res compound4res = sendCompound(ops, "");
                if (compound4res.status == nfsstat4.NFS4_OK)
                {
                    //open ok
                    currentState = compound4res.resarray[2].opopen.resok4.stateid;

                    _cwf = compound4res.resarray[3].opgetfh.resok4.object1;


                }
                else
                {
                    throw new NFSConnectionException(nfsstat4.getErrorString(compound4res.status));
                }

            }
        }