X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=postfix.h;h=4d038e8d9c065456211a6d49c7107837293d54b6;hb=6a966ebc32006b64216715314ce21a506ef1f7c4;hp=029991c4bb34a4bc261d5a8ae819c35c231a23eb;hpb=b1315f7af90c4d8047cf0c8f3c0a00b703676f84;p=apps%2Fpfixtools.git diff --git a/postfix.h b/postfix.h index 029991c..4d038e8 100644 --- a/postfix.h +++ b/postfix.h @@ -1,5 +1,5 @@ /******************************************************************************/ -/* postlicyd: a postfix policy daemon with a lot of features */ +/* pfixtools: a collection of postfix related tools */ /* ~~~~~~~~~ */ /* ________________________________________________________________________ */ /* */ @@ -36,8 +36,70 @@ #ifndef POSTLICYD_POSTFIX_H #define POSTLICYD_POSTFIX_H -#include "job.h" +#include -extern task_t task_postfix; +#include "buffer.h" + +enum smtp_state { + SMTP_UNKNOWN, + SMTP_CONNECT, + SMTP_EHLO, + SMTP_HELO = SMTP_EHLO, + SMTP_MAIL, + SMTP_RCPT, + SMTP_DATA, + SMTP_END_OF_MESSAGE, + SMTP_VRFY, + SMTP_ETRN, +}; + +/* \see http://www.postfix.org/SMTPD_POLICY_README.html */ +typedef struct query_t { + unsigned state : 4; + unsigned esmtp : 1; + + const char *helo_name; + const char *queue_id; + const char *sender; + const char *recipient; + const char *recipient_count; + const char *client_address; + const char *client_name; + const char *rclient_name; + const char *instance; + + /* postfix 2.2+ */ + const char *sasl_method; + const char *sasl_username; + const char *sasl_sender; + const char *size; + const char *ccert_subject; + const char *ccert_issuer; + const char *ccsert_fingerprint; + + /* postfix 2.3+ */ + const char *encryption_protocol; + const char *encryption_cipher; + const char *encryption_keysize; + const char *etrn_domain; + + buffer_t data; +} query_t; + +static inline query_t *query_init(query_t *rq) { + memset(rq, 0, offsetof(query_t, data)); + buffer_init(&rq->data); + return rq; +} +static inline query_t *query_reset(query_t *rq) { + memset(rq, 0, offsetof(query_t, data)); + buffer_reset(&rq->data); + return rq; +} +static inline void query_wipe(query_t *rq) { + buffer_wipe(&rq->data); +} +DO_NEW(query_t, query); +DO_DELETE(query_t, query); #endif