httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rian A Hunter <r...@MIT.EDU>
Subject Re: mod_smtpd design.
Date Fri, 01 Jul 2005 15:34:25 GMT
Quoting Garrett Rooney <rooneg@electricjellyfish.net>:
> Rian Hunter wrote:
> > type misc_smtp_handler(request_rec *r) {
> >     smtpd_request_rec *smtp_data;
> > 
> >     if (strncmp("http", r->protocol_name, 4)) {
> >         // decline to handle, this module doesn't handle
> >         // http requests.
> >     }
> >     //then get smtpd specific data
> >     smtp_data = get_smtpd_request(r);
> > 
> >     // do some handlin'
> > }
> > 
> > The advantage to this approach is a less bulky (but more all 
> > encompassing) request_rec with support for an arbitrary amount of 
> > protocols and protocol specific data.
> 
> Rather than inserting dozens of strcmps all throught the processing, I'd 
> prefer to store an int identifying the protocol, and just have a simple 
> compare.  No reason to burn CPU on the strcmp if we don't have to.
> 
> -garrett
> 

The reason I suggested a strcmp is that it gives freedom to module developers to
set and implement any protocol they like. Doing integer comparisons would
require us to maintain a list of "official" integer->protocol mappings, but
there may be other ways to approach it without having that constraint. Maybe we
can use the official iana port description list to specifiy protocols like 80
means http, 25 means smtp, 143 means imap etc.
-rian



Mime
View raw message