Пример #1
0
        public static XDR Create(PortmapMapping mapping, bool set)
        {
            XDR     request   = new XDR();
            int     procedure = set ? RpcProgramPortmap.PmapprocSet : RpcProgramPortmap.PmapprocUnset;
            RpcCall call      = RpcCall.GetInstance(RpcUtil.GetNewXid(RpcProgramPortmap.Program.ToString
                                                                          ()), RpcProgramPortmap.Program, RpcProgramPortmap.Version, procedure, new CredentialsNone
                                                        (), new VerifierNone());

            call.Write(request);
            return(mapping.Serialize(request));
        }
Пример #2
0
        internal static XDR Write(FileHandle handle, int xid, long offset, int count, byte
                                  [] data)
        {
            XDR request = new XDR();

            RpcCall.GetInstance(xid, Nfs3Constant.Program, Nfs3Constant.Version, Nfs3Constant.NFSPROC3
                                .Create.GetValue(), new CredentialsNone(), new VerifierNone()).Write(request);
            WRITE3Request write1 = new WRITE3Request(handle, offset, count, Nfs3Constant.WriteStableHow
                                                     .Unstable, ByteBuffer.Wrap(data));

            write1.Serialize(request);
            return(request);
        }
Пример #3
0
        internal static XDR Create()
        {
            XDR request = new XDR();

            RpcCall.GetInstance(unchecked ((int)(0x8000004c)), Nfs3Constant.Program, Nfs3Constant
                                .Version, Nfs3Constant.NFSPROC3.Create.GetValue(), new CredentialsNone(), new VerifierNone
                                    ()).Write(request);
            SetAttr3       objAttr   = new SetAttr3();
            CREATE3Request createReq = new CREATE3Request(new FileHandle("/"), "out-of-order-write"
                                                          + Runtime.CurrentTimeMillis(), 0, objAttr, 0);

            createReq.Serialize(request);
            return(request);
        }
Пример #4
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        public virtual void TestRegistration()
        {
            XDR req = new XDR();

            RpcCall.GetInstance(++xid, RpcProgramPortmap.Program, RpcProgramPortmap.Version,
                                RpcProgramPortmap.PmapprocSet, new CredentialsNone(), new VerifierNone()).Write(
                req);
            PortmapMapping sent = new PortmapMapping(90000, 1, PortmapMapping.TransportTcp, 1234
                                                     );

            sent.Serialize(req);
            byte[]         reqBuf = req.GetBytes();
            DatagramSocket s      = new DatagramSocket();
            DatagramPacket p      = new DatagramPacket(reqBuf, reqBuf.Length, pm.GetUdpServerLoAddress
                                                           ());

            try
            {
                s.Send(p);
            }
            finally
            {
                s.Close();
            }
            // Give the server a chance to process the request
            Thread.Sleep(100);
            bool found = false;
            IDictionary <string, PortmapMapping> map = (IDictionary <string, PortmapMapping>)Whitebox
                                                       .GetInternalState(pm.GetHandler(), "map");

            foreach (PortmapMapping m in map.Values)
            {
                if (m.GetPort() == sent.GetPort() && PortmapMapping.Key(m).Equals(PortmapMapping.
                                                                                  Key(sent)))
                {
                    found = true;
                    break;
                }
            }
            Assert.True("Registration failed", found);
        }
Пример #5
0
 internal static void CreatePortmapXDRheader(XDR xdr_out, int procedure)
 {
     // Make this a method
     RpcCall.GetInstance(0, 100000, 2, procedure, new CredentialsNone(), new VerifierNone
                             ()).Write(xdr_out);
 }