X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=postlicyd%2Fquery.h;h=eda9320b4a4a147fed42dc16de203f1dfea97902;hb=HEAD;hp=7e9dc7fb23ed8280a4b4e879f1d55c13db0b50ea;hpb=5c6356faa58d3109101e88ecfce207326d89ceab;p=apps%2Fpfixtools.git diff --git a/postlicyd/query.h b/postlicyd/query.h index 7e9dc7f..eda9320 100644 --- a/postlicyd/query.h +++ b/postlicyd/query.h @@ -16,17 +16,20 @@ /* products derived from this software without specific prior written */ /* permission. */ /* */ -/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND */ -/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE */ -/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ -/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS */ -/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR */ -/* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF */ -/* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS */ -/* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) */ -/* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF */ -/* THE POSSIBILITY OF SUCH DAMAGE. */ +/* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS */ +/* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */ +/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ +/* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY */ +/* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL */ +/* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS */ +/* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ +/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, */ +/* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */ +/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */ +/* POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/* Copyright (c) 2006-2008 the Authors */ +/* see AUTHORS and source files for details */ /******************************************************************************/ /* @@ -56,44 +59,44 @@ enum smtp_state { SMTP_UNKNOWN, }; -extern const char *smtp_state_names[SMTP_count]; +extern const static_str_t smtp_state_names[SMTP_count]; /* \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 *reverse_client_name; - const char *instance; + static_str_t helo_name; + static_str_t queue_id; + static_str_t sender; + static_str_t recipient; + static_str_t recipient_count; + static_str_t client_address; + static_str_t client_name; + static_str_t reverse_client_name; + static_str_t instance; /* useful data extracted from previous ones */ - const char *sender_domain; - const char *recipient_domain; + static_str_t sender_domain; + static_str_t recipient_domain; /* 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 *ccert_fingerprint; + static_str_t sasl_method; + static_str_t sasl_username; + static_str_t sasl_sender; + static_str_t size; + static_str_t ccert_subject; + static_str_t ccert_issuer; + static_str_t ccert_fingerprint; /* postfix 2.3+ */ - const char *encryption_protocol; - const char *encryption_cipher; - const char *encryption_keysize; - const char *etrn_domain; + static_str_t encryption_protocol; + static_str_t encryption_cipher; + static_str_t encryption_keysize; + static_str_t etrn_domain; /* postfix 2.5+ */ - const char *stress; + static_str_t stress; const char *eoq; } query_t; @@ -109,12 +112,12 @@ 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); +const static_str_t *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); +const static_str_t *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.