X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=postlicyd%2Fquery.h;h=9dabfe0ca631c3e053785391b2ffeacf8c2f3ef1;hb=8950d42993b7148718f712b8d7e77aaa21ef14ce;hp=1443d65e107cbad3b65a6fc14dcec674dd6d8df8;hpb=e327d3786ba0371eaaff8e6ba0fe3fc39f095ae2;p=apps%2Fpfixtools.git diff --git a/postlicyd/query.h b/postlicyd/query.h index 1443d65..9dabfe0 100644 --- a/postlicyd/query.h +++ b/postlicyd/query.h @@ -55,6 +55,8 @@ enum smtp_state { SMTP_UNKNOWN, }; +extern const char *smtp_state_names[SMTP_count]; + /* \see http://www.postfix.org/SMTPD_POLICY_README.html */ typedef struct query_t { unsigned state : 4; @@ -113,4 +115,11 @@ const char *query_field_for_name(const query_t *query, const char *name); __attribute__((nonnull)) const char *query_field_for_id(const query_t *query, postlicyd_token id); +/** Formats the given string by replacing ${field_name} with the content + * of the query. + * Unknown and empty fields are filled with (null). + */ +__attribute__((nonnull(3))) +ssize_t query_format(char *dest, size_t len, const char* fmt, const query_t *query); + #endif