private void Null(NfsPacket sourcePacket, IPEndPoint receivedFrom) { // Put together an XDR reply packet NfsPacket packet = new NfsPacket(128); packet.SetUInt(sourcePacket.XID); packet.SetUInt((uint)RpcSignalType.Reply); packet.SetUInt((uint)RpcMessageResult.Accepted); // Put on a NULL authentication packet.AddNullAuthentication(); packet.SetUInt((uint)RpcProcedure.Success); Send(packet, receivedFrom); }
private void GetPort(NfsPacket sourcePacket, IPEndPoint receivedFrom) { // skip past the authentication records sourcePacket.ReadAuthentication(); sourcePacket.ReadAuthentication(); // Collect the arguments to the procedure uint programId = sourcePacket.GetUInt(); uint version = sourcePacket.GetUInt(); uint protocol = sourcePacket.GetUInt(); // Put together an XDR reply packet NfsPacket packet = new NfsPacket(128); packet.SetUInt(sourcePacket.XID); packet.SetUInt((uint)RpcSignalType.Reply); packet.SetUInt((uint)RpcMessageResult.Accepted); packet.AddNullAuthentication(); if (!NfsHandlerManager.IsProgramRegistered((int)programId)) { packet.SetUInt((uint)RpcProcedure.ProgramUnavailable); } else { // TODO: add version checking. we're only doing v2 right now. // version mismatch gets the ProgMismatch value. // result.AddLong(RPCConsts.RPCProgMismatch); // result.AddLong(versmin); // result.AddLong(versmax); int port = NfsHandlerManager.GetPort((int)programId); if (port == 0) { packet.SetUInt((uint)RpcProcedure.ProgramMismatch); } else { packet.SetUInt((uint)RpcProcedure.Success); packet.SetUInt((uint)port); } } Send(packet, receivedFrom); }