You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by so...@apache.org on 2005/08/31 19:43:08 UTC

svn commit: r265539 - in /httpd/mod_smtpd/trunk: Makefile.in smtp_core.c smtp_filters.c smtp_filters.h smtp_protocol.c

Author: soc-rian
Date: Wed Aug 31 10:43:03 2005
New Revision: 265539

URL: http://svn.apache.org/viewcvs?rev=265539&view=rev
Log:
moved filters out of smtp_core.c and into smtp_filters.c

Added:
    httpd/mod_smtpd/trunk/smtp_filters.c
    httpd/mod_smtpd/trunk/smtp_filters.h
Modified:
    httpd/mod_smtpd/trunk/Makefile.in
    httpd/mod_smtpd/trunk/smtp_core.c
    httpd/mod_smtpd/trunk/smtp_protocol.c

Modified: httpd/mod_smtpd/trunk/Makefile.in
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/Makefile.in?rev=265539&r1=265538&r2=265539&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/Makefile.in (original)
+++ httpd/mod_smtpd/trunk/Makefile.in Wed Aug 31 10:43:03 2005
@@ -2,7 +2,7 @@
 CFLAGS=-Wall
 APXSFLAGS=-L`$(APXS) -q LIBDIR`
 LIBS=-lapreq2
-SMTPD_SRC=smtp_core.c smtp_protocol.c smtp_util.c
+SMTPD_SRC=smtp_core.c smtp_protocol.c smtp_util.c smtp_filters.c
 
 all: mod_smtpd.la
 

Modified: httpd/mod_smtpd/trunk/smtp_core.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_core.c?rev=265539&r1=265538&r2=265539&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_core.c (original)
+++ httpd/mod_smtpd/trunk/smtp_core.c Wed Aug 31 10:43:03 2005
@@ -35,9 +35,9 @@
 
 #include "mod_smtpd.h"
 #include "smtp.h"
+#include "smtp_filters.h"
 
 module AP_MODULE_DECLARE_DATA smtpd_module;
-ap_filter_rec_t *smtpd_smtp_input_filter_handle;
 
 static apr_hash_t *smtpd_handlers;
 
@@ -141,33 +141,6 @@
     str->helo = NULL;
     str->headers = apr_table_make(str->p, 5);
     str->input_filters = scr->c->input_filters;
-}
-
-apr_status_t smtpd_smtp_filter(ap_filter_t *f, apr_bucket_brigade *b,
-                               ap_input_mode_t mode, apr_read_type_e block,
-                               apr_off_t readbytes)
-{
-    apr_bucket_brigade *old_bb = f->ctx;
-
-    /* if our input brigade is empty, just go on */
-    if (APR_BRIGADE_EMPTY(old_bb))
-        return ap_get_brigade(f->next, b, mode, block, readbytes);
-    
-    if (mode == AP_MODE_GETLINE) {
-        apr_off_t bb_len;
-        apr_brigade_split_line(b, old_bb, block, 1000);
-        /* if we have one last empty bucket
-           our brigade is empty */
-        apr_brigade_length(old_bb, 1, &bb_len);
-        if (!bb_len)
-            apr_brigade_cleanup(old_bb);
-    }
-    /* XXX: since we are only using AP_MODE_GETLINE in mod_smtpd
-       the other read types are ignored, but this can be robustified */
-    else {
-        APR_BRIGADE_CONCAT(b, old_bb);
-    }
-    return APR_SUCCESS;
 }
 
 /* private methods */

Added: httpd/mod_smtpd/trunk/smtp_filters.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_filters.c?rev=265539&view=auto
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_filters.c (added)
+++ httpd/mod_smtpd/trunk/smtp_filters.c Wed Aug 31 10:43:03 2005
@@ -0,0 +1,47 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "util_filter.h"
+#include "apr_buckets.h"
+
+ap_filter_rec_t *smtpd_smtp_input_filter_handle;
+
+apr_status_t smtpd_smtp_filter(ap_filter_t *f, apr_bucket_brigade *b,
+                               ap_input_mode_t mode, apr_read_type_e block,
+                               apr_off_t readbytes)
+{
+    apr_bucket_brigade *old_bb = f->ctx;
+
+    /* if our input brigade is empty, just go on */
+    if (APR_BRIGADE_EMPTY(old_bb))
+        return ap_get_brigade(f->next, b, mode, block, readbytes);
+    
+    if (mode == AP_MODE_GETLINE) {
+        apr_off_t bb_len;
+        apr_brigade_split_line(b, old_bb, block, 1000);
+        /* if we have one last empty bucket
+           our brigade is empty */
+        apr_brigade_length(old_bb, 1, &bb_len);
+        if (!bb_len)
+            apr_brigade_cleanup(old_bb);
+    }
+    /* XXX: since we are only using AP_MODE_GETLINE in mod_smtpd
+       the other read types are ignored, but this can be robustified */
+    else {
+        APR_BRIGADE_CONCAT(b, old_bb);
+    }
+    return APR_SUCCESS;
+}

Added: httpd/mod_smtpd/trunk/smtp_filters.h
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_filters.h?rev=265539&view=auto
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_filters.h (added)
+++ httpd/mod_smtpd/trunk/smtp_filters.h Wed Aug 31 10:43:03 2005
@@ -0,0 +1,38 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SMTP_FILTERS_H
+#define SMTP_FILTERS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern ap_filter_rec_t *smtpd_smtp_input_filter_handle;
+apr_status_t smtpd_smtp_filter(ap_filter_t *f, apr_bucket_brigade *b,
+                               ap_input_mode_t mode, apr_read_type_e block,
+                               apr_off_t readbytes);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SMTP_FILTERS_H */
+
+
+
+

Modified: httpd/mod_smtpd/trunk/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/smtp_protocol.c?rev=265539&r1=265538&r2=265539&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/smtp_protocol.c Wed Aug 31 10:43:03 2005
@@ -35,9 +35,9 @@
 
 #include "smtp.h"
 #include "mod_smtpd.h"
+#include "smtp_filters.h"
 
 extern module AP_MODULE_DECLARE_DATA smtpd_module;
-extern ap_filter_rec_t *smtpd_smtp_input_filter_handle;
 
 inline static int smtpd_handle_unrecognized_command(smtpd_conn_rec *scr,
                                                     smtpd_return_data *in_data,