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 2006/01/02 23:09:51 UTC
svn commit: r365451 - in /httpd/mod_smtpd/trunk/src: smtp.h smtp_core.c
Author: soc-rian
Date: Mon Jan 2 14:09:48 2006
New Revision: 365451
URL: http://svn.apache.org/viewcvs?rev=365451&view=rev
Log:
Changed from optional hooks to regular hooks.
Modified:
httpd/mod_smtpd/trunk/src/smtp.h
httpd/mod_smtpd/trunk/src/smtp_core.c
Modified: httpd/mod_smtpd/trunk/src/smtp.h
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/src/smtp.h?rev=365451&r1=365450&r2=365451&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/src/smtp.h (original)
+++ httpd/mod_smtpd/trunk/src/smtp.h Mon Jan 2 14:09:48 2006
@@ -24,46 +24,6 @@
extern "C" {
#endif
-/**
- * Implement an optional hook that runs until one of the functions
- * returns something other than OK or DECLINE.
- *
- * @param ns The namespace prefix of the hook functions
- * @param link The linkage declaration prefix of the hook
- * @param ret The type of the return value of the hook
- * @param ret The type of the return value of the hook
- * @param name The name of the hook
- * @param args_decl The declaration of the arguments for the hook
- * @param args_use The names for the arguments for the hook
- * @param ok Success value
- * @param decline Decline value
- */
-#define APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(ns,link,ret,name,args_decl,args_use,ok,decline) \
-link##_DECLARE(ret) ns##_run_##name args_decl \
- { \
- ns##_LINK_##name##_t *pHook; \
- int n; \
- ret rv; \
- ret endrv = decline; \
- apr_array_header_t *pHookArray=apr_optional_hook_get(#name); \
-\
- if(!pHookArray) \
- return endrv; \
-\
- pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \
- for(n=0 ; n < pHookArray->nelts ; ++n) \
- { \
- rv=(pHook[n].pFunc)args_use; \
-\
- if(rv != ok && rv != decline) \
- return rv; \
-\
- if(rv == ok) \
- endrv = ok; \
- } \
- return endrv; \
- }
-
/* SMTP handlers registration */
#define HANDLER_PROTOTYPE smtpd_conn_rec *scr, char *buffer, \
smtpd_return_data *in_data, void *data
Modified: httpd/mod_smtpd/trunk/src/smtp_core.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/src/smtp_core.c?rev=365451&r1=365450&r2=365451&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/src/smtp_core.c (original)
+++ httpd/mod_smtpd/trunk/src/smtp_core.c Mon Jan 2 14:09:48 2006
@@ -32,6 +32,7 @@
#include "apr_strings.h"
#include "apr_pools.h"
#include "apr_network_io.h"
+#include "apr_hooks.h"
#include "mod_smtpd.h"
#include "smtp.h"
@@ -43,87 +44,103 @@
static apr_hash_t *smtpd_handlers;
+APR_HOOK_STRUCT(
+ APR_HOOK_LINK(unrecognized_command)
+ APR_HOOK_LINK(connect)
+ APR_HOOK_LINK(reset_transaction)
+ APR_HOOK_LINK(helo)
+ APR_HOOK_LINK(ehlo)
+ APR_HOOK_LINK(mail)
+ APR_HOOK_LINK(rcpt)
+ APR_HOOK_LINK(vrfy)
+ APR_HOOK_LINK(quit)
+ APR_HOOK_LINK(data)
+ APR_HOOK_LINK(data_post)
+ APR_HOOK_LINK(queue)
+ APR_HOOK_LINK(headers_parsed)
+ )
+
/* Implement 'smtpd_run_unrecognized_command'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode,
- unrecognized_command,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in,
- char *command, char *data),
- (scr, in, command, data),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode,
+ unrecognized_command,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in,
+ char *command, char *data),
+ (scr, in, command, data),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_connect'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode, connect,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in),
- (scr, in),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, connect,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in),
+ (scr, in),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_reset_transaction'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode,
- reset_transaction,
- (smtpd_conn_rec *scr),
- (scr),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode,
+ reset_transaction,
+ (smtpd_conn_rec *scr),
+ (scr),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_helo'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode, helo,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in, char *str),
- (scr, in, str),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, helo,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in, char *str),
+ (scr, in, str),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_ehlo'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode, ehlo,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in, char *str),
- (scr, in, str),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, ehlo,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in, char *str),
+ (scr, in, str),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_mail'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode, mail,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in, char *str),
- (scr, in, str),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, mail,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in, char *str),
+ (scr, in, str),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_rcpt'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode, rcpt,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in, char *str),
- (scr, in, str),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, rcpt,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in, char *str),
+ (scr, in, str),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_vrfy'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode, vrfy,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in, char *str),
- (scr, in, str),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, vrfy,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in, char *str),
+ (scr, in, str),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_quit'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode, quit,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in),
- (scr, in),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, quit,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in),
+ (scr, in),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_data'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode, data,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in),
- (scr, in),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, data,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in),
+ (scr, in),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_data_post'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode,
- data_post,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in),
- (scr, in),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode,
+ data_post,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in),
+ (scr, in),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_queue'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode, queue,
- (smtpd_conn_rec *scr,
- smtpd_return_data *in),
- (scr, in),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode, queue,
+ (smtpd_conn_rec *scr,
+ smtpd_return_data *in),
+ (scr, in),
+ SMTPD_OK, SMTPD_DECLINED);
/* Implement 'smtpd_run_headers_parsed'. */
-APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL_MOD(smtpd, SMTPD, smtpd_retcode,
- headers_parsed,
- (smtpd_conn_rec *scr),
- (scr),
- SMTPD_OK, SMTPD_DECLINED);
+APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(smtpd, SMTPD, smtpd_retcode,
+ headers_parsed,
+ (smtpd_conn_rec *scr),
+ (scr),
+ SMTPD_OK, SMTPD_DECLINED);
apr_hash_t *smtpd_get_handlers()
{