private string m_UserName = ""; // Holds USER command value #endregion Fields #region Constructors /// <summary> /// Default constructor. /// </summary> /// <param name="sessionID">Session ID.</param> /// <param name="socket">Server connected socket.</param> /// <param name="bindInfo">BindInfo what accepted socket.</param> /// <param name="server">Reference to server.</param> internal POP3_Session(string sessionID,SocketEx socket,IPBindInfo bindInfo,POP3_Server server) : base(sessionID,socket,bindInfo,server) { m_pServer = server; m_POP3_Messages = new POP3_MessageCollection(); // Start session proccessing StartSession(); }
private string m_UserName = ""; // Holds loggedIn UserName. #endregion Fields #region Constructors /// <summary> /// Default constructor. /// </summary> /// <param name="clientSocket">Referance to socket.</param> /// <param name="server">Referance to POP3 server.</param> /// <param name="sessionID">Session ID which is assigned to this session.</param> /// <param name="logWriter">Log writer.</param> public POP3_Session(Socket clientSocket,POP3_Server server,string sessionID,_LogWriter logWriter) { m_pClientSocket = clientSocket; m_pPOP3_Server = server; m_SessionID = sessionID; m_POP3_Messages = new POP3_Messages(); m_pLogWriter = logWriter; m_SessionStartTime = DateTime.Now; }
private string m_UserName = ""; // Holds loggedIn UserName. #endregion Fields #region Constructors /// <summary> /// Default constructor. /// </summary> /// <param name="clientSocket">Referance to socket.</param> /// <param name="server">Referance to POP3 server.</param> /// <param name="logWriter">Log writer.</param> public POP3_Session(Socket clientSocket,POP3_Server server,_LogWriter logWriter) { m_pSocket = new BufferedSocket(clientSocket); m_pServer = server; m_pLogWriter = logWriter; m_SessionID = Guid.NewGuid().ToString(); m_POP3_Messages = new POP3_Messages(); m_SessionStartTime = DateTime.Now; m_LastDataTime = DateTime.Now; m_pSocket.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.NoDelay,1); // Start session proccessing StartSession(); }
private string m_UserName = ""; // Holds loggedIn UserName. #endregion Fields #region Constructors /// <summary> /// Default constructor. /// </summary> /// <param name="clientSocket">Referance to socket.</param> /// <param name="server">Referance to POP3 server.</param> /// <param name="logWriter">Log writer.</param> public POP3_Session(Socket clientSocket,POP3_Server server,SocketLogger logWriter) { m_pSocket = new BufferedSocket(clientSocket); m_pServer = server; m_SessionID = Guid.NewGuid().ToString(); m_POP3_Messages = new POP3_Messages(); m_SessionStartTime = DateTime.Now; m_LastDataTime = DateTime.Now; if(m_pServer.LogCommands){ m_pSocket.Logger = logWriter; m_pSocket.Logger.SessionID = m_SessionID; } m_pSocket.SetSocketOption(SocketOptionLevel.Socket,SocketOptionName.NoDelay,1); m_pSocket.Activity += new EventHandler(OnSocketActivity); // Start session proccessing StartSession(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.POP3_Server = new LumiSoft.Net.POP3.Server.POP3_Server(this.components); this.IMAP_Server = new LumiSoft.Net.IMAP.Server.IMAP_Server(this.components); this.timer1 = new System.Timers.Timer(); this.SMTP_Server = new LumiSoft.Net.SMTP.Server.SMTP_Server(this.components); ((System.ComponentModel.ISupportInitialize)(this.timer1)).BeginInit(); // // POP3_Server // this.POP3_Server.CommandIdleTimeOut = 60000; this.POP3_Server.LogCommands = false; this.POP3_Server.MaxBadCommands = 8; this.POP3_Server.SessionIdleTimeOut = 80000; this.POP3_Server.SessionResetted += new System.EventHandler(this.poP3_Server1_SessionResetted); this.POP3_Server.GetTopLines += new LumiSoft.Net.POP3.Server.GetTopLinesHandler(this.POP3_Server_GetTopLines); this.POP3_Server.GetMessage += new LumiSoft.Net.POP3.Server.GetMessageHandler(this.pop3_Server_GetMessage); this.POP3_Server.DeleteMessage += new LumiSoft.Net.POP3.Server.DeleteMessageHandler(this.pop3_Server_DeleteMessage); this.POP3_Server.SessionEnd += new System.EventHandler(this.poP3_Server1_SessionEnd); this.POP3_Server.SysError += new LumiSoft.Net.ErrorEventHandler(this.OnServer_SysError); this.POP3_Server.AuthUser += new LumiSoft.Net.POP3.Server.AuthUserEventHandler(this.Server_AuthenticateUser); this.POP3_Server.GetMessgesList += new LumiSoft.Net.POP3.Server.GetMessagesInfoHandler(this.pop3_Server_GetMessgesList); this.POP3_Server.SessionLog += new LumiSoft.Net.LogEventHandler(this.POP3_Server_SessionLog); this.POP3_Server.ValidateIPAddress += new LumiSoft.Net.ValidateIPHandler(this.POP3_Server_ValidateIPAddress); // // timer1 // this.timer1.Interval = 15000; this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Elapsed); // // SMTP_Server // this.SMTP_Server.CommandIdleTimeOut = 60000; this.SMTP_Server.LogCommands = false; this.SMTP_Server.MaxBadCommands = 8; this.SMTP_Server.MaxMessageSize = 1000000; this.SMTP_Server.MaxRecipients = 100; this.SMTP_Server.SessionIdleTimeOut = 80000; this.SMTP_Server.AuthUser += new LumiSoft.Net.SMTP.Server.AuthUserEventHandler(this.Server_AuthenticateUser); this.SMTP_Server.SessionLog += new LumiSoft.Net.LogEventHandler(this.SMTP_Server_SessionLog); this.SMTP_Server.ValidateMailFrom += new LumiSoft.Net.SMTP.Server.ValidateMailFromHandler(this.smtp_Server_ValidateSender); this.SMTP_Server.SysError += new LumiSoft.Net.ErrorEventHandler(this.OnServer_SysError); this.SMTP_Server.StoreMessage += new LumiSoft.Net.SMTP.Server.NewMailEventHandler(this.smtp_Server_NewMailEvent); this.SMTP_Server.ValidateMailTo += new LumiSoft.Net.SMTP.Server.ValidateMailToHandler(this.smtp_Server_ValidateRecipient); this.SMTP_Server.ValidateMailboxSize += new LumiSoft.Net.SMTP.Server.ValidateMailboxSize(this.SMTP_Server_ValidateMailBoxSize); this.SMTP_Server.ValidateIPAddress += new LumiSoft.Net.ValidateIPHandler(this.SMTP_Server_ValidateIPAddress); // // // this.IMAP_Server.SysError += new LumiSoft.Net.ErrorEventHandler(OnServer_SysError); this.IMAP_Server.AuthUser += new LumiSoft.Net.IMAP.Server.AuthUserEventHandler(IMAP_Server_AuthUser); this.IMAP_Server.GetFolders += new FoldersEventHandler(IMAP_Server_GetFolders); this.IMAP_Server.GetSubscribedFolders += new FoldersEventHandler(IMAP_Server_GetSubscribedFolders); this.IMAP_Server.SubscribeFolder += new FolderEventHandler(IMAP_Server_SubscribeFolder); this.IMAP_Server.UnSubscribeFolder += new FolderEventHandler(IMAP_Server_UnSubscribeFolder); this.IMAP_Server.CreateFolder += new FolderEventHandler(IMAP_Server_CreateFolder); this.IMAP_Server.DeleteFolder += new FolderEventHandler(IMAP_Server_DeleteFolder); this.IMAP_Server.RenameFolder += new FolderEventHandler(IMAP_Server_RenameFolder); this.IMAP_Server.GetMessagesInfo += new MessagesEventHandler(IMAP_Server_GetMessagesInfo); this.IMAP_Server.DeleteMessage += new MessageEventHandler(IMAP_Server_DeleteMessage); this.IMAP_Server.StoreMessage += new MessageEventHandler(IMAP_Server_StoreMessage); this.IMAP_Server.StoreMessageFlags += new MessageEventHandler(IMAP_Server_StoreMessageFlags); this.IMAP_Server.CopyMessage += new MessageEventHandler(IMAP_Server_CopyMessage); this.IMAP_Server.GetMessage += new MessageEventHandler(IMAP_Server_GetMessage); this.IMAP_Server.SessionLog += new LumiSoft.Net.LogEventHandler(this.IMAP_Server_SessionLog); // // MailServer // this.ServiceName = "Service1"; ((System.ComponentModel.ISupportInitialize)(this.timer1)).EndInit(); }
/// <summary> /// Stops this virtual server. /// </summary> public void Stop() { m_Running = false; if(m_pSmtpServer != null){ try{ m_pSmtpServer.Dispose(); } catch{ } m_pSmtpServer = null; } if(m_pPop3Server != null){ try{ m_pPop3Server.Dispose(); } catch{ } m_pPop3Server = null; } if(m_pImapServer != null){ try{ m_pImapServer.Dispose(); } catch{ } m_pImapServer = null; } if(m_pRelayServer != null){ try{ m_pRelayServer.Dispose(); } catch{ } m_pRelayServer = null; } if(m_pFetchServer != null){ try{ m_pFetchServer.Dispose(); } catch{ } m_pFetchServer = null; } if(m_pSipServer != null){ try{ m_pSipServer.Stop(); } catch{ } m_pSipServer = null; } if(m_pTimer != null){ try{ m_pTimer.Dispose(); } catch{ } m_pTimer = null; } if(m_pRecycleBinManager != null){ try{ m_pRecycleBinManager.Dispose(); } catch{ } m_pRecycleBinManager = null; } if(m_pBadLoginManager != null){ try{ m_pBadLoginManager.Dispose(); } catch{ } m_pBadLoginManager = null; } }
/// <summary> /// Starts this virtual server. /// </summary> public void Start() { if(m_Running){ return; } m_Running = true; m_pSmtpServer = new SMTP_Server(); m_pSmtpServer.AuthUser += new LumiSoft.Net.SMTP.Server.AuthUserEventHandler(this.Server_AuthenticateUser); m_pSmtpServer.SessionLog += new LumiSoft.Net.LogEventHandler(this.SMTP_Server_SessionLog); m_pSmtpServer.ValidateMailFrom += new LumiSoft.Net.SMTP.Server.ValidateMailFromHandler(this.smtp_Server_ValidateSender); m_pSmtpServer.SysError += new LumiSoft.Net.ErrorEventHandler(this.OnServer_SysError); m_pSmtpServer.GetMessageStoreStream += new GetMessageStoreStreamHandler(SMTP_Server_GetMessageStoreStream); m_pSmtpServer.MessageStoringCompleted += new MessageStoringCompletedHandler(SMTP_Server_MessageStoringCompleted); m_pSmtpServer.ValidateMailTo += new LumiSoft.Net.SMTP.Server.ValidateMailToHandler(this.smtp_Server_ValidateRecipient); m_pSmtpServer.ValidateMailboxSize += new LumiSoft.Net.SMTP.Server.ValidateMailboxSize(this.SMTP_Server_ValidateMailBoxSize); m_pSmtpServer.ValidateIPAddress += new LumiSoft.Net.ValidateIPHandler(this.SMTP_Server_ValidateIPAddress); m_pPop3Server = new POP3_Server(); m_pPop3Server.GetTopLines += new LumiSoft.Net.POP3.Server.MessageHandler(this.POP3_Server_GetTopLines); m_pPop3Server.GetMessageStream += new GetMessageStreamHandler(POP3_Server_GetMessageStream); m_pPop3Server.DeleteMessage += new LumiSoft.Net.POP3.Server.MessageHandler(this.pop3_Server_DeleteMessage); m_pPop3Server.SysError += new LumiSoft.Net.ErrorEventHandler(this.OnServer_SysError); m_pPop3Server.AuthUser += new LumiSoft.Net.POP3.Server.AuthUserEventHandler(this.Server_AuthenticateUser); m_pPop3Server.GetMessgesList += new LumiSoft.Net.POP3.Server.GetMessagesInfoHandler(this.pop3_Server_GetMessgesList); m_pPop3Server.SessionLog += new LumiSoft.Net.LogEventHandler(this.POP3_Server_SessionLog); m_pPop3Server.ValidateIPAddress += new LumiSoft.Net.ValidateIPHandler(this.POP3_Server_ValidateIPAddress); m_pImapServer = new IMAP_Server(); m_pImapServer.ValidateIPAddress += new LumiSoft.Net.ValidateIPHandler(this.IMAP_Server_ValidateIPAddress); m_pImapServer.SysError += new LumiSoft.Net.ErrorEventHandler(OnServer_SysError); m_pImapServer.AuthUser += new LumiSoft.Net.IMAP.Server.AuthUserEventHandler(IMAP_Server_AuthUser); m_pImapServer.GetSharedRootFolders += new SharedRootFoldersEventHandler(IMAP_Server_GetSharedRootFolders); m_pImapServer.GetFolders += new FoldersEventHandler(IMAP_Server_GetFolders); m_pImapServer.GetSubscribedFolders += new FoldersEventHandler(IMAP_Server_GetSubscribedFolders); m_pImapServer.SubscribeFolder += new FolderEventHandler(IMAP_Server_SubscribeFolder); m_pImapServer.UnSubscribeFolder += new FolderEventHandler(IMAP_Server_UnSubscribeFolder); m_pImapServer.CreateFolder += new FolderEventHandler(IMAP_Server_CreateFolder); m_pImapServer.DeleteFolder += new FolderEventHandler(IMAP_Server_DeleteFolder); m_pImapServer.RenameFolder += new FolderEventHandler(IMAP_Server_RenameFolder); m_pImapServer.GetMessagesInfo += new MessagesEventHandler(IMAP_Server_GetMessagesInfo); m_pImapServer.DeleteMessage += new MessageEventHandler(IMAP_Server_DeleteMessage); m_pImapServer.StoreMessage += new MessageEventHandler(IMAP_Server_StoreMessage); m_pImapServer.StoreMessageFlags += new MessageEventHandler(IMAP_Server_StoreMessageFlags); m_pImapServer.CopyMessage += new MessageEventHandler(IMAP_Server_CopyMessage); m_pImapServer.GetMessageItems += new MessagesItemsEventHandler(IMAP_Server_GetMessageItems); m_pImapServer.GetFolderACL += new GetFolderACLEventHandler(IMAP_Server_GetFolderACL); m_pImapServer.SetFolderACL += new SetFolderACLEventHandler(IMAP_Server_SetFolderACL); m_pImapServer.DeleteFolderACL += new DeleteFolderACLEventHandler(IMAP_Server_DeleteFolderACL); m_pImapServer.GetUserACL += new GetUserACLEventHandler(IMAP_Server_GetUserACL); m_pImapServer.GetUserQuota += new GetUserQuotaHandler(IMAP_Server_GetUserQuota); m_pImapServer.SessionLog += new LumiSoft.Net.LogEventHandler(this.IMAP_Server_SessionLog); m_pRelayServer = new Relay_Server(this); m_pFetchServer = new FetchPop3(this,m_pApi); m_pSipServer = new SIP_Stack(); ((SIP_ProxyCore)m_pSipServer.SipCore).Authenticate += new SIP_AuthenticateEventHandler(m_pSipServer_Authenticate); ((SIP_ProxyCore)m_pSipServer.SipCore).IsLocalUri += new SIP_IsLocalUriEventHandler(m_pSipServer_IsLocalUri); ((SIP_ProxyCore)m_pSipServer.SipCore).AddressExists += new SIP_AddressExistsEventHandler(m_pSipServer_AddressExists); ((SIP_ProxyCore)m_pSipServer.SipCore).Registrar.CanRegister += new SIP_CanRegisterEventHandler(m_pSipServer_CanRegister); m_pSipServer.Error += new SIP_ErrorEventHandler(m_pSipServer_Error); m_pRecycleBinManager = new RecycleBinManager(m_pApi); m_pBadLoginManager = new BadLoginManager(); m_pTimer = new System.Timers.Timer(); m_pTimer.Interval = 15000; m_pTimer.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimer_Elapsed); m_pTimer.Enabled = true; LoadSettings(); }
/// <summary> /// Starts this virtual server. /// </summary> public void Start() { if(m_Running){ return; } m_Running = true; m_pDnsClient = new Dns_Client(); m_pSmtpServer = new SMTP_Server(); m_pSmtpServer.Error += new LumiSoft.Net.ErrorEventHandler(OnServer_SysError); m_pSmtpServer.SessionCreated += new EventHandler<TCP_ServerSessionEventArgs<SMTP_Session>>(m_pSmtpServer_SessionCreated); m_pPop3Server = new POP3_Server(); m_pPop3Server.Error += new LumiSoft.Net.ErrorEventHandler(OnServer_SysError); m_pPop3Server.SessionCreated += new EventHandler<TCP_ServerSessionEventArgs<POP3_Session>>(m_pPop3Server_SessionCreated); m_pImapServer = new IMAP_Server(); m_pImapServer.Error += new LumiSoft.Net.ErrorEventHandler(OnServer_SysError); m_pImapServer.SessionCreated += new EventHandler<TCP_ServerSessionEventArgs<IMAP_Session>>(m_pImapServer_SessionCreated); m_pRelayServer = new RelayServer(this); m_pRelayServer.DnsClient = m_pDnsClient; m_pFetchServer = new FetchPop3(this,m_pApi); m_pSipServer = new SIP_Proxy(new SIP_Stack()); m_pSipServer.Authenticate += new SIP_AuthenticateEventHandler(m_pSipServer_Authenticate); m_pSipServer.IsLocalUri += new SIP_IsLocalUriEventHandler(m_pSipServer_IsLocalUri); m_pSipServer.AddressExists += new SIP_AddressExistsEventHandler(m_pSipServer_AddressExists); m_pSipServer.Registrar.CanRegister += new SIP_CanRegisterEventHandler(m_pSipServer_CanRegister); m_pSipServer.Stack.Error += new EventHandler<ExceptionEventArgs>(m_pSipServer_Error); m_pRecycleBinManager = new RecycleBinManager(m_pApi); m_pBadLoginManager = new BadLoginManager(); m_pTimer = new System.Timers.Timer(); m_pTimer.Interval = 15000; m_pTimer.Elapsed += new System.Timers.ElapsedEventHandler(m_pTimer_Elapsed); m_pTimer.Enabled = true; LoadSettings(); }