Exemplo n.º 1
0
 /// <summary>
 /// Response for RPC call
 /// <see cref="MNTPROC.Export"/>
 ///
 /// </summary>
 public static XDR WriteExportList(XDR xdr, int xid, IList <string> exports, IList <
                                       NfsExports> hostMatcher)
 {
     System.Diagnostics.Debug.Assert((exports.Count == hostMatcher.Count));
     RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(xdr);
     for (int i = 0; i < exports.Count; i++)
     {
         xdr.WriteBoolean(true);
         // Value follows - yes
         xdr.WriteString(exports[i]);
         // List host groups
         string[] hostGroups = hostMatcher[i].GetHostGroupList();
         if (hostGroups.Length > 0)
         {
             for (int j = 0; j < hostGroups.Length; j++)
             {
                 xdr.WriteBoolean(true);
                 // Value follows - yes
                 xdr.WriteVariableOpaque(Runtime.GetBytesForString(hostGroups[j], Charsets
                                                                   .Utf8));
             }
         }
         xdr.WriteBoolean(false);
     }
     // Value follows - no more group
     xdr.WriteBoolean(false);
     // Value follows - no
     return(xdr);
 }
Exemplo n.º 2
0
 public override XDR NullOp(XDR @out, int xid, IPAddress client)
 {
     if (Log.IsDebugEnabled())
     {
         Log.Debug("MOUNT NULLOP : " + " client: " + client);
     }
     return(RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(@out));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Write the response, along with the rpc header (including verifier), to the
        /// XDR.
        /// </summary>
        public virtual XDR Serialize(XDR @out, int xid, Verifier verifier)
        {
            RpcAcceptedReply reply = RpcAcceptedReply.GetAcceptInstance(xid, verifier);

            reply.Write(@out);
            @out.WriteInt(this.GetStatus());
            return(@out);
        }
Exemplo n.º 4
0
 public override XDR Umntall(XDR @out, int xid, IPAddress client)
 {
     if (Log.IsDebugEnabled())
     {
         Log.Debug("MOUNT UMNTALL : " + " client: " + client);
     }
     mounts.Clear();
     return(RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(@out));
 }
Exemplo n.º 5
0
 public static XDR PmapList(XDR xdr, int xid, PortmapMapping[] list)
 {
     RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(xdr);
     foreach (PortmapMapping mapping in list)
     {
         xdr.WriteBoolean(true);
         // Value follows
         mapping.Serialize(xdr);
     }
     xdr.WriteBoolean(false);
     // No value follows
     return(xdr);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Response for RPC call
 /// <see cref="MNTPROC.Mnt"/>
 ///
 /// </summary>
 public static XDR WriteMNTResponse(int status, XDR xdr, int xid, byte[] handle)
 {
     RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(xdr);
     xdr.WriteInt(status);
     if (status == MntOk)
     {
         xdr.WriteVariableOpaque(handle);
         // Only MountV3 returns a list of supported authFlavors
         xdr.WriteInt(1);
         xdr.WriteInt(RpcAuthInfo.AuthFlavor.AuthSys.GetValue());
     }
     return(xdr);
 }
Exemplo n.º 7
0
        public override XDR Umnt(XDR xdr, XDR @out, int xid, IPAddress client)
        {
            string path = xdr.ReadString();

            if (Log.IsDebugEnabled())
            {
                Log.Debug("MOUNT UMNT path: " + path + " client: " + client);
            }
            string host = client.GetHostName();

            mounts.Remove(new MountEntry(host, path));
            RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(@out);
            return(@out);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Response for RPC call
 /// <see cref="MNTPROC.Dump"/>
 ///
 /// </summary>
 public static XDR WriteMountList(XDR xdr, int xid, IList <MountEntry> mounts)
 {
     RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(xdr);
     foreach (MountEntry mountEntry in mounts)
     {
         xdr.WriteBoolean(true);
         // Value follows yes
         xdr.WriteString(mountEntry.GetHost());
         xdr.WriteString(mountEntry.GetPath());
     }
     xdr.WriteBoolean(false);
     // Value follows no
     return(xdr);
 }
Exemplo n.º 9
0
 public static XDR VoidReply(XDR xdr, int xid)
 {
     RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(xdr);
     return(xdr);
 }
Exemplo n.º 10
0
 public static XDR BooleanReply(XDR xdr, int xid, bool value)
 {
     RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(xdr);
     xdr.WriteBoolean(value);
     return(xdr);
 }
Exemplo n.º 11
0
 public static XDR IntReply(XDR xdr, int xid, int value)
 {
     RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(xdr);
     xdr.WriteInt(value);
     return(xdr);
 }