Move some code.
[apps/pfixtools.git] / postlicyd / query.h
index 87ee01e..1443d65 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "mem.h"
 #include "common.h"
+#include "policy_tokens.h"
 
 enum smtp_state {
     SMTP_CONNECT,
@@ -94,18 +95,6 @@ typedef struct query_t {
     const char *eoq;
 } query_t;
 
-static inline query_t *query_new(void)
-{
-    return p_new(query_t, 1);
-}
-
-static inline void query_delete(query_t **query)
-{
-    if (*query) {
-        p_delete(query);
-    }
-}
-
 /** Parse the content of the text to fill the query.
  * The text pointed by \p p is segmented (and modified to add
  * a \0 at the end of each segment) and used to fill the query
@@ -114,4 +103,14 @@ static inline void query_delete(query_t **query)
 __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);
+
 #endif