]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: sample: Define new struct sample_storage
authorThierry FOURNIER <tfournier@exceliance.fr>
Tue, 26 Nov 2013 09:21:51 +0000 (10:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 2 Dec 2013 22:31:33 +0000 (23:31 +0100)
This struct is used to store a sample constant. The size of this
struct is less than the struct sample. This struct only contains
a constant and doesn't need the "ctx" nor the "flags".

include/types/sample.h

index 2f211978d4929f2e442f48d6367a457cc704d5c7..4c1a244826a6850fea4349388e8fccbfff3f4483 100644 (file)
@@ -236,6 +236,18 @@ struct sample {
        union smp_ctx ctx;
 };
 
+/* Used to store sample constant */
+struct sample_storage {
+       int type;                 /* SMP_T_* */
+       union {
+               unsigned int    uint;  /* used for unsigned 32bits integers and booleans */
+               int             sint;  /* used for signed 32bits integers */
+               struct in_addr  ipv4;  /* used for ipv4 addresses */
+               struct in6_addr ipv6;  /* used for ipv6 addresses */
+               struct chunk    str;   /* used for char strings or buffers */
+       } data;                        /* sample data */
+};
+
 /* Descriptor for a sample conversion */
 struct sample_conv {
        const char *kw;                           /* configuration keyword  */