X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=postlicyd%2Fquery.h;h=61f894d24bf811e7181ebcfbd7ce4f9315416872;hb=43cbaab1fc66139d3dfd87a2f8b6be5d906ee317;hp=86e41ba1072e85e27e5509056bf8892078c3cf60;hpb=ae0c2eb5d2ea501fd9e458fc138696c268a14569;p=apps%2Fpfixtools.git diff --git a/postlicyd/query.h b/postlicyd/query.h index 86e41ba..61f894d 100644 --- a/postlicyd/query.h +++ b/postlicyd/query.h @@ -39,6 +39,7 @@ #include "mem.h" #include "common.h" +#include "policy_tokens.h" enum smtp_state { SMTP_CONNECT, @@ -102,4 +103,21 @@ typedef struct query_t { __attribute__((nonnull(1,2))) bool query_parse(query_t *query, char *p); +/** Return the value of the field with the given name. + */ +__attribute__((nonnull(1,2))) +const char *query_field_for_name(const query_t *query, const char *name); + +/** Returns the value of the field with the given id. + */ +__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