public override void MessageReceived(ChannelHandlerContext ctx, MessageEvent e) { // Get handle from create response ChannelBuffer buf = (ChannelBuffer)e.GetMessage(); XDR rsp = new XDR(buf.Array()); if (rsp.GetBytes().Length == 0) { Log.Info("rsp length is zero, why?"); return; } Log.Info("rsp length=" + rsp.GetBytes().Length); RpcReply reply = RpcReply.Read(rsp); int xid = reply.GetXid(); // Only process the create response if (xid != unchecked ((int)(0x8000004c))) { return; } int status = rsp.ReadInt(); if (status != Nfs3Status.Nfs3Ok) { Log.Error("Create failed, status =" + status); return; } Log.Info("Create succeeded"); rsp.ReadBoolean(); // value follow handle = new FileHandle(); handle.Deserialize(rsp); channel = e.GetChannel(); }
/// <summary>Deserialize a handle from an XDR object</summary> /// <exception cref="System.IO.IOException"/> internal static FileHandle ReadHandle(XDR xdr) { FileHandle handle = new FileHandle(); if (!handle.Deserialize(xdr)) { throw new IOException("can't deserialize file handle"); } return(handle); }
internal static READDIRPLUS3Response.EntryPlus3 Deseralize(XDR xdr) { long fileId = xdr.ReadHyper(); string name = xdr.ReadString(); long cookie = xdr.ReadHyper(); xdr.ReadBoolean(); Nfs3FileAttributes nameAttr = Nfs3FileAttributes.Deserialize(xdr); FileHandle objFileHandle = new FileHandle(); objFileHandle.Deserialize(xdr); return(new READDIRPLUS3Response.EntryPlus3(fileId, name, cookie, nameAttr, objFileHandle )); }
/// <exception cref="System.IO.IOException"/> public LOOKUP3Response(XDR xdr) : base(-1) { fileHandle = new FileHandle(); status = xdr.ReadInt(); Nfs3FileAttributes objAttr = null; if (status == Nfs3Status.Nfs3Ok) { if (!fileHandle.Deserialize(xdr)) { throw new IOException("can't deserialize file handle"); } objAttr = xdr.ReadBoolean() ? Nfs3FileAttributes.Deserialize(xdr) : null; } postOpObjAttr = objAttr; postOpDirAttr = xdr.ReadBoolean() ? Nfs3FileAttributes.Deserialize(xdr) : null; }
public static Org.Apache.Hadoop.Nfs.Nfs3.Response.MKDIR3Response Deserialize(XDR xdr) { int status = xdr.ReadInt(); FileHandle objFileHandle = new FileHandle(); Nfs3FileAttributes objAttr = null; WccData dirWcc; if (status == Nfs3Status.Nfs3Ok) { xdr.ReadBoolean(); objFileHandle.Deserialize(xdr); xdr.ReadBoolean(); objAttr = Nfs3FileAttributes.Deserialize(xdr); } dirWcc = WccData.Deserialize(xdr); return(new Org.Apache.Hadoop.Nfs.Nfs3.Response.MKDIR3Response(status, objFileHandle , objAttr, dirWcc)); }