Ejemplo n.º 1
0
 internal SmtpSession(SmtpServer server, TcpClient tcpClient)
 {
     _server       = server;
     _stateMachine = new SmtpStateMachine(_server);
     Stream        = new NetworkTextStream(tcpClient);
     RetryCount    = 5;
     Reset();
 }
Ejemplo n.º 2
0
 public EhloCommand(string domainOrAddress, SmtpServer server)
 {
     _domainOrAddress = domainOrAddress;
     _server          = server;
 }
Ejemplo n.º 3
0
 internal SmtpCommandFactory(SmtpServer server)
 {
     _server = server;
     _parser = new SmtpParser();
 }
Ejemplo n.º 4
0
        internal SmtpStateMachine(SmtpServer server)
        {
            var commandFactory = new SmtpCommandFactory(server);

            _stateTable = new StateTable(commandFactory)
            {
                new State(0)
                {
                    {
                        "DBUG",
                        new State.MakeDelegate(commandFactory.MakeDbug),
                        null
                    },

                    {
                        "NOOP",
                        new State.MakeDelegate(commandFactory.MakeNoop),
                        null
                    },

                    {
                        "RSET",
                        new State.MakeDelegate(commandFactory.MakeRset),
                        null
                    },

                    {
                        "QUIT",
                        new State.MakeDelegate(commandFactory.MakeQuit),
                        null
                    },

                    {
                        "HELO",
                        new State.MakeDelegate(commandFactory.MakeHelo),
                        new int?(1)
                    },

                    {
                        "EHLO",
                        new State.MakeDelegate(commandFactory.MakeEhlo),
                        new int?(1)
                    }
                },
                new State(1)
                {
                    {
                        "DBUG",
                        new State.MakeDelegate(commandFactory.MakeDbug),
                        null
                    },

                    {
                        "NOOP",
                        new State.MakeDelegate(commandFactory.MakeNoop),
                        null
                    },

                    {
                        "RSET",
                        new State.MakeDelegate(commandFactory.MakeRset),
                        null
                    },

                    {
                        "QUIT",
                        new State.MakeDelegate(commandFactory.MakeQuit),
                        null
                    },

                    {
                        "HELO",
                        new State.MakeDelegate(commandFactory.MakeHelo),
                        new int?(1)
                    },

                    {
                        "EHLO",
                        new State.MakeDelegate(commandFactory.MakeEhlo),
                        new int?(1)
                    },

                    {
                        "MAIL",
                        new State.MakeDelegate(commandFactory.MakeMail),
                        new int?(3)
                    },

                    {
                        "STARTTLS",
                        new State.MakeDelegate(commandFactory.MakeStartTls),
                        new int?(2)
                    }
                },
                new State(2)
                {
                    {
                        "DBUG",
                        new State.MakeDelegate(commandFactory.MakeDbug),
                        null
                    },

                    {
                        "NOOP",
                        new State.MakeDelegate(commandFactory.MakeNoop),
                        null
                    },

                    {
                        "RSET",
                        new State.MakeDelegate(commandFactory.MakeRset),
                        null
                    },

                    {
                        "QUIT",
                        new State.MakeDelegate(commandFactory.MakeQuit),
                        null
                    },

                    {
                        "AUTH",
                        new State.MakeDelegate(commandFactory.MakeAuth),
                        null
                    },

                    {
                        "HELO",
                        new State.MakeDelegate(commandFactory.MakeHelo),
                        new int?(2)
                    },

                    {
                        "EHLO",
                        new State.MakeDelegate(commandFactory.MakeEhlo),
                        new int?(2)
                    },

                    {
                        "MAIL",
                        new State.MakeDelegate(commandFactory.MakeMail),
                        new int?(3)
                    }
                },
                new State(3)
                {
                    {
                        "DBUG",
                        new State.MakeDelegate(commandFactory.MakeDbug),
                        null
                    },

                    {
                        "NOOP",
                        new State.MakeDelegate(commandFactory.MakeNoop),
                        null
                    },

                    {
                        "RSET",
                        new State.MakeDelegate(commandFactory.MakeRset),
                        null
                    },

                    {
                        "QUIT",
                        new State.MakeDelegate(commandFactory.MakeQuit),
                        null
                    },

                    {
                        "RCPT",
                        new State.MakeDelegate(commandFactory.MakeRcpt),
                        new int?(4)
                    }
                },
                new State(4)
                {
                    {
                        "DBUG",
                        new State.MakeDelegate(commandFactory.MakeDbug),
                        null
                    },

                    {
                        "NOOP",
                        new State.MakeDelegate(commandFactory.MakeNoop),
                        null
                    },

                    {
                        "RSET",
                        new State.MakeDelegate(commandFactory.MakeRset),
                        null
                    },

                    {
                        "QUIT",
                        new State.MakeDelegate(commandFactory.MakeQuit),
                        null
                    },

                    {
                        "RCPT",
                        new State.MakeDelegate(commandFactory.MakeRcpt),
                        null
                    },

                    {
                        "DATA",
                        new State.MakeDelegate(commandFactory.MakeData),
                        new int?(1)
                    }
                }
            };
            _stateTable.Initialize(0);
        }