diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:35:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:35:11 +0000 |
commit | da76459dc21b5af2449af2d36eb95226cb186ce2 (patch) | |
tree | 542ebb3c1e796fac2742495b8437331727bbbfa0 /addons/51degrees/dummy/trie | |
parent | Initial commit. (diff) | |
download | haproxy-upstream/2.6.12.tar.xz haproxy-upstream/2.6.12.zip |
Adding upstream version 2.6.12.upstream/2.6.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'addons/51degrees/dummy/trie')
-rw-r--r-- | addons/51degrees/dummy/trie/51Degrees.c | 89 | ||||
-rw-r--r-- | addons/51degrees/dummy/trie/51Degrees.h | 112 |
2 files changed, 201 insertions, 0 deletions
diff --git a/addons/51degrees/dummy/trie/51Degrees.c b/addons/51degrees/dummy/trie/51Degrees.c new file mode 100644 index 0000000..7453061 --- /dev/null +++ b/addons/51degrees/dummy/trie/51Degrees.c @@ -0,0 +1,89 @@ +/* ********************************************************************* + * This Source Code Form is copyright of 51Degrees Mobile Experts Limited. + * Copyright 2019 51Degrees Mobile Experts Limited, 5 Charlotte Close, + * Caversham, Reading, Berkshire, United Kingdom RG4 7BY + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. + * + * If a copy of the MPL was not distributed with this file, You can obtain + * one at http://mozilla.org/MPL/2.0/. + * + * This Source Code Form is "Incompatible With Secondary Licenses", as + * defined by the Mozilla Public License, v. 2.0. + * *********************************************************************/ + +/* ********************************************************************* + * Dummy library for HAProxy. This does not function, and is designed + * solely for HAProxy testing purposes. + * *********************************************************************/ +#include "51Degrees.h" +#include <stdlib.h> + +int fiftyoneDegreesGetDeviceOffset( + fiftyoneDegreesDataSet *dataSet, + const char *userAgent) { + return 0; +} + +const char** fiftyoneDegreesGetRequiredPropertiesNames( + fiftyoneDegreesDataSet *dataSet) { + return NULL; +} + +int fiftyoneDegreesGetRequiredPropertiesCount( + fiftyoneDegreesDataSet *dataSet) { + return 0; +} + +int fiftyoneDegreesGetValueFromOffsets( + fiftyoneDegreesDataSet *dataSet, + fiftyoneDegreesDeviceOffsets* deviceOffsets, + int requiredPropertyIndex, + char* values, + int size) { + return 0; +} + +static fiftyoneDegreesDeviceOffset dummyOffset = { 0, 0, "dummy-user-agent" }; + +static fiftyoneDegreesDeviceOffsets dummyOffsets = { 1, &dummyOffset, NULL }; + +fiftyoneDegreesDeviceOffsets* fiftyoneDegreesCreateDeviceOffsets( + fiftyoneDegreesDataSet *dataSet) { + return &dummyOffsets; +} + +void fiftyoneDegreesFreeDeviceOffsets( + fiftyoneDegreesDeviceOffsets* offsets) { + return; +} + +int fiftyoneDegreesGetHttpHeaderCount( + fiftyoneDegreesDataSet *dataSet) { + return 0; +} + +int fiftyoneDegreesGetHttpHeaderNameOffset( + fiftyoneDegreesDataSet *dataSet, + int httpHeaderIndex) { + return 0; +} + +const char* fiftyoneDegreesGetHttpHeaderNamePointer( + fiftyoneDegreesDataSet *dataSet, + int httpHeaderIndex) { + return "dummy-header-name"; +} + +fiftyoneDegreesDataSetInitStatus fiftyoneDegreesInitWithPropertyArray( + const char* fileName, + fiftyoneDegreesDataSet *dataSet, + const char** properties, + int propertyCount) { + return DATA_SET_INIT_STATUS_SUCCESS; +} + +void fiftyoneDegreesDataSetFree(fiftyoneDegreesDataSet *dataSet) { + return; +}
\ No newline at end of file diff --git a/addons/51degrees/dummy/trie/51Degrees.h b/addons/51degrees/dummy/trie/51Degrees.h new file mode 100644 index 0000000..bedcfd7 --- /dev/null +++ b/addons/51degrees/dummy/trie/51Degrees.h @@ -0,0 +1,112 @@ +/* ********************************************************************* + * This Source Code Form is copyright of 51Degrees Mobile Experts Limited. + * Copyright 2019 51Degrees Mobile Experts Limited, 5 Charlotte Close, + * Caversham, Reading, Berkshire, United Kingdom RG4 7BY + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. + * + * If a copy of the MPL was not distributed with this file, You can obtain + * one at http://mozilla.org/MPL/2.0/. + * + * This Source Code Form is "Incompatible With Secondary Licenses", as + * defined by the Mozilla Public License, v. 2.0. + * *********************************************************************/ + +/* ********************************************************************* + * Dummy library for HAProxy. This does not function, and is designed + * solely for HAProxy testing purposes. + * *********************************************************************/ +#ifndef FIFTYONEDEGREES_H_INCLUDED +#define FIFTYONEDEGREES_H_INCLUDED + +#ifndef FIFTYONEDEGREES_H_TRIE_INCLUDED +#define FIFTYONEDEGREES_H_TRIE_INCLUDED +#endif + +#ifndef FIFTYONEDEGREES_DUMMY_LIB +#define FIFTYONEDEGREES_DUMMY_LIB +#endif + +#include <stdint.h> + +typedef enum e_fiftyoneDegrees_DataSetInitStatus { + DATA_SET_INIT_STATUS_SUCCESS, + DATA_SET_INIT_STATUS_INSUFFICIENT_MEMORY, + DATA_SET_INIT_STATUS_CORRUPT_DATA, + DATA_SET_INIT_STATUS_INCORRECT_VERSION, + DATA_SET_INIT_STATUS_FILE_NOT_FOUND, + DATA_SET_INIT_STATUS_NOT_SET, + DATA_SET_INIT_STATUS_POINTER_OUT_OF_BOUNDS, + DATA_SET_INIT_STATUS_NULL_POINTER +} fiftyoneDegreesDataSetInitStatus; + +typedef struct fiftyoneDegrees_integers_t { + int32_t *firstElement; + unsigned int count; + int freeMemory; +} fiftyoneDegreesIntegers; + +typedef struct fiftyoneDegrees_dataset_t { + fiftyoneDegreesIntegers uniqueHttpHeaders; +} fiftyoneDegreesDataSet; + +typedef struct fiftyoneDegrees_active_dataset_t { + +} fiftyoneDegreesActiveDataSet; + +typedef struct fiftyoneDegrees_device_offset_t { + int httpHeaderOffset; + int deviceOffset; + char *userAgent; +} fiftyoneDegreesDeviceOffset; + +typedef struct fiftyoneDegrees_device_offsets_t { + int size; + fiftyoneDegreesDeviceOffset *firstOffset; + fiftyoneDegreesActiveDataSet *active; +} fiftyoneDegreesDeviceOffsets; + +int fiftyoneDegreesGetDeviceOffset( + fiftyoneDegreesDataSet *dataSet, + const char *userAgent); + +const char** fiftyoneDegreesGetRequiredPropertiesNames( + fiftyoneDegreesDataSet *dataSet); + +int fiftyoneDegreesGetRequiredPropertiesCount( + fiftyoneDegreesDataSet *dataSet); + +int fiftyoneDegreesGetValueFromOffsets( + fiftyoneDegreesDataSet *dataSet, + fiftyoneDegreesDeviceOffsets* deviceOffsets, + int requiredPropertyIndex, + char* values, + int size); + +fiftyoneDegreesDeviceOffsets* fiftyoneDegreesCreateDeviceOffsets( + fiftyoneDegreesDataSet *dataSet); + +void fiftyoneDegreesFreeDeviceOffsets( + fiftyoneDegreesDeviceOffsets* offsets); + +int fiftyoneDegreesGetHttpHeaderCount( + fiftyoneDegreesDataSet *dataSet); + +int fiftyoneDegreesGetHttpHeaderNameOffset( + fiftyoneDegreesDataSet *dataSet, + int httpHeaderIndex); + +const char* fiftyoneDegreesGetHttpHeaderNamePointer( + fiftyoneDegreesDataSet *dataSet, + int httpHeaderIndex); + +fiftyoneDegreesDataSetInitStatus fiftyoneDegreesInitWithPropertyArray( + const char* fileName, + fiftyoneDegreesDataSet *dataSet, + const char** properties, + int propertyCount); + +void fiftyoneDegreesDataSetFree(fiftyoneDegreesDataSet *dataSet); + +#endif
\ No newline at end of file |