THE IMAP HALF OF StreamSec.Mail.Transport, and the exact counterpart of
StreamSec.Mail.POP3Transport. Everything that moves octets, performs the
handshake, bounds a peer and reaps a thread is in that unit; what is here is
what is IMAP and could not honestly be anything else:
- the ports, 143 and 993;
- RFC 3501 sec.5.4's THIRTY-minute floor for the autologout timer, which is
not RFC 1939's ten and not RFC 5321's five;
- admission caps sized for a client that legitimately opens SEVERAL
connections at once, which POP3's are not;
- the four per-protocol classes, because a listener IS its port.
IDLE IS WHY THE TIMERS ARE WHAT THEY ARE. A client in IDLE sends nothing for
as long as the server lets it, and RFC 2177 tells it to re-issue at least
every 29 minutes. An idle bound below that would drop a perfectly healthy
connection at a moment when the client is doing exactly what it was told, so
1800 seconds is a FLOOR here rather than a default anybody should lower.
The session bound is a day, not the half hour POP3 uses: a POP3 session holds
an exclusive maildrop lock and a long one is a denial of service against the
account's owner, while an IMAP session holds nothing anybody else needs.
THE INTERFACES DESCEND AND CARRY THEIR OWN GUIDs, so an IMAP channel does not
satisfy iPop3Channel and vice versa. Delphi's QueryInterface does not walk
interface ancestry, which is what makes that separation real rather than
decorative.Feature notes: Mail subsystem notes (SMTP / POP3 / IMAP)
inherits from eMailTransportError
(no public members)
(no public members)
inherits from iMailChannel
What an IMAP conversation sees of its transport. No members of its own - the contract is the base's; this exists so the type an IMAP handler is given says IMAP, and so a POP3 channel cannot satisfy it.
(no public members)
inherits from iMailConnectionHandler
(no public members)
WHAT IDLE NEEDS OF THE DRIVER: a call on the connection's own thread while the peer is silent, which is the only moment new mail can be pushed to a client that is waiting for it (RFC 2177). A SEPARATE INTERFACE rather than a member of iImapConnectionHandler, so that interface - and every handler already written against it - stays as it is; the driver asks for this one and does nothing when a handler does not offer it.
procedure IdleRound;
inherits from iMailConnectionFactory
Mints a handler per accepted IMAP connection; the server component implements it. Both parameters typed for the same reason the POP3 factory types its own - a neutral signature would put an interface cast and an unchecked class cast on the accept path.
function NewHandler(const aChannel: iImapChannel; aOptions: tImapListenerOptions): iImapConnectionHandler;
inherits from tMailChannel
implements iImapChannel
ONE IMAP CONNECTION'S OCTETS. Like the POP3 channel it adds nothing yet, and for the same reason it will not stay that way: FETCH BODY[] pushes whole messages through the blocked-write path, and an APPEND pulls one the other way, so this is where a cumulative bound belongs when one is added.
(no public members)
inherits from tMailListenerOptions
WHAT AN IMAP PORT IS, on top of what a bound socket is.
constructor Create(aOwner: TPersistent); override;
property MaxConnections default cImapTransportMaxConnections;
property MaxConnectionsPerPeer default cImapTransportMaxPerPeer;
property IdleTimeoutSeconds default cImapTransportIdleSeconds;
property SessionTimeoutSeconds default cImapTransportSessionSeconds;
property PreambleIdleSeconds default cImapTransportPreambleIdleSeconds;
property PreambleSessionSeconds default cImapTransportPreambleSessionSeconds;
property PreamblePressurePercent default cImapTransportPreamblePressurePercent;
(no public members)
inherits from tMailConnectionThread
The IMAP driver. It overrides three things: who answers a connection, what this protocol calls the upgrade in a log line - IMAP spells it STARTTLS, which POP3 does not, and a log that says STLS sends somebody to the wrong RFC - and the idle round, which IDLE is the reason the base has at all.
(no public members)
inherits from tMailListener
ONE BOUND IMAP PORT.
constructor Create(aOptions: tImapListenerOptions; const aFactory: iImapConnectionFactory; aEngine: TsmSimpleTLSInternalServer); reintroduce;
property Options: tImapListenerOptions read fImapOptions;
property Factory: iImapConnectionFactory read fImapFactory;