◆ EVIDENCE_KEY_VALUE_MEMBERS
#define EVIDENCE_KEY_VALUE_MEMBERS struct fiftyone_degrees_array_fiftyoneDegreesEvidenceKeyValuePair_t* pseudoEvidence; |
The pseudo evidence.
\r\n
Contains key value pairs as evidence to be processed.
An Evidence structure contains key value pairs to be parsed and processed by an engine.
Items of evidence (e.g. an HTTP header) are added to the structure. The values are then parsed based on the key prefix. In the case of an HTTP header the string would simply be copied, but other types can require further parsing. Evidence items can then be accessed by engines in their parsed form, enabling simpler processing.
An evidence structure is created using the fiftyoneDegreesEvidenceCreate method. This takes the maximum number of evidence items which the structure can store.
Evidence keys contain a prefix and the key within that prefix. For example, the key header.user-agent
has the prefix header
indicating that the second part of the key is an HTTP header name (user-agent
).
Prefixes are stored as an enum value with the type of fiftyoneDegreesEvidencePrefix. The enum value of the prefix can be found for a key string by using the fiftyoneDegreesEvidenceMapPrefix method which takes the key string as an argument, and returns the enum value.
Prefix values are defined by their bit positions such that multiple prefixes can be filtered when iterating with the fiftyoneDegreesEvidenceIterate method. For example, to iterate over all HTTP headers and all query parameters two prefixes can be used in combination like FIFTYONE_DEGREES_EVIDENCE_HTTP_HEADER_STRING | FIFTYONE_DEGREES_EVIDENCE_QUERY
.
An item of evidence is added to the evidence structure using the fiftyoneDegreesEvidenceAddString method. This then parses the string value it is provided into the correct type which is determined by the prefix.
The evidence a particular evidence structure can be iterated over using the fiftyoneDegreesEvidenceIterate method. This takes a prefix filter (as described in the Prefixes section above), and a callback method which is called for each evidence item which matches the filter. The number of matching items is then returned.
An evidence structure is freed using the fiftyoneDegreesEvidenceFree method. It is important to note that this method does NOT free the original values which are referenced by the structure.
struct | fiftyoneDegreesEvidencePrefixMap
Map of prefix strings to prefix enum values. More...
|
struct | fiftyoneDegreesEvidenceKeyValuePair
Evidence key value pair structure which combines the prefix, key and value. More...
|
struct | fiftyoneDegreesEvidenceKeyValuePairArray
Array of items of type fiftyoneDegreesEvidenceKeyValuePair used to easily access and track the size of the array. More...
|
#define | EVIDENCE_KEY_VALUE_MEMBERS struct fiftyone_degrees_array_fiftyoneDegreesEvidenceKeyValuePair_t* pseudoEvidence;
The pseudo evidence. More...
|
typedef bool(* | fiftyoneDegreesEvidenceIterateMethod) (void *state, fiftyoneDegreesEvidenceKeyValuePair *pair)
Callback method used to iterate evidence key value pairs. More...
|
enum | fiftyoneDegreesEvidencePrefix { FIFTYONE_DEGREES_EVIDENCE_HTTP_HEADER_STRING = 1 << 0, FIFTYONE_DEGREES_EVIDENCE_HTTP_HEADER_IP_ADDRESSES = 1 << 1, FIFTYONE_DEGREES_EVIDENCE_SERVER = 1 << 2, FIFTYONE_DEGREES_EVIDENCE_QUERY = 1 << 3, FIFTYONE_DEGREES_EVIDENCE_COOKIE = 1 << 4, FIFTYONE_DEGREES_EVIDENCE_IGNORE = 1 << 7 } Evidence prefixes used to determine the category a piece of evidence belongs to. More...
|
#define EVIDENCE_KEY_VALUE_MEMBERS struct fiftyone_degrees_array_fiftyoneDegreesEvidenceKeyValuePair_t* pseudoEvidence; |
The pseudo evidence.
typedef bool(* fiftyoneDegreesEvidenceIterateMethod) (void *state, fiftyoneDegreesEvidenceKeyValuePair *pair) |
Callback method used to iterate evidence key value pairs.
Evidence prefixes used to determine the category a piece of evidence belongs to.
This will determine how the value is parsed.
fiftyoneDegreesEvidenceKeyValuePair* fiftyoneDegreesEvidenceAddString | ( | fiftyoneDegreesEvidenceKeyValuePairArray * | evidence, |
fiftyoneDegreesEvidencePrefix | prefix, | ||
const char * | field, | ||
const char * | originalValue | ||
) |
Adds a new entry to the evidence.
The memory associated with the field and original value parameters must not be freed until after the evidence collection has been freed. This method will NOT copy the values.
fiftyoneDegreesEvidenceKeyValuePairArray* fiftyoneDegreesEvidenceCreate | ( | uint32_t | capacity | ) |
Creates a new evidence array with the capacity requested.
void fiftyoneDegreesEvidenceFree | ( | fiftyoneDegreesEvidenceKeyValuePairArray * | evidence | ) |
Frees the memory used by an evidence array.
uint32_t fiftyoneDegreesEvidenceIterate | ( | fiftyoneDegreesEvidenceKeyValuePairArray * | evidence, |
int | prefixes, | ||
void * | state, | ||
fiftyoneDegreesEvidenceIterateMethod | callback | ||
) |
Iterates over the evidence calling the callback method for any values that match the prefixes provided.
If there are pseudo evidence, this will also iterate through them and perform the callback on each.
fiftyoneDegreesEvidencePrefixMap* fiftyoneDegreesEvidenceMapPrefix | ( | const char * | key | ) |
Determines the evidence map prefix from the key.
const char* fiftyoneDegreesEvidencePrefixString | ( | fiftyoneDegreesEvidencePrefix | prefix | ) |
Get the prefix string of an evidence prefix.