Exemple #1
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);
        }
Exemple #2
0
 internal StateTable(SmtpCommandFactory commandFactory)
 {
     _commandFactory = commandFactory;
 }