\r\n

51Degrees Device Detection C/C++  4.5

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 
119 #include <stdint.h>
120 #include <stdbool.h>
121 #include <stdlib.h>
122 #include "data.h"
123 #include "ip.h"
124 #include "string.h"
125 #include "array.h"
126 #include "common.h"
127 #include "pair.h"
128 #include "headers.h"
129 
134 typedef enum e_fiftyone_degrees_evidence_prefix {
150 
152 typedef struct fiftyone_degrees_evidence_prefix_map_t {
153  const char *prefix;
154  size_t prefixLength;
157 
161 typedef struct fiftyone_degrees_evidence_key_value_pair_t {
164  const void *parsedValue;
165  size_t parsedLength;
166  fiftyoneDegreesHeader* header;
169 
174 typedef struct fiftyone_degrees_array_fiftyoneDegreesEvidenceKeyValuePair_t
176 
181 #define FIFTYONE_DEGREES_ARRAY_EVIDENCE_MEMBER \
182  fiftyoneDegreesEvidenceKeyValuePairArray *next; \
183  fiftyoneDegreesEvidenceKeyValuePairArray *prev;
184 
191  FIFTYONE_DEGREES_ARRAY_EVIDENCE_MEMBER)
192 
193 
199 typedef bool(*fiftyoneDegreesEvidenceIterateMethod)(
200  void *state,
202 
209  fiftyoneDegreesEvidenceCreate(uint32_t capacity);
210 
216 EXTERNAL void fiftyoneDegreesEvidenceFree(
218 
232 EXTERNAL fiftyoneDegreesEvidenceKeyValuePair* fiftyoneDegreesEvidenceAddString(
235  const char *key,
236  const char *value);
237 
250 EXTERNAL fiftyoneDegreesEvidenceKeyValuePair* fiftyoneDegreesEvidenceAddPair(
254 
260 EXTERNAL fiftyoneDegreesEvidencePrefixMap* fiftyoneDegreesEvidenceMapPrefix(
261  const char *key);
262 
268 EXTERNAL const char* fiftyoneDegreesEvidencePrefixString(
270 
282 EXTERNAL uint32_t fiftyoneDegreesEvidenceIterate(
284  int prefixes,
285  void *state,
286  fiftyoneDegreesEvidenceIterateMethod callback);
287 
305 EXTERNAL bool fiftyoneDegreesEvidenceIterateForHeaders(
307  int prefixes,
308  fiftyoneDegreesHeaderPtrs* headers,
309  char* const buffer,
310  size_t const length,
311  void* state,
312  fiftyoneDegreesEvidenceIterateMethod callback);
313 
318 #endif
fiftyoneDegreesKeyValuePair item
the field key and original value
Definition: evidence.h:163
fiftyoneDegreesEvidencePrefix prefix
e.g.
Definition: evidence.h:162
Definition: pair.h:29
const void * parsedValue
parsed value which may not be a string
Definition: evidence.h:164
fiftyoneDegreesEvidencePrefix prefixEnum
Enum value of prefix name.
Definition: evidence.h:155
Map of prefix strings to prefix enum values.
Definition: evidence.h:152
An HTTP header value.
Definition: evidence.h:135
fiftyoneDegreesEvidencePrefix
@Contains key value pairs as evidence to be processed.
Definition: evidence.h:134
A list of IP addresses as a string to be parsed into a IP addresses collection.
Definition: evidence.h:137
Evidence key value pair structure which combines the prefix, key and value.
Definition: evidence.h:161
Array of header indexes.
Definition: headers.h:131
size_t parsedLength
length of parsedValue string
Definition: evidence.h:165
A query string parameter.
Definition: evidence.h:145
A cookie value.
Definition: evidence.h:146
Array of evidence key value pairs and a pointer to the next array if present or NULL of not present.
Definition: evidence.h:191
The evidence is invalid and should be ignored.
Definition: evidence.h:147
fiftyoneDegreesHeader * header
Unique header in the data set, or null if not related to a header.
Definition: evidence.h:166
Definition: GettingStarted.c:64
#define FIFTYONE_DEGREES_ARRAY_TYPE(t, m)
Simple array structure definition macro used for generic types.
Definition: array.h:51
const char * prefix
Name of the prefix.
Definition: evidence.h:153
A server value e.g.
Definition: evidence.h:143
size_t prefixLength
Length of the prefix string.
Definition: evidence.h:154