Ejemplo n.º 1
0
 public void Write(XdrDataWriter writer)
 {
     writer.Write(RpcVersion);
     writer.Write(Program);
     writer.Write(Version);
     writer.Write(Proc);
     Credentials.Write(writer);
     Verifier.Write(writer);
 }
Ejemplo n.º 2
0
        public void Write(XdrDataWriter writer)
        {
            writer.Write(SetMode);
            if (SetMode)
            {
                writer.Write((int)Mode);
            }

            writer.Write(SetUid);
            if (SetUid)
            {
                writer.Write(Uid);
            }

            writer.Write(SetGid);
            if (SetGid)
            {
                writer.Write(Gid);
            }

            writer.Write(SetSize);
            if (SetSize)
            {
                writer.Write(Size);
            }

            writer.Write((int)SetAccessTime);
            if (SetAccessTime == Nfs3SetTimeMethod.ClientTime)
            {
                AccessTime.Write(writer);
            }

            writer.Write((int)SetModifyTime);
            if (SetModifyTime == Nfs3SetTimeMethod.ClientTime)
            {
                ModifyTime.Write(writer);
            }
        }
        public void RoundTripTest()
        {
            Nfs3WeakCacheConsistencyAttr attr = new Nfs3WeakCacheConsistencyAttr()
            {
                ChangeTime = new Nfs3FileTime(new DateTime(2017, 1, 1)),
                ModifyTime = new Nfs3FileTime(new DateTime(2017, 1, 2)),
                Size       = 3
            };

            Nfs3WeakCacheConsistencyAttr clone = null;

            using (MemoryStream stream = new MemoryStream())
            {
                XdrDataWriter writer = new XdrDataWriter(stream);
                attr.Write(writer);

                stream.Position = 0;
                XdrDataReader reader = new XdrDataReader(stream);
                clone = new Nfs3WeakCacheConsistencyAttr(reader);
            }

            Assert.Equal(attr, clone);
        }
        public void RoundTripTest()
        {
            Nfs3FileSystemStatResult result = new Nfs3FileSystemStatResult()
            {
                FileSystemStat = new Nfs3FileSystemStat()
                {
                    AvailableFreeFileSlotCount = 1,
                    AvailableFreeSpaceBytes    = 2,
                    FileSlotCount     = 3,
                    FreeFileSlotCount = 4,
                    FreeSpaceBytes    = 5,
                    Invariant         = TimeSpan.FromSeconds(7),
                    TotalSizeBytes    = 8
                },
                PostOpAttributes = new Nfs3FileAttributes()
                {
                    AccessTime = new Nfs3FileTime(new DateTime(2017, 1, 1)),
                    ChangeTime = new Nfs3FileTime(new DateTime(2017, 1, 2)),
                    ModifyTime = new Nfs3FileTime(new DateTime(2017, 1, 3))
                }
            };

            Nfs3FileSystemStatResult clone = null;

            using (MemoryStream stream = new MemoryStream())
            {
                XdrDataWriter writer = new XdrDataWriter(stream);
                result.Write(writer);

                stream.Position = 0;
                XdrDataReader reader = new XdrDataReader(stream);
                clone = new Nfs3FileSystemStatResult(reader);
            }

            Assert.Equal(result, clone);
        }
        public void RoundTripTest()
        {
            PortMap2Mapping attributes = new PortMap2Mapping()
            {
                Port     = 1,
                Program  = 2,
                Protocol = PortMap2Protocol.Tcp,
                Version  = 4
            };

            PortMap2Mapping clone = null;

            using (MemoryStream stream = new MemoryStream())
            {
                XdrDataWriter writer = new XdrDataWriter(stream);
                attributes.Write(writer);

                stream.Position = 0;
                XdrDataReader reader = new XdrDataReader(stream);
                clone = new PortMap2Mapping(reader);
            }

            Assert.Equal(attributes, clone);
        }
Ejemplo n.º 6
0
 internal override void Write(XdrDataWriter writer)
 {
 }
Ejemplo n.º 7
0
 internal abstract void Write(XdrDataWriter writer);
Ejemplo n.º 8
0
 internal abstract void Write(XdrDataWriter writer);
Ejemplo n.º 9
0
 internal override void Write(XdrDataWriter writer)
 {
 }
        public void RoundTripTest()
        {
            Nfs3ReadDirPlusResult result = new Nfs3ReadDirPlusResult()
            {
                CookieVerifier = 1,
                DirAttributes  = new Nfs3FileAttributes()
                {
                    AccessTime   = new Nfs3FileTime(new DateTime(2017, 1, 1)),
                    BytesUsed    = 1,
                    ChangeTime   = new Nfs3FileTime(new DateTime(2017, 1, 2)),
                    FileId       = 2,
                    FileSystemId = 3,
                    Gid          = 4,
                    LinkCount    = 5,
                    Mode         = UnixFilePermissions.GroupAll,
                    ModifyTime   = new Nfs3FileTime(new DateTime(2017, 1, 3)),
                    RdevMajor    = 6,
                    RdevMinor    = 7,
                    Size         = 8,
                    Type         = Nfs3FileType.BlockDevice,
                    Uid          = 9
                },
                DirEntries = new List <Nfs3DirectoryEntry>()
                {
                    new Nfs3DirectoryEntry()
                    {
                        Cookie         = 2,
                        FileAttributes = new Nfs3FileAttributes()
                        {
                            AccessTime   = new Nfs3FileTime(new DateTime(2017, 1, 10)),
                            BytesUsed    = 11,
                            ChangeTime   = new Nfs3FileTime(new DateTime(2017, 1, 12)),
                            FileId       = 12,
                            FileSystemId = 13,
                            Gid          = 14,
                            LinkCount    = 15,
                            Mode         = UnixFilePermissions.GroupWrite,
                            ModifyTime   = new Nfs3FileTime(new DateTime(2017, 1, 13)),
                            RdevMajor    = 16,
                            RdevMinor    = 17,
                            Size         = 18,
                            Type         = Nfs3FileType.Socket,
                            Uid          = 19
                        },
                        FileHandle = new Nfs3FileHandle()
                        {
                            Value = new byte[] { 0xa }
                        },
                        FileId = 99,
                        Name   = "test"
                    }
                },
                Eof    = false,
                Status = Nfs3Status.Ok
            };

            Nfs3ReadDirPlusResult clone = null;

            using (MemoryStream stream = new MemoryStream())
            {
                XdrDataWriter writer = new XdrDataWriter(stream);
                result.Write(writer);

                stream.Position = 0;
                XdrDataReader reader = new XdrDataReader(stream);
                clone = new Nfs3ReadDirPlusResult(reader);
            }

            Assert.Equal(result, clone);
        }