FTP Session.
상속: LumiSoft.Net.SocketServerSession
예제 #1
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="session">Reference to pop3 session.</param>
 /// <param name="userName">Username.</param>
 /// <param name="passwData">Password data.</param>
 /// <param name="data">Authentication specific data(as tag).</param>
 /// <param name="authType">Authentication type.</param>
 public AuthUser_EventArgs(FTP_Session session,string userName,string passwData,string data,AuthType authType)
 {
     m_pSession  = session;
     m_UserName  = userName;
     m_PasswData = passwData;
     m_Data      = data;
     m_AuthType  = authType;
 }
예제 #2
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="session">Reference to pop3 session.</param>
 /// <param name="userName">Username.</param>
 /// <param name="passwData">Password data.</param>
 /// <param name="data">Authentication specific data(as tag).</param>
 /// <param name="authType">Authentication type.</param>
 public AuthUser_EventArgs(FTP_Session session, string userName, string passwData, string data, AuthType authType)
 {
     m_pSession  = session;
     m_UserName  = userName;
     m_PasswData = passwData;
     m_Data      = data;
     m_AuthType  = authType;
 }
예제 #3
0
        internal FileSysEntry_EventArgs OnGetDirInfo(FTP_Session session, string dir)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, dir, "");

            if (this.GetDirInfo != null)
            {
                this.GetDirInfo(this, oArg);
            }
            return(oArg);
        }
예제 #4
0
        internal bool OnDeleteFile(FTP_Session session, string file)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, "");

            if (this.DeleteFile != null)
            {
                this.DeleteFile(this, oArg);
            }

            return(oArg.Validated);
        }
예제 #5
0
        /// <summary>
        /// Authenticates user.
        /// </summary>
        /// <param name="session">Reference to current pop3 session.</param>
        /// <param name="userName">User name.</param>
        /// <param name="passwData"></param>
        /// <param name="data"></param>
        /// <param name="authType"></param>
        /// <returns></returns>
        internal virtual bool OnAuthUser(FTP_Session session, string userName, string passwData, string data, AuthType authType)
        {
            AuthUser_EventArgs oArg = new AuthUser_EventArgs(session, userName, passwData, data, authType);

            if (this.AuthUser != null)
            {
                this.AuthUser(this, oArg);
            }

            return(oArg.Validated);
        }
예제 #6
0
        internal bool OnDeleteDir(FTP_Session session, string dir)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, dir, "");

            if (this.DeleteDir != null)
            {
                this.DeleteDir(this, oArg);
            }

            return(oArg.Validated);
        }
예제 #7
0
        internal bool OnRenameDirFile(FTP_Session session, string from, string to)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, from, to);

            if (this.RenameDirFile != null)
            {
                this.RenameDirFile(this, oArg);
            }

            return(oArg.Validated);
        }
예제 #8
0
        internal Stream OnStoreFile(FTP_Session session, string file)
        {
            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, "");

            if (this.StoreFile != null)
            {
                this.StoreFile(this, oArg);
            }

            return(oArg.FileStream);
        }
예제 #9
0
        /// <summary>
        /// Initialize and start new session here. Session isn't added to session list automatically,
        /// session must add itself to server session list by calling AddSession().
        /// </summary>
        /// <param name="socket">Connected client socket.</param>
        /// <param name="bindInfo">BindInfo what accepted socket.</param>
        protected override void InitNewSession(Socket socket, IPBindInfo bindInfo)
        {
            string   sessionID = Guid.NewGuid().ToString();
            SocketEx socketEx  = new SocketEx(socket);

            if (LogCommands)
            {
                socketEx.Logger           = new SocketLogger(socket, this.SessionLog);
                socketEx.Logger.SessionID = sessionID;
            }
            FTP_Session session = new FTP_Session(sessionID, socketEx, bindInfo, this);
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="newName"></param>
        /// <param name="session"></param>
        public FileSysEntry_EventArgs(FTP_Session session,string name,string newName)
        {
            m_Name    = name;
            m_NewName = newName;

            m_DsDirInfo  = new DataSet();
            DataTable dt = m_DsDirInfo.Tables.Add("DirInfo");
            dt.Columns.Add("Name");
            dt.Columns.Add("Date",typeof(DateTime));
            dt.Columns.Add("Size",typeof(long));
            dt.Columns.Add("IsDirectory",typeof(bool));
        }
예제 #11
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="newName"></param>
        /// <param name="session"></param>
        public FileSysEntry_EventArgs(FTP_Session session, string name, string newName)
        {
            m_Name    = name;
            m_NewName = newName;

            m_DsDirInfo = new DataSet();
            DataTable dt = m_DsDirInfo.Tables.Add("DirInfo");

            dt.Columns.Add("Name");
            dt.Columns.Add("Date", typeof(DateTime));
            dt.Columns.Add("Size", typeof(long));
            dt.Columns.Add("IsDirectory", typeof(bool));
        }
예제 #12
0
파일: FTP_Session.cs 프로젝트: dioptre/nkd
            /// <summary>
            /// Default constructor.
            /// </summary>
            /// <param name="session">Owner FTP session.</param>
            /// <param name="stream">Data connection data stream.</param>
            /// <param name="read_write">Specifies if data read from remote endpoint or written to it.</param>
            /// <exception cref="ArgumentNullException">Is raised when <b>session</b> or <b>stream</b> is null reference.</exception>
            public DataConnection(FTP_Session session,Stream stream,bool read_write)
            {
                if(session == null){
                    throw new ArgumentNullException("session");
                }
                if(stream == null){
                    throw new ArgumentNullException("stream");
                }

                m_pSession   = session;
                m_pStream    = stream;
                m_Read_Write = read_write;
            }
예제 #13
0
        internal bool OnFileExists(FTP_Session session, string file)
        {
            // Remove last /
            file = file.Substring(0, file.Length - 1);

            FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session, file, "");

            if (this.FileExists != null)
            {
                this.FileExists(this, oArg);
            }

            return(oArg.Validated);
        }
예제 #14
0
파일: FTP_Session.cs 프로젝트: dioptre/nkd
            /// <summary>
            /// Cleans up any resources being used.
            /// </summary>
            public void Dispose()
            {
                if(m_IsDisposed){
                    return;
                }
                m_IsDisposed = true;

                // Reset session PASV cached data.
                if(m_pSession.m_pPassiveSocket != null){
                    m_pSession.m_pPassiveSocket.Close();
                    m_pSession.m_pPassiveSocket = null;
                }                
                m_pSession.m_PassiveMode = false;

                m_pSession = null;
                if(m_pStream != null){
                    m_pStream.Dispose();
                    m_pStream = null;
                }
                if(m_pSocket != null){
                    m_pSocket.Close();
                    m_pSocket = null;
                }
            }
예제 #15
0
		internal bool OnDeleteFile(FTP_Session session,string file)
		{
			FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,file,"");
			if(this.DeleteFile != null){
				this.DeleteFile(this,oArg);
			}
			
			return oArg.Validated;
		}
예제 #16
0
		internal Stream OnStoreFile(FTP_Session session,string file)
		{
			FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,file,"");
			if(this.StoreFile != null){
				this.StoreFile(this,oArg);
			}
			
			return oArg.FileStream;
		}
예제 #17
0
		internal FileSysEntry_EventArgs OnGetDirInfo(FTP_Session session,string dir)
		{
			FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,dir,"");
			if(this.GetDirInfo != null){
				this.GetDirInfo(this,oArg);
			}
			return oArg;
		}
예제 #18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="socket"></param>
 protected override void InitNewSession(Socket socket)
 {
     SocketLogger logger  = new SocketLogger(socket, this.SessionLog);
     FTP_Session  session = new FTP_Session(socket, this, Guid.NewGuid().ToString(), logger);
 }
예제 #19
0
		/// <summary>
		/// Authenticates user.
		/// </summary>
		/// <param name="session">Reference to current pop3 session.</param>
		/// <param name="userName">User name.</param>
		/// <param name="passwData"></param>
		/// <param name="data"></param>
		/// <param name="authType"></param>
		/// <returns></returns>
		internal virtual bool OnAuthUser(FTP_Session session,string userName,string passwData,string data,AuthType authType) 
		{				
			AuthUser_EventArgs oArg = new AuthUser_EventArgs(session,userName,passwData,data,authType);
			if(this.AuthUser != null){
				this.AuthUser(this,oArg);
			}
			
			return oArg.Validated;
		}
예제 #20
0
		internal bool OnDeleteDir(FTP_Session session,string dir)
		{
			FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,dir,"");
			if(this.DeleteDir != null){
				this.DeleteDir(this,oArg);
			}
			
			return oArg.Validated;
		}
예제 #21
0
		internal bool OnFileExists(FTP_Session session,string file)
		{
			// Remove last /
			file = file.Substring(0,file.Length - 1);

			FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,file,"");
			if(this.FileExists != null){
				this.FileExists(this,oArg);
			}
			
			return oArg.Validated;
		}
예제 #22
0
		/// <summary>
		/// Initialize and start new session here. Session isn't added to session list automatically, 
		/// session must add itself to server session list by calling AddSession().
		/// </summary>
		/// <param name="socket">Connected client socket.</param>
        /// <param name="bindInfo">BindInfo what accepted socket.</param>
		protected override void InitNewSession(Socket socket,IPBindInfo bindInfo)
		{
            string   sessionID = Guid.NewGuid().ToString();
            SocketEx socketEx  = new SocketEx(socket);
            if(LogCommands){
                socketEx.Logger = new SocketLogger(socket,this.SessionLog);
				socketEx.Logger.SessionID = sessionID;
            }
			FTP_Session session = new FTP_Session(sessionID,socketEx,bindInfo,this);
		}
예제 #23
0
		internal bool OnRenameDirFile(FTP_Session session,string from,string to)
		{
			FileSysEntry_EventArgs oArg = new FileSysEntry_EventArgs(session,from,to);
			if(this.RenameDirFile != null){
				this.RenameDirFile(this,oArg);
			}
			
			return oArg.Validated;
		}