Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 36284 invoked from network); 1 Jul 2005 15:34:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Jul 2005 15:34:44 -0000 Received: (qmail 46970 invoked by uid 500); 1 Jul 2005 15:34:39 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 46924 invoked by uid 500); 1 Jul 2005 15:34:39 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 46911 invoked by uid 99); 1 Jul 2005 15:34:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2005 08:34:38 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of rian@mit.edu designates 18.7.7.80 as permitted sender) Received: from [18.7.7.80] (HELO biscayne-one-station.mit.edu) (18.7.7.80) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2005 08:34:41 -0700 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by biscayne-one-station.mit.edu (8.12.4/8.9.2) with ESMTP id j61FYWTh022172 for ; Fri, 1 Jul 2005 11:34:34 -0400 (EDT) Received: from tulpius-hilarus.mit.edu (TULPIUS-HILARUS.MIT.EDU [18.7.22.78]) ) by outgoing.mit.edu (8.13.1/8.12.4) with ESMTP id j61FYPU1005957 for ; Fri, 1 Jul 2005 11:34:25 -0400 (EDT) Received: (from nobody@localhost) by tulpius-hilarus.mit.edu (8.12.2+Sun) id j61FYPgk014052; Fri, 1 Jul 2005 11:34:25 -0400 (EDT) Received: from pool-68-160-149-99.bos.east.verizon.net (pool-68-160-149-99.bos.east.verizon.net [68.160.149.99]) (User authenticated as rian@ATHENA.MIT.EDU) by webmail.mit.edu (IMP) with HTTP for ; Fri, 1 Jul 2005 11:34:25 -0400 Message-ID: <1120232065.42c562813064e@webmail.mit.edu> Date: Fri, 1 Jul 2005 11:34:25 -0400 From: Rian A Hunter To: dev@httpd.apache.org Subject: Re: mod_smtpd design. References: <42C4E643.10806@mit.edu> <42C503FA.9000809@algroup.co.uk> <42C547FE.2050708@mit.edu> <42C5522E.7000107@electricjellyfish.net> In-Reply-To: <42C5522E.7000107@electricjellyfish.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.2 X-Originating-IP: 68.160.149.99 X-Spam-Score: 1.801 X-Spam-Level: * (1.801) X-Scanned-By: MIMEDefang 2.42 X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Flag: NO X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Quoting Garrett Rooney : > 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