You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Norman Maurer <nm...@byteaction.de> on 2006/06/19 07:42:51 UTC

Proposal: SMTPServer api and add more support for be pluggable ( like mailets)

Hi guys,

when working on the greylist handler again i get stuck on the momentan
smtpserver api. It works with more then one handler per command, but how
it works is not the best thing anyway. So i started to think about how
we could make it more pluggable for developers to add new features of
the needed commandHandlers.

After  a while i thought about qpsmtpd (http://smtpd.develooper.com/)
and how it get managed there ( we used this in the past). And for me it
seems a very good api!. So maybe we could do some simalour. So here is
what i thought about in detail:


This whould be the simplies configuration:

<handler command="RCPT" class="org.apache.james.smtpserver.rcpt.RcptCmdHandler">
    <response_class ="org.org.apache.james.smtpserver.core.ResponseHandler">
</handler>

Configuration with optinal filters:

<handler command="RCPT" class="org.apache.james.smtpserver.rcpt.RcptCmdHandler">
    <filter_class ="org.apache.james.smtpserver.rcpt.GreylistHandler">
    <filter_class ="org.apache.james.smtpserver.rcpt.MaxRcptHandler">
        <maxRcpt> 2 </maxRcpt>
    <filter_class ="org.apache.james.smtpserver.rcpt.TarpitHandler">
        <tarpitRcptCount> 0 </tarpitRcptCount>
        <tarpitSleepTime> 5000 </tarpitSleepTime>    
    <response_class ="org.apache.james.smtpserver.core.ResponseHandler">
</handler>


And this is how it could work:

org.apache.james.smtpserver.rcpt.RcptCmdHandler:
This class do exact the same thing it does yet. The only diffrence
should be that it set the response string in the STATE_MAP and not write
it by self or something simular.

org.apache.james.smtpserver.rcpt.GreylistHandler:

Check if no blocking responseString is allready set, if noone is set it
get called. Otherwise it skip the handler.


org.apache.james.smtpserver.rcpt.MaxRcptHandler:

See Above.


org.apache.james.smtpserver.rcpt.TarpitHandler:

See Above.

org.apache.james.smtpserver.core.ResponseHandler:

This class get called as the last. It react based on the STATE_MAP. 


All filter_classes should be extend an abstract class which over the
needed core functions and the to implementate methods like the class
CommandHandler allready offer.


This is what i had in my mind last night. Any Feedback questions are
very welcome.

bye
Norman

Ps: The good think is if we add a hardcoded smtpHandlerChain like
Stefano allready did for pop3Handler we could be change such thinks
without break most configs.