Exemplo n.º 1
0
        public RpcAuthentication(RpcCredentials credential)
        {
            _flavour = credential.AuthFlavour;

            MemoryStream ms = new MemoryStream();
            XdrDataWriter writer = new XdrDataWriter(ms);
            credential.Write(writer);
            _body = ms.ToArray();
        }
Exemplo n.º 2
0
        protected XdrDataWriter StartCallMessage(MemoryStream ms, RpcCredentials credentials, uint procedure)
        {
            XdrDataWriter writer = new XdrDataWriter(ms);

            writer.Write(_client.NextTransactionId());
            writer.Write((int)RpcMessageType.Call);

            RpcCallHeader hdr = new RpcCallHeader();
            hdr.RpcVersion = RpcVersion;
            hdr.Program = (uint)Identifier;
            hdr.Version = (uint)Version;
            hdr.Proc = procedure;
            hdr.Credentials = new RpcAuthentication(credentials ?? new RpcNullCredentials());
            hdr.Verifier = RpcAuthentication.Null();
            hdr.Write(writer); 

            return writer;
        }
Exemplo n.º 3
0
 internal override void Write(XdrDataWriter writer)
 {
     writer.Write((int)0);
     writer.Write(_machineName);
     writer.Write(_uid);
     writer.Write(_gid);
     if (_gids == null)
     {
         writer.Write((int)0);
     }
     else
     {
         writer.Write(_gids.Length);
         for (int i = 0; i < _gids.Length; ++i)
         {
             writer.Write(_gids[i]);
         }
     }
 }
        public Nfs3MountResult Mount(string dirPath)
        {
            MemoryStream  ms     = new MemoryStream();
            XdrDataWriter writer = StartCallMessage(ms, _client.Credentials, 1);

            writer.Write(dirPath);

            RpcReply reply = DoSend(ms);

            if (reply.Header.IsSuccess)
            {
                Nfs3Status status = (Nfs3Status)reply.BodyReader.ReadInt32();
                if (status == Nfs3Status.Ok)
                {
                    return(new Nfs3MountResult(reply.BodyReader));
                }

                throw new Nfs3Exception(status);
            }
            else
            {
                throw new RpcException(reply.Header.ReplyHeader);
            }
        }
Exemplo n.º 5
0
        public override void Write(XdrDataWriter writer)
        {
            writer.Write((int)Status);

            writer.Write(DirAttributes != null);
            if (DirAttributes != null)
            {
                DirAttributes.Write(writer);
            }

            if (Status == Nfs3Status.Ok)
            {
                writer.Write(CookieVerifier);

                foreach (var entry in DirEntries)
                {
                    writer.Write(true);
                    entry.Write(writer);
                }

                writer.Write(false);
                writer.Write(Eof);
            }
        }
Exemplo n.º 6
0
 ////public TimeSpan ToTimeSpan()
 ////{
 ////    return new TimeSpan(_seconds * TicksPerSec + (_nseconds / TicksPerNanoSec));
 ////}
 public void Write(XdrDataWriter writer)
 {
     writer.Write(_seconds);
     writer.Write(_nseconds);
 }
Exemplo n.º 7
0
        ////public TimeSpan ToTimeSpan()
        ////{
        ////    return new TimeSpan(_seconds * TicksPerSec + (_nseconds / TicksPerNanoSec));
        ////}

        public void Write(XdrDataWriter writer)
        {
            writer.Write(_seconds);
            writer.Write(_nseconds);
        }
Exemplo n.º 8
0
 public override void Write(XdrDataWriter writer)
 {
     writer.Write((int)Status);
     CacheConsistency.Write(writer);
 }
Exemplo n.º 9
0
 public void Write(XdrDataWriter writer)
 {
     writer.Write(Low);
     writer.Write(High);
 }
Exemplo n.º 10
0
 public virtual void Write(XdrDataWriter writer)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 11
0
 public void Write(XdrDataWriter writer)
 {
     writer.Write((int)_flavour);
     writer.WriteBuffer(_body);
 }
Exemplo n.º 12
0
 public void Write(XdrDataWriter writer)
 {
     writer.Write(TransactionId);
     writer.Write((int)RpcMessageType.Reply);
     ReplyHeader.Write(writer);
 }
Exemplo n.º 13
0
 internal void Write(XdrDataWriter writer)
 {
     writer.Write(_seconds);
     writer.Write(_nseconds);
 }
Exemplo n.º 14
0
 public void Write(XdrDataWriter writer)
 {
     writer.Write(Port);
 }
Exemplo n.º 15
0
 public void Write(XdrDataWriter writer)
 {
     writer.Write((int)_flavour);
     writer.WriteBuffer(_body);
 }
 internal void Write(XdrDataWriter writer)
 {
     writer.WriteBuffer(Value);
 }
Exemplo n.º 17
0
 internal void Write(XdrDataWriter writer)
 {
     writer.Write(Size);
     ModifyTime.Write(writer);
     ChangeTime.Write(writer);
 }