blob: bedcfd7b341d54b585b239624d7c3be0862f4b57 [file] [log] [blame]
Ben51Degrees31c3d512019-06-12 15:42:53 +01001/* *********************************************************************
2 * This Source Code Form is copyright of 51Degrees Mobile Experts Limited.
3 * Copyright 2019 51Degrees Mobile Experts Limited, 5 Charlotte Close,
4 * Caversham, Reading, Berkshire, United Kingdom RG4 7BY
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0.
8 *
9 * If a copy of the MPL was not distributed with this file, You can obtain
10 * one at http://mozilla.org/MPL/2.0/.
11 *
12 * This Source Code Form is "Incompatible With Secondary Licenses", as
13 * defined by the Mozilla Public License, v. 2.0.
14 * *********************************************************************/
15
16/* *********************************************************************
17 * Dummy library for HAProxy. This does not function, and is designed
18 * solely for HAProxy testing purposes.
19 * *********************************************************************/
20#ifndef FIFTYONEDEGREES_H_INCLUDED
21#define FIFTYONEDEGREES_H_INCLUDED
22
23#ifndef FIFTYONEDEGREES_H_TRIE_INCLUDED
24#define FIFTYONEDEGREES_H_TRIE_INCLUDED
25#endif
26
Ben51Degreesf4a82fb2019-06-13 16:51:59 +010027#ifndef FIFTYONEDEGREES_DUMMY_LIB
28#define FIFTYONEDEGREES_DUMMY_LIB
29#endif
30
Ben51Degrees31c3d512019-06-12 15:42:53 +010031#include <stdint.h>
32
33typedef enum e_fiftyoneDegrees_DataSetInitStatus {
34 DATA_SET_INIT_STATUS_SUCCESS,
35 DATA_SET_INIT_STATUS_INSUFFICIENT_MEMORY,
36 DATA_SET_INIT_STATUS_CORRUPT_DATA,
37 DATA_SET_INIT_STATUS_INCORRECT_VERSION,
38 DATA_SET_INIT_STATUS_FILE_NOT_FOUND,
39 DATA_SET_INIT_STATUS_NOT_SET,
40 DATA_SET_INIT_STATUS_POINTER_OUT_OF_BOUNDS,
41 DATA_SET_INIT_STATUS_NULL_POINTER
42} fiftyoneDegreesDataSetInitStatus;
43
44typedef struct fiftyoneDegrees_integers_t {
45 int32_t *firstElement;
46 unsigned int count;
47 int freeMemory;
48} fiftyoneDegreesIntegers;
49
50typedef struct fiftyoneDegrees_dataset_t {
51 fiftyoneDegreesIntegers uniqueHttpHeaders;
52} fiftyoneDegreesDataSet;
53
54typedef struct fiftyoneDegrees_active_dataset_t {
55
56} fiftyoneDegreesActiveDataSet;
57
58typedef struct fiftyoneDegrees_device_offset_t {
59 int httpHeaderOffset;
60 int deviceOffset;
61 char *userAgent;
62} fiftyoneDegreesDeviceOffset;
63
64typedef struct fiftyoneDegrees_device_offsets_t {
65 int size;
66 fiftyoneDegreesDeviceOffset *firstOffset;
67 fiftyoneDegreesActiveDataSet *active;
68} fiftyoneDegreesDeviceOffsets;
69
70int fiftyoneDegreesGetDeviceOffset(
71 fiftyoneDegreesDataSet *dataSet,
72 const char *userAgent);
73
74const char** fiftyoneDegreesGetRequiredPropertiesNames(
75 fiftyoneDegreesDataSet *dataSet);
76
77int fiftyoneDegreesGetRequiredPropertiesCount(
78 fiftyoneDegreesDataSet *dataSet);
79
80int fiftyoneDegreesGetValueFromOffsets(
81 fiftyoneDegreesDataSet *dataSet,
82 fiftyoneDegreesDeviceOffsets* deviceOffsets,
83 int requiredPropertyIndex,
84 char* values,
85 int size);
86
87fiftyoneDegreesDeviceOffsets* fiftyoneDegreesCreateDeviceOffsets(
88 fiftyoneDegreesDataSet *dataSet);
89
90void fiftyoneDegreesFreeDeviceOffsets(
91 fiftyoneDegreesDeviceOffsets* offsets);
92
93int fiftyoneDegreesGetHttpHeaderCount(
94 fiftyoneDegreesDataSet *dataSet);
95
96int fiftyoneDegreesGetHttpHeaderNameOffset(
97 fiftyoneDegreesDataSet *dataSet,
98 int httpHeaderIndex);
99
100const char* fiftyoneDegreesGetHttpHeaderNamePointer(
101 fiftyoneDegreesDataSet *dataSet,
102 int httpHeaderIndex);
103
104fiftyoneDegreesDataSetInitStatus fiftyoneDegreesInitWithPropertyArray(
105 const char* fileName,
106 fiftyoneDegreesDataSet *dataSet,
107 const char** properties,
108 int propertyCount);
109
110void fiftyoneDegreesDataSetFree(fiftyoneDegreesDataSet *dataSet);
111
112#endif