summaryrefslogtreecommitdiff
path: root/include/haproxy/sample.h
Commit message (Collapse)AuthorAgeFilesLines
* BUILD: sample: use __fallthrough in smp_is_rw() and smp_dup()Willy Tarreau2022-11-141-2/+2
| | | | | This avoids three build warnings when preprocessing happens before compiling with gcc >= 7.
* MINOR: sample: list registered sample converter functionsWilly Tarreau2022-03-291-0/+1
| | | | | | | Similar to the sample fetch keywords, let's also list the converter keywords. They're much simpler since there's no compatibility matrix. Instead the input and output types are listed. This is called by dump_registered_keywords() for the "cnv" keywords class.
* MINOR: samples: add a function to list register sample fetch keywordsWilly Tarreau2022-03-291-0/+1
| | | | | | | New function smp_dump_fetch_kw lists registered sample fetch keywords with their compatibility matrix, mandatory and optional argument types, and output types. It's called from dump_registered_keywords() with class "smp".
* MINOR: sample: provide a generic var-to-sample conversion functionWilly Tarreau2021-10-071-0/+1
| | | | | | We're using variable-to-sample conversion at least 4 times in the code, two of which are bogus. Let's introduce a generic conversion function that performs the required checks.
* CLEANUP: sample: uninline sample_conv_var2smp_str()Willy Tarreau2021-10-071-0/+1
| | | | | There's no reason to limit this one to this file, it could be used in other contexts.
* CLEANUP: sample: rename sample_conv_var2smp() to *_sintWilly Tarreau2021-10-071-0/+1
| | | | | | This one only handles integers, contrary to its sibling with the suffix _str that only handles strings. Let's rename it and uninline it since it may well be used from outside.
* MINOR: sample: make smp_resolve_args() return an allocate error messageWilly Tarreau2021-03-261-1/+1
| | | | | | | For now smp_resolve_args() complains on stderr via ha_alert(), but if we want to make it a bit more dynamic, we need it to return errors in an allocated message. Let's pass it an error pointer and have it fill it. On return we indent the output if it contains more than one line.
* BUG/MINOR: sample: Always consider zero size string samples as unsafeChristopher Faulet2021-02-181-2/+2
| | | | | | | | | | | | | | | | smp_is_safe() function is used to be sure a sample may be safely modified. For string samples, a test is performed to verify if there is a null-terminated byte. If not, one is added, if possible. It means if the sample is not const and if there is some free space in the buffer, after data. However, we must not try to read the null-terminated byte if the string sample is too long (data >= size) or if the size is equal to zero. This last test was not performed. Thus it was possible to consider a string sample as safe by testing a byte outside the buffer. Now, a zero size string sample is always considered as unsafe and is duplicated when smp_make_safe() is called. This patch must be backported in all stable versions.
* CLEANUP: include: tree-wide alphabetical sort of include filesWilly Tarreau2020-06-111-1/+1
| | | | | | This patch fixes all the leftovers from the include cleanup campaign. There were not that many (~400 entries in ~150 files) but it was definitely worth doing it as it revealed a few duplicates.
* REORG: include: move stick_table.h to haproxy/stick_table{,-t}.hWilly Tarreau2020-06-111-1/+1
| | | | | | | | The stktable_types[] array declaration was moved to the main file as it had nothing to do in the types. A few declarations were reordered in the types file so that defines were before the structs. Thread-t was added since there are a few __decl_thread(). The loss of peers.h revealed that cfgparse-listen needed it.
* REORG: include: move sample.h to haproxy/sample{,-t}.hWilly Tarreau2020-06-111-0/+177
This one is particularly tricky to move because everyone uses it and it depends on a lot of other types. For example it cannot include arg-t.h and must absolutely only rely on forward declarations to avoid dependency loops between vars -> sample_data -> arg. In order to address this one, it would be nice to split the sample_data part out of sample.h.