\r\n

51Degrees Device Detection C/C++  4.4

A device detection library that is used natively or by 51Degrees products

evidence.h

1 /* *********************************************************************
2  * This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3  * Copyright 2023 51 Degrees Mobile Experts Limited, Davidson House,
4  * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5  *
6  * This Original Work is licensed under the European Union Public Licence
7  * (EUPL) v.1.2 and is subject to its terms as set out below.
8  *
9  * If a copy of the EUPL was not distributed with this file, You can obtain
10  * one at https://opensource.org/licenses/EUPL-1.2.
11  *
12  * The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13  * amended by the European Commission) shall be deemed incompatible for
14  * the purposes of the Work and the provisions of the compatibility
15  * clause in Article 5 of the EUPL shall not apply.
16  *
17  * If using the Work as, or as part of, a network application, by
18  * including the attribution notice(s) required under Article 5 of the EUPL
19  * in the end user terms of the application under an appropriate heading,
20  * such notice(s) shall fulfill the requirements of that article.
21  * ********************************************************************* */
22 
23 #ifndef FIFTYONE_DEGREES_EVIDENCE_H_INCLUDED
24 #define FIFTYONE_DEGREES_EVIDENCE_H_INCLUDED
25 
120 #include <stdint.h>
121 #include <stdbool.h>
122 #include <stdlib.h>
123 #include "data.h"
124 #include "ip.h"
125 #include "string.h"
126 #include "array.h"
127 #include "common.h"
128 
133 typedef enum e_fiftyone_degrees_evidence_prefix {
149 
151 typedef struct fiftyone_degrees_evidence_prefix_map_t {
152  const char *prefix;
153  size_t prefixLength;
156 
160 typedef struct fiftyone_degrees_evidence_key_value_pair_t {
162  const char *field;
163  const void *originalValue;
164  const void *parsedValue;
166 
167 #define EVIDENCE_KEY_VALUE_MEMBERS \
168 struct fiftyone_degrees_array_fiftyoneDegreesEvidenceKeyValuePair_t* pseudoEvidence;
170 FIFTYONE_DEGREES_ARRAY_TYPE(
173 
174 
182  void *state,
184 
191 fiftyoneDegreesEvidenceCreate(uint32_t capacity);
192 
197 EXTERNAL void fiftyoneDegreesEvidenceFree(
199 
212  const char *field,
213  const char *originalValue);
214 
221  const char *key);
222 
228 EXTERNAL const char* fiftyoneDegreesEvidencePrefixString(
230 
242 EXTERNAL uint32_t fiftyoneDegreesEvidenceIterate(
244  int prefixes,
245  void *state,
247 
252 #endif
bool(* fiftyoneDegreesEvidenceIterateMethod)(void *state, fiftyoneDegreesEvidenceKeyValuePair *pair)
Callback method used to iterate evidence key value pairs.
Definition: evidence.h:181
const char * fiftyoneDegreesEvidencePrefixString(fiftyoneDegreesEvidencePrefix prefix)
Get the prefix string of an evidence prefix.
fiftyoneDegreesEvidenceKeyValuePairArray * fiftyoneDegreesEvidenceCreate(uint32_t capacity)
Creates a new evidence array with the capacity requested.
fiftyoneDegreesEvidencePrefix prefix
e.g.
Definition: evidence.h:161
A query string parameter.
Definition: evidence.h:144
const void * parsedValue
The parsed value which may not be a string.
Definition: evidence.h:164
#define EVIDENCE_KEY_VALUE_MEMBERS
The pseudo evidence.
Definition: evidence.h:167
const char * field
e.g.
Definition: evidence.h:162
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 provide...
fiftyoneDegreesEvidencePrefix prefixEnum
Enum value of prefix name.
Definition: evidence.h:154
Map of prefix strings to prefix enum values.
Definition: evidence.h:151
fiftyoneDegreesEvidenceKeyValuePair * fiftyoneDegreesEvidenceAddString(fiftyoneDegreesEvidenceKeyValuePairArray *evidence, fiftyoneDegreesEvidencePrefix prefix, const char *field, const char *originalValue)
Adds a new entry to the evidence.
A cookie value.
Definition: evidence.h:145
Evidence key value pair structure which combines the prefix, key and value.
Definition: evidence.h:160
fiftyoneDegreesEvidencePrefix
Evidence prefixes used to determine the category a piece of evidence belongs to.
Definition: evidence.h:133
The evidence is invalid and should be ignored.
Definition: evidence.h:146
const void * originalValue
The original unparsed value.
Definition: evidence.h:163
fiftyoneDegreesEvidencePrefixMap * fiftyoneDegreesEvidenceMapPrefix(const char *key)
Determines the evidence map prefix from the key.
An HTTP header value.
Definition: evidence.h:134
Array of items of type fiftyoneDegreesEvidenceKeyValuePair used to easily access and track the size o...
Definition: evidence.h:172
A list of IP addresses as a string to be parsed into a IP addresses collection.
Definition: evidence.h:136
A server value e.g.
Definition: evidence.h:142
Definition: GettingStarted.c:63
const char * prefix
Name of the prefix.
Definition: evidence.h:152
size_t prefixLength
Length of the prefix string.
Definition: evidence.h:153