#ifndef OverbyteIcsSslSmtpServ1H
#define OverbyteIcsSslSmtpServ1H

#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.ExtCtrls.hpp>
#include <Vcl.Forms.hpp>

#include "OverbyteIcsWndControl.hpp"
#include "OverbyteIcsWSocket.hpp"
#include "OverbyteIcsWSocketS.hpp"
#include "OverbyteIcsSmtpSrv.hpp"
#include "OverbyteIcsSslBase.hpp"
#include "OverbyteIcsTypes.hpp"

class TSmtpSslSrvForm : public TForm
{
__published:
    TPanel *ButtonPanel;
    TMemo *Log;
    TEdit *PrefDnsServer;
    TLabel *Label1;
    TMemo *PrefEmailAccs;
    TLabel *Label2;
    TEdit *PrefSpoolDir;
    TCheckBox *PrefAddRecvHdrs;
    TLabel *Label3;
    TCheckBox *PrefAddEnvHdrs;
    TButton *doStart;
    TButton *doStop;
    TButton *doExit;
    TCheckBox *PrefAllowRelay;
    TMemo *PrefAliasAccs;
    TLabel *Label4;
    TCheckBox *PrefAddReplayHdrs;
    TPanel *ToolsPanel;
    TLabel *Label5;
    TLabel *Label7;
    TLabel *Label6;
    TEdit *CertFileEdit;
    TEdit *PrivKeyFileEdit;
    TEdit *PassPhraseEdit;
    TCheckBox *PrefAuthTls;
    TLabel *Label8;
    TEdit *ServIpAddr;
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall FormDestroy(TObject *Sender);
    void __fastcall doStartClick(TObject *Sender);
    void __fastcall doStopClick(TObject *Sender);
    void __fastcall doExitClick(TObject *Sender);
    void __fastcall FormShow(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);

private:
    String FIniFileName;
    bool FInitialized;
    TSslSmtpServer *FSmtpServer;
    void __fastcall LogClient(TSmtpSrvCli *Cli, const String &Text);
    void __fastcall SmtpServer1Auth(TObject *Sender, TObject *Client, const String UserName, String &Password, TSmtpMailAction &Action, String &Reason);
    void __fastcall SmtpServer1AuthPW(TObject *Sender, TObject *Client, const String UserName, String &Password, TSmtpMailAction &Action, String &Reason);
    void __fastcall SmtpServer1Connect(TObject *Sender, TObject *Client, const String IpAddr, TSmtpMailAction &Action, String &Reason);
    void __fastcall SmtpServer1DataEnd(TObject *Sender, TObject *Client, TSmtpMailAction &Action, String &Reason);
    void __fastcall SmtpServer1DataStart(TObject *Sender, TObject *Client, TSmtpMailAction &Action, String &Reason);
    void __fastcall SmtpServer1Disconnect(TObject *Sender, TObject *Client, WORD Error);
    void __fastcall SmtpServer1Exception(TObject *Sender, Exception *E);
    void __fastcall SmtpServer1Command(TObject *Sender, TObject *Client, const String Command);
    void __fastcall SmtpServer1Response(TObject *Sender, TObject *Client, const String Response);
    void __fastcall SmtpServer1ServerStopped(TObject *Sender);
    void __fastcall SmtpServer1ServerStarted(TObject *Sender);
    void __fastcall SmtpServer1SslHandshakeDone(TObject *Sender, WORD ErrCode, TX509Base *PeerCert, bool &Disconnect);
    void __fastcall SmtpServer1SslVerifyPeer(TObject *Sender, int &Ok, TX509Base *Cert);
    void __fastcall SmtpServer1Display(TObject *Sender, const String Msg);

public:
    __fastcall TSmtpSslSrvForm(TComponent *Owner);
};

extern PACKAGE TSmtpSslSrvForm *SmtpSslSrvForm;

#endif
