Ben51Degrees | 31c3d51 | 2019-06-12 15:42:53 +0100 | [diff] [blame] | 1 | /* ********************************************************************* |
| 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 | |
Ben51Degrees | f4a82fb | 2019-06-13 16:51:59 +0100 | [diff] [blame] | 27 | #ifndef FIFTYONEDEGREES_DUMMY_LIB |
| 28 | #define FIFTYONEDEGREES_DUMMY_LIB |
| 29 | #endif |
| 30 | |
Ben51Degrees | 31c3d51 | 2019-06-12 15:42:53 +0100 | [diff] [blame] | 31 | #include <stdint.h> |
| 32 | |
| 33 | typedef 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 | |
| 44 | typedef struct fiftyoneDegrees_integers_t { |
| 45 | int32_t *firstElement; |
| 46 | unsigned int count; |
| 47 | int freeMemory; |
| 48 | } fiftyoneDegreesIntegers; |
| 49 | |
| 50 | typedef struct fiftyoneDegrees_dataset_t { |
| 51 | fiftyoneDegreesIntegers uniqueHttpHeaders; |
| 52 | } fiftyoneDegreesDataSet; |
| 53 | |
| 54 | typedef struct fiftyoneDegrees_active_dataset_t { |
| 55 | |
| 56 | } fiftyoneDegreesActiveDataSet; |
| 57 | |
| 58 | typedef struct fiftyoneDegrees_device_offset_t { |
| 59 | int httpHeaderOffset; |
| 60 | int deviceOffset; |
| 61 | char *userAgent; |
| 62 | } fiftyoneDegreesDeviceOffset; |
| 63 | |
| 64 | typedef struct fiftyoneDegrees_device_offsets_t { |
| 65 | int size; |
| 66 | fiftyoneDegreesDeviceOffset *firstOffset; |
| 67 | fiftyoneDegreesActiveDataSet *active; |
| 68 | } fiftyoneDegreesDeviceOffsets; |
| 69 | |
| 70 | int fiftyoneDegreesGetDeviceOffset( |
| 71 | fiftyoneDegreesDataSet *dataSet, |
| 72 | const char *userAgent); |
| 73 | |
| 74 | const char** fiftyoneDegreesGetRequiredPropertiesNames( |
| 75 | fiftyoneDegreesDataSet *dataSet); |
| 76 | |
| 77 | int fiftyoneDegreesGetRequiredPropertiesCount( |
| 78 | fiftyoneDegreesDataSet *dataSet); |
| 79 | |
| 80 | int fiftyoneDegreesGetValueFromOffsets( |
| 81 | fiftyoneDegreesDataSet *dataSet, |
| 82 | fiftyoneDegreesDeviceOffsets* deviceOffsets, |
| 83 | int requiredPropertyIndex, |
| 84 | char* values, |
| 85 | int size); |
| 86 | |
| 87 | fiftyoneDegreesDeviceOffsets* fiftyoneDegreesCreateDeviceOffsets( |
| 88 | fiftyoneDegreesDataSet *dataSet); |
| 89 | |
| 90 | void fiftyoneDegreesFreeDeviceOffsets( |
| 91 | fiftyoneDegreesDeviceOffsets* offsets); |
| 92 | |
| 93 | int fiftyoneDegreesGetHttpHeaderCount( |
| 94 | fiftyoneDegreesDataSet *dataSet); |
| 95 | |
| 96 | int fiftyoneDegreesGetHttpHeaderNameOffset( |
| 97 | fiftyoneDegreesDataSet *dataSet, |
| 98 | int httpHeaderIndex); |
| 99 | |
| 100 | const char* fiftyoneDegreesGetHttpHeaderNamePointer( |
| 101 | fiftyoneDegreesDataSet *dataSet, |
| 102 | int httpHeaderIndex); |
| 103 | |
| 104 | fiftyoneDegreesDataSetInitStatus fiftyoneDegreesInitWithPropertyArray( |
| 105 | const char* fileName, |
| 106 | fiftyoneDegreesDataSet *dataSet, |
| 107 | const char** properties, |
| 108 | int propertyCount); |
| 109 | |
| 110 | void fiftyoneDegreesDataSetFree(fiftyoneDegreesDataSet *dataSet); |
| 111 | |
| 112 | #endif |