51Degrees Device Detection C/C++  4.1

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 2019 51 Degrees Mobile Experts Limited, 5 Charlotte Close,
4  * Caversham, Reading, Berkshire, United Kingdom RG4 7BY.
5  *
6  * This Original Work is licensed under the European Union Public Licence (EUPL)
7  * 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 
128 #ifdef __cplusplus
129 #define EXTERNAL extern "C"
130 #else
131 #define EXTERNAL
132 #endif
133 
138 typedef enum e_fiftyone_degrees_evidence_prefix {
154 
156 typedef struct fiftyone_degrees_evidence_prefix_map_t {
157  const char *prefix;
158  size_t prefixLength;
161 
165 typedef struct fiftyone_degrees_evidence_key_value_pair_t {
167  const char *field;
168  const void *originalValue;
169  const void *parsedValue;
171 
173 
174 
181  void *state,
183 
190 fiftyoneDegreesEvidenceCreate(uint32_t capacity);
191 
196 EXTERNAL void fiftyoneDegreesEvidenceFree(
198 
211  const char *field,
212  const char *originalValue);
213 
220  const char *key);
221 
231 EXTERNAL uint32_t fiftyoneDegreesEvidenceIterate(
233  int prefixes,
234  void *state,
236 
241 #endif
bool(* fiftyoneDegreesEvidenceIterateMethod)(void *state, fiftyoneDegreesEvidenceKeyValuePair *pair)
Callback method used to iterate evidence key value pairs.
Definition: evidence.h:180
fiftyoneDegreesEvidenceKeyValuePairArray * fiftyoneDegreesEvidenceCreate(uint32_t capacity)
Creates a new evidence array with the capacity requested.
fiftyoneDegreesEvidencePrefix prefix
e.g.
Definition: evidence.h:166
A query string parameter.
Definition: evidence.h:149
const void * parsedValue
The parsed value which may not be a string.
Definition: evidence.h:169
const char * field
e.g.
Definition: evidence.h:167
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:159
Map of prefix strings to prefix enum values.
Definition: evidence.h:156
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:150
Evidence key value pair structure which combines the prefix, key and value.
Definition: evidence.h:165
fiftyoneDegreesEvidencePrefix
Evidence prefixes used to determine the category a piece of evidence belongs to.
Definition: evidence.h:138
The evidence is invalid and should be ignored.
Definition: evidence.h:151
const void * originalValue
The original unparsed value.
Definition: evidence.h:168
fiftyoneDegreesEvidencePrefixMap * fiftyoneDegreesEvidenceMapPrefix(const char *key)
Determines the evidence map prefix from the key.
An HTTP header value.
Definition: evidence.h:139
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:141
A server value e.g.
Definition: evidence.h:147
#define FIFTYONE_DEGREES_ARRAY_TYPE(t, m)
Simple array structure definition macro used for generic types.
Definition: array.h:48
const char * prefix
Name of the prefix.
Definition: evidence.h:157
size_t prefixLength
Length of the prefix string.
Definition: evidence.h:158