diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:18:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:18:05 +0000 |
commit | b46aad6df449445a9fc4aa7b32bd40005438e3f7 (patch) | |
tree | 751aa858ca01f35de800164516b298887382919d /addons/51degrees/dummy | |
parent | Initial commit. (diff) | |
download | haproxy-b46aad6df449445a9fc4aa7b32bd40005438e3f7.tar.xz haproxy-b46aad6df449445a9fc4aa7b32bd40005438e3f7.zip |
Adding upstream version 2.9.5.upstream/2.9.5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | addons/51degrees/dummy/cityhash/city.c | 4 | ||||
-rw-r--r-- | addons/51degrees/dummy/pattern/51Degrees.c | 114 | ||||
-rw-r--r-- | addons/51degrees/dummy/pattern/51Degrees.h | 147 | ||||
-rw-r--r-- | addons/51degrees/dummy/threading.c | 4 | ||||
-rw-r--r-- | addons/51degrees/dummy/trie/51Degrees.c | 89 | ||||
-rw-r--r-- | addons/51degrees/dummy/trie/51Degrees.h | 112 | ||||
-rw-r--r-- | addons/51degrees/dummy/v4hash/hash/fiftyone.h | 34 | ||||
-rw-r--r-- | addons/51degrees/dummy/v4hash/hash/hash.c | 130 | ||||
-rw-r--r-- | addons/51degrees/dummy/v4hash/hash/hash.h | 277 |
9 files changed, 911 insertions, 0 deletions
diff --git a/addons/51degrees/dummy/cityhash/city.c b/addons/51degrees/dummy/cityhash/city.c new file mode 100644 index 0000000..b6b08bf --- /dev/null +++ b/addons/51degrees/dummy/cityhash/city.c @@ -0,0 +1,4 @@ +typedef struct cityhash_t { + // This is an empty structure to ensure a city.o is generated + // by the dummy library, it is never used. +} dummyCityHash;
\ No newline at end of file diff --git a/addons/51degrees/dummy/pattern/51Degrees.c b/addons/51degrees/dummy/pattern/51Degrees.c new file mode 100644 index 0000000..c002e5c --- /dev/null +++ b/addons/51degrees/dummy/pattern/51Degrees.c @@ -0,0 +1,114 @@ +/* ********************************************************************* + * 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> + +int32_t fiftyoneDegreesGetSignatureRank(fiftyoneDegreesWorkset *ws) { + return 0; +} + +const char* fiftyoneDegreesGetPropertyName( + const fiftyoneDegreesDataSet *dataSet, + const fiftyoneDegreesProperty *property) { + return "dummy-property"; +} + +int32_t fiftyoneDegreesSetValues( + fiftyoneDegreesWorkset *ws, + int32_t requiredPropertyIndex) { + return 0; +} + +const char* fiftyoneDegreesGetValueName( + const fiftyoneDegreesDataSet *dataSet, + const fiftyoneDegreesValue *value) { + return "dummy-value"; +} + +static fiftyoneDegreesDataSet dummyDataSet = { + 0, + (fiftyoneDegreesHttpHeader*)NULL, + 0, + (const fiftyoneDegreesProperty**)NULL +}; + +static fiftyoneDegreesWorkset dummyWorkset = { + &dummyDataSet, + 0, + (fiftyoneDegreesHttpHeaderWorkset*)NULL, + EXACT, + 0, + (const fiftyoneDegreesValue **)NULL +}; + +fiftyoneDegreesWorkset *fiftyoneDegreesWorksetPoolGet( + fiftyoneDegreesWorksetPool *pool) { + return &dummyWorkset; +} + +void fiftyoneDegreesWorksetPoolRelease( + fiftyoneDegreesWorksetPool *pool, + fiftyoneDegreesWorkset *ws) { + return; +} + +void fiftyoneDegreesMatchForHttpHeaders(fiftyoneDegreesWorkset *ws) { + return; +} + +void fiftyoneDegreesMatch( + fiftyoneDegreesWorkset *ws, + const char* userAgent) { + return; +} + +fiftyoneDegreesDataSetInitStatus fiftyoneDegreesInitWithPropertyArray( + const char *fileName, + fiftyoneDegreesDataSet *dataSet, + const char** properties, + int32_t count) { + return DATA_SET_INIT_STATUS_SUCCESS; +} + +static fiftyoneDegreesWorksetPool dummyWorksetPool; + +fiftyoneDegreesWorksetPool *fiftyoneDegreesWorksetPoolCreate( + fiftyoneDegreesDataSet *dataSet, + fiftyoneDegreesResultsetCache *cache, + int32_t size) { + return &dummyWorksetPool; +} + +void fiftyoneDegreesWorksetPoolFree( + const fiftyoneDegreesWorksetPool *pool) { + return; +} + +void fiftyoneDegreesDataSetFree(const fiftyoneDegreesDataSet *dataSet) { + return; +} + +static fiftyoneDegreesAsciiString dummyAsciiString = {0, 0}; + +const fiftyoneDegreesAsciiString* fiftyoneDegreesGetString( + const fiftyoneDegreesDataSet *dataSet, + int32_t offset) { + return &dummyAsciiString; +}
\ No newline at end of file diff --git a/addons/51degrees/dummy/pattern/51Degrees.h b/addons/51degrees/dummy/pattern/51Degrees.h new file mode 100644 index 0000000..9aaf949 --- /dev/null +++ b/addons/51degrees/dummy/pattern/51Degrees.h @@ -0,0 +1,147 @@ +/* ********************************************************************* + * 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_PATTERN_INCLUDED +#define FIFTYONEDEGREES_H_PATTERN_INCLUDED +#endif + +#ifndef FIFTYONEDEGREES_DUMMY_LIB +#define FIFTYONEDEGREES_DUMMY_LIB +#endif + +#include <stdint.h> + +typedef enum e_fiftyoneDegrees_MatchMethod { + NONE, + EXACT, + NUMERIC, + NEAREST, + CLOSEST +} fiftyoneDegreesMatchMethod; + +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_ascii_string_t { + const int16_t length; + const char firstByte; +} fiftyoneDegreesAsciiString; + +typedef struct fiftyoneDegrees_dataset_header_t { +} fiftyoneDegreesDataSetHeader; + +typedef struct fiftyoneDegrees_workset_pool_t { +} fiftyoneDegreesWorksetPool; + +typedef struct fiftyoneDegrees_property_t { +} fiftyoneDegreesProperty; + +typedef struct fiftyoneDegrees_value_t { +} fiftyoneDegreesValue; + +typedef struct fiftyoneDegrees_resultset_cache_t { +} fiftyoneDegreesResultsetCache; + +typedef struct fiftyoneDegrees_http_header_t { + int32_t headerNameOffset; + const char *headerName; +} fiftyoneDegreesHttpHeader; + +typedef struct fiftyoneDegrees_http_header_workset_t { + fiftyoneDegreesHttpHeader *header; + const char *headerValue; + int headerValueLength; +} fiftyoneDegreesHttpHeaderWorkset; + + +typedef struct fiftyoneDegrees_dataset_t { + int32_t httpHeadersCount; + fiftyoneDegreesHttpHeader *httpHeaders; + int32_t requiredPropertyCount; + const fiftyoneDegreesProperty **requiredProperties; +} fiftyoneDegreesDataSet; + +typedef struct fiftyoneDegrees_workset_t { + fiftyoneDegreesDataSet *dataSet; + int32_t importantHeadersCount; + fiftyoneDegreesHttpHeaderWorkset *importantHeaders; + fiftyoneDegreesMatchMethod method; + int32_t difference; + const fiftyoneDegreesValue **values; +} fiftyoneDegreesWorkset; + +int32_t fiftyoneDegreesGetSignatureRank(fiftyoneDegreesWorkset *ws); + +const char* fiftyoneDegreesGetPropertyName( + const fiftyoneDegreesDataSet *dataSet, + const fiftyoneDegreesProperty *property); + +int32_t fiftyoneDegreesSetValues( + fiftyoneDegreesWorkset *ws, + int32_t requiredPropertyIndex); + +const char* fiftyoneDegreesGetValueName( + const fiftyoneDegreesDataSet *dataSet, + const fiftyoneDegreesValue *value); + +fiftyoneDegreesWorkset *fiftyoneDegreesWorksetPoolGet( + fiftyoneDegreesWorksetPool *pool); + +void fiftyoneDegreesWorksetPoolRelease( + fiftyoneDegreesWorksetPool *pool, + fiftyoneDegreesWorkset *ws); + +void fiftyoneDegreesMatchForHttpHeaders(fiftyoneDegreesWorkset *ws); + +void fiftyoneDegreesMatch( + fiftyoneDegreesWorkset *ws, + const char* userAgent); + +fiftyoneDegreesDataSetInitStatus fiftyoneDegreesInitWithPropertyArray( + const char *fileName, + fiftyoneDegreesDataSet *dataSet, + const char** properties, + int32_t count); + +fiftyoneDegreesWorksetPool *fiftyoneDegreesWorksetPoolCreate( + fiftyoneDegreesDataSet *dataSet, + fiftyoneDegreesResultsetCache *cache, + int32_t size); + +void fiftyoneDegreesWorksetPoolFree( + const fiftyoneDegreesWorksetPool *pool); + +void fiftyoneDegreesDataSetFree(const fiftyoneDegreesDataSet *dataSet); + +const fiftyoneDegreesAsciiString* fiftyoneDegreesGetString( + const fiftyoneDegreesDataSet *dataSet, + int32_t offset); + +#endif
\ No newline at end of file diff --git a/addons/51degrees/dummy/threading.c b/addons/51degrees/dummy/threading.c new file mode 100644 index 0000000..e65678d --- /dev/null +++ b/addons/51degrees/dummy/threading.c @@ -0,0 +1,4 @@ +typedef struct fiftyoneDegrees_threading_t { + // This is an empty structure to ensure a threading.o is generated + // by the dummy library, it is never used. +} dummyFiftyoneDegreesThreading;
\ No newline at end of file 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 diff --git a/addons/51degrees/dummy/v4hash/hash/fiftyone.h b/addons/51degrees/dummy/v4hash/hash/fiftyone.h new file mode 100644 index 0000000..fe9da87 --- /dev/null +++ b/addons/51degrees/dummy/v4hash/hash/fiftyone.h @@ -0,0 +1,34 @@ +/* ********************************************************************* + * This Original Work is copyright of 51 Degrees Mobile Experts Limited. + * Copyright 2022 51 Degrees Mobile Experts Limited, Davidson House, + * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU. + * + * This Original Work is licensed under the European Union Public Licence + * (EUPL) v.1.2 and is subject to its terms as set out below. + * + * If a copy of the EUPL was not distributed with this file, You can obtain + * one at https://opensource.org/licenses/EUPL-1.2. + * + * The 'Compatible Licences' set out in the Appendix to the EUPL (as may be + * amended by the European Commission) shall be deemed incompatible for + * the purposes of the Work and the provisions of the compatibility + * clause in Article 5 of the EUPL shall not apply. + * + * If using the Work as, or as part of, a network application, by + * including the attribution notice(s) required under Article 5 of the EUPL + * in the end user terms of the application under an appropriate heading, + * such notice(s) shall fulfill the requirements of that article. + * ********************************************************************* */ + +/* ********************************************************************* + * Dummy library for HAProxy. This does not function, and is designed + * solely for HAProxy testing purposes. + * *********************************************************************/ +#ifndef FIFTYONE_DEGREES_SYNONYM_HASH_INCLUDED +#define FIFTYONE_DEGREES_SYNONYM_HASH_INCLUDED + +#ifndef FIFTYONEDEGREES_DUMMY_LIB +#define FIFTYONEDEGREES_DUMMY_LIB +#endif + +#endif diff --git a/addons/51degrees/dummy/v4hash/hash/hash.c b/addons/51degrees/dummy/v4hash/hash/hash.c new file mode 100644 index 0000000..e9a739e --- /dev/null +++ b/addons/51degrees/dummy/v4hash/hash/hash.c @@ -0,0 +1,130 @@ +/* ********************************************************************* + * This Original Work is copyright of 51 Degrees Mobile Experts Limited. + * Copyright 2022 51 Degrees Mobile Experts Limited, Davidson House, + * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU. + * + * This Original Work is the subject of the following patents and patent + * applications, owned by 51 Degrees Mobile Experts Limited of 5 Charlotte + * Close, Caversham, Reading, Berkshire, United Kingdom RG4 7BY: + * European Patent No. 3438848; and + * United States Patent No. 10,482,175. + * + * This Original Work is licensed under the European Union Public Licence + * (EUPL) v.1.2 and is subject to its terms as set out below. + * + * If a copy of the EUPL was not distributed with this file, You can obtain + * one at https://opensource.org/licenses/EUPL-1.2. + * + * The 'Compatible Licences' set out in the Appendix to the EUPL (as may be + * amended by the European Commission) shall be deemed incompatible for + * the purposes of the Work and the provisions of the compatibility + * clause in Article 5 of the EUPL shall not apply. + * + * If using the Work as, or as part of, a network application, by + * including the attribution notice(s) required under Article 5 of the EUPL + * in the end user terms of the application under an appropriate heading, + * such notice(s) shall fulfill the requirements of that article. + * ********************************************************************* */ + +/* ********************************************************************* + * Dummy library for HAProxy. This does not function, and is designed + * solely for HAProxy testing purposes. + * *********************************************************************/ +#include "hash.h" +#include "fiftyone.h" + +static fiftyoneDegreesHeaders dummyHeaders = { }; +static fiftyoneDegreesDataSetBase dummyDataSet = { &dummyHeaders }; + +fiftyoneDegreesConfigHash fiftyoneDegreesHashInMemoryConfig; +fiftyoneDegreesPropertiesRequired fiftyoneDegreesPropertiesDefault; + +fiftyoneDegreesDataSetBase* fiftyoneDegreesDataSetGet( + fiftyoneDegreesResourceManager *manager) { + return &dummyDataSet; +} + +void fiftyoneDegreesResultsHashFree( + fiftyoneDegreesResultsHash* results) { + return; +} + +static fiftyoneDegreesResultsHash dummyResults = { }; + +fiftyoneDegreesResultsHash* fiftyoneDegreesResultsHashCreate( + fiftyoneDegreesResourceManager *manager, + uint32_t userAgentCapacity, + uint32_t overridesCapacity) { + return &dummyResults; +} + +void fiftyoneDegreesDataSetRelease(fiftyoneDegreesDataSetBase *dataSet) { + return; +} + +static fiftyoneDegreesEvidenceKeyValuePairArray dummyEvidence = { }; + +fiftyoneDegreesEvidenceKeyValuePairArray* +fiftyoneDegreesEvidenceCreate(uint32_t capacity) { + return &dummyEvidence; +} + +fiftyoneDegreesEvidenceKeyValuePair* fiftyoneDegreesEvidenceAddString( + fiftyoneDegreesEvidenceKeyValuePairArray *evidence, + fiftyoneDegreesEvidencePrefix prefix, + const char *field, + const char *originalValue) { + return NULL; +} + +size_t fiftyoneDegreesResultsHashGetValuesString( + fiftyoneDegreesResultsHash* results, + const char *propertyName, + char *buffer, + size_t bufferLength, + const char *separator, + fiftyoneDegreesException *exception) { + return 0; +} + +void fiftyoneDegreesResultsHashFromEvidence( + fiftyoneDegreesResultsHash *results, + fiftyoneDegreesEvidenceKeyValuePairArray *evidence, + fiftyoneDegreesException *exception) { + return; +} + +void fiftyoneDegreesEvidenceFree(fiftyoneDegreesEvidenceKeyValuePairArray *evidence) { + return; +} + +void fiftyoneDegreesResultsHashFromUserAgent( + fiftyoneDegreesResultsHash *results, + const char* userAgent, + size_t userAgentLength, + fiftyoneDegreesException *exception) { + return; +} + +fiftyoneDegreesStatusCode fiftyoneDegreesFileReadToByteArray( + const char *fileName, + fiftyoneDegreesMemoryReader *reader) { + return FIFTYONE_DEGREES_STATUS_SUCCESS; +} + +fiftyoneDegreesStatusCode +fiftyoneDegreesHashInitManagerFromMemory( + fiftyoneDegreesResourceManager *manager, + fiftyoneDegreesConfigHash *config, + fiftyoneDegreesPropertiesRequired *properties, + void *memory, + long size, + fiftyoneDegreesException *exception) { + return FIFTYONE_DEGREES_STATUS_SUCCESS; +} + +const char* fiftyoneDegreesStatusGetMessage( + fiftyoneDegreesStatusCode status, + const char *fileName) { + return NULL; +} diff --git a/addons/51degrees/dummy/v4hash/hash/hash.h b/addons/51degrees/dummy/v4hash/hash/hash.h new file mode 100644 index 0000000..5d04d17 --- /dev/null +++ b/addons/51degrees/dummy/v4hash/hash/hash.h @@ -0,0 +1,277 @@ +/* ********************************************************************* + * This Original Work is copyright of 51 Degrees Mobile Experts Limited. + * Copyright 2022 51 Degrees Mobile Experts Limited, Davidson House, + * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU. + * + * This Original Work is the subject of the following patents and patent + * applications, owned by 51 Degrees Mobile Experts Limited of 5 Charlotte + * Close, Caversham, Reading, Berkshire, United Kingdom RG4 7BY: + * European Patent No. 3438848; and + * United States Patent No. 10,482,175. + * + * This Original Work is licensed under the European Union Public Licence + * (EUPL) v.1.2 and is subject to its terms as set out below. + * + * If a copy of the EUPL was not distributed with this file, You can obtain + * one at https://opensource.org/licenses/EUPL-1.2. + * + * The 'Compatible Licences' set out in the Appendix to the EUPL (as may be + * amended by the European Commission) shall be deemed incompatible for + * the purposes of the Work and the provisions of the compatibility + * clause in Article 5 of the EUPL shall not apply. + * + * If using the Work as, or as part of, a network application, by + * including the attribution notice(s) required under Article 5 of the EUPL + * in the end user terms of the application under an appropriate heading, + * such notice(s) shall fulfill the requirements of that article. + * ********************************************************************* */ + +/* ********************************************************************* + * Dummy library for HAProxy. This does not function, and is designed + * solely for HAProxy testing purposes. + * *********************************************************************/ +#ifndef FIFTYONE_DEGREES_HASH_INCLUDED +#define FIFTYONE_DEGREES_HASH_INCLUDED + +#ifndef FIFTYONEDEGREES_DUMMY_LIB +#define FIFTYONEDEGREES_DUMMY_LIB +#endif + +#include <stdlib.h> +#include <inttypes.h> + +typedef int bool; +enum { false, true }; + +typedef unsigned char byte; + +typedef enum e_fiftyone_degrees_status_code { + FIFTYONE_DEGREES_STATUS_SUCCESS, + FIFTYONE_DEGREES_STATUS_NOT_SET, +} fiftyoneDegreesStatusCode; + +typedef struct fiftyone_degrees_exception_t { + unsigned int status; +} fiftyoneDegreesException; + +#define FIFTYONE_DEGREES_EXCEPTION_CLEAR \ + exception->status = FIFTYONE_DEGREES_STATUS_NOT_SET; + +#define FIFTYONE_DEGREES_EXCEPTION_OKAY \ + (exception == NULL || exception->status == FIFTYONE_DEGREES_STATUS_NOT_SET) + +#define FIFTYONE_DEGREES_EXCEPTION_FAILED \ + (!FIFTYONE_DEGREES_EXCEPTION_OKAY) + +#define FIFTYONE_DEGREES_EXCEPTION_CREATE \ + fiftyoneDegreesException exceptionValue; \ + fiftyoneDegreesException *exception = &exceptionValue; \ + FIFTYONE_DEGREES_EXCEPTION_CLEAR + +#define FIFTYONE_DEGREES_ARRAY_TYPE(t, m) \ +typedef struct fiftyone_degrees_array_##t##_t { \ + uint32_t count; \ + uint32_t capacity; \ + t *items; \ + m \ +} t##Array; + +typedef struct fiftyone_degrees_results_base_t { + void *dataSet; +} fiftyoneDegreesResultsBase; + +typedef struct fiftyone_degrees_results_device_detection_t { + fiftyoneDegreesResultsBase b; +} fiftyoneDegreesResultsDeviceDetection; + +typedef struct fiftyone_degrees_collection_item_t { + +} fiftyoneDegreesCollectionItem; + +typedef struct fiftyone_degrees_list_t { + +} fiftyoneDegreesList; + +typedef struct fiftyone_degrees_evidence_key_value_pair_t { + +} fiftyoneDegreesEvidenceKeyValuePair; + +#define EVIDENCE_KEY_VALUE_MEMBERS \ + struct fiftyone_degrees_array_fiftyoneDegreesEvidenceKeyValuePair_t* pseudoEvidence; + +FIFTYONE_DEGREES_ARRAY_TYPE( + fiftyoneDegreesEvidenceKeyValuePair, + EVIDENCE_KEY_VALUE_MEMBERS) + +#define FIFTYONE_DEGREES_RESULTS_HASH_MEMBERS \ + fiftyoneDegreesResultsDeviceDetection b; \ + fiftyoneDegreesCollectionItem propertyItem; \ + fiftyoneDegreesList values; \ + fiftyoneDegreesEvidenceKeyValuePairArray* pseudoEvidence; + +typedef struct fiftyone_degrees_result_hash_t { + +} fiftyoneDegreesResultHash; + +FIFTYONE_DEGREES_ARRAY_TYPE( + fiftyoneDegreesResultHash, + FIFTYONE_DEGREES_RESULTS_HASH_MEMBERS) + +typedef fiftyoneDegreesResultHashArray fiftyoneDegreesResultsHash; + +typedef struct fiftyone_degrees_resource_manager_t { + +} fiftyoneDegreesResourceManager; + +typedef struct fiftyone_degrees_header_t { + const char* name; + size_t nameLength; +} fiftyoneDegreesHeader; + +#define FIFTYONE_DEGREES_HEADERS_MEMBERS \ + bool expectUpperPrefixedHeaders; \ + uint32_t pseudoHeadersCount; + +FIFTYONE_DEGREES_ARRAY_TYPE( + fiftyoneDegreesHeader, + FIFTYONE_DEGREES_HEADERS_MEMBERS); + +typedef fiftyoneDegreesHeaderArray fiftyoneDegreesHeaders; + +typedef struct fiftyone_degrees_dataset_base_t { + fiftyoneDegreesHeaders *uniqueHeaders; +} fiftyoneDegreesDataSetBase; + +typedef struct fiftyone_degrees_dataset_device_detection_t { + fiftyoneDegreesDataSetBase b; +} fiftyoneDegreesDataSetDeviceDetection; + +typedef struct fiftyone_degrees_dataset_hash_t { + fiftyoneDegreesDataSetDeviceDetection b; +} fiftyoneDegreesDataSetHash; + +typedef enum e_fiftyone_degrees_evidence_prefix { + FIFTYONE_DEGREES_EVIDENCE_HTTP_HEADER_STRING = 1 << 0, + FIFTYONE_DEGREES_EVIDENCE_HTTP_HEADER_IP_ADDRESSES = 1 << 1, + FIFTYONE_DEGREES_EVIDENCE_SERVER = 1 << 2, + FIFTYONE_DEGREES_EVIDENCE_QUERY = 1 << 3, + FIFTYONE_DEGREES_EVIDENCE_COOKIE = 1 << 4, + FIFTYONE_DEGREES_EVIDENCE_IGNORE = 1 << 7, +} fiftyoneDegreesEvidencePrefix; + +typedef struct fiftyone_degrees_config_base_t { + bool freeData; +} fiftyoneDegreesConfigBase; + +typedef struct fiftyone_degrees_config_device_detecton_t { + fiftyoneDegreesConfigBase b; + bool allowUnmatched; +} fiftyoneDegreesConfigDeviceDetection; + +typedef struct fiftyone_degrees_collection_config_t { + uint16_t concurrency; +} fiftyoneDegreesCollectionConfig; + +typedef struct fiftyone_degrees_config_hash_t { + fiftyoneDegreesConfigDeviceDetection b; + fiftyoneDegreesCollectionConfig strings; + fiftyoneDegreesCollectionConfig components; + fiftyoneDegreesCollectionConfig maps; + fiftyoneDegreesCollectionConfig properties; + fiftyoneDegreesCollectionConfig values; + fiftyoneDegreesCollectionConfig profiles; + fiftyoneDegreesCollectionConfig rootNodes; + fiftyoneDegreesCollectionConfig nodes; + fiftyoneDegreesCollectionConfig profileOffsets; + int32_t difference; + int32_t drift; + bool usePerformanceGraph; + bool usePredictiveGraph; +} fiftyoneDegreesConfigHash; + +extern fiftyoneDegreesConfigHash fiftyoneDegreesHashInMemoryConfig; + +typedef struct fiftyone_degrees_property_available_t { + +} fiftyoneDegreesPropertyAvailable; + +FIFTYONE_DEGREES_ARRAY_TYPE(fiftyoneDegreesPropertyAvailable,) + +typedef fiftyoneDegreesPropertyAvailableArray fiftyoneDegreesPropertiesAvailable; + +typedef struct fiftyone_degrees_properties_required_t { + const char **array; + int count; + const char *string; + fiftyoneDegreesPropertiesAvailable *existing; +} fiftyoneDegreesPropertiesRequired; + +extern fiftyoneDegreesPropertiesRequired fiftyoneDegreesPropertiesDefault; + +typedef struct fiftyone_degrees_memory_reader_t { + byte *startByte; + byte *current; + byte *lastByte; + long length; +} fiftyoneDegreesMemoryReader; + +fiftyoneDegreesDataSetBase* fiftyoneDegreesDataSetGet( + fiftyoneDegreesResourceManager *manager); + +void fiftyoneDegreesResultsHashFree( + fiftyoneDegreesResultsHash* results); + +fiftyoneDegreesResultsHash* fiftyoneDegreesResultsHashCreate( + fiftyoneDegreesResourceManager *manager, + uint32_t userAgentCapacity, + uint32_t overridesCapacity); + +void fiftyoneDegreesDataSetRelease(fiftyoneDegreesDataSetBase *dataSet); + +fiftyoneDegreesEvidenceKeyValuePairArray* fiftyoneDegreesEvidenceCreate(uint32_t capacity); + +fiftyoneDegreesEvidenceKeyValuePair* fiftyoneDegreesEvidenceAddString( + fiftyoneDegreesEvidenceKeyValuePairArray *evidence, + fiftyoneDegreesEvidencePrefix prefix, + const char *field, + const char *originalValue); + +size_t fiftyoneDegreesResultsHashGetValuesString( + fiftyoneDegreesResultsHash* results, + const char *propertyName, + char *buffer, + size_t bufferLength, + const char *separator, + fiftyoneDegreesException *exception); + +void fiftyoneDegreesResultsHashFromEvidence( + fiftyoneDegreesResultsHash *results, + fiftyoneDegreesEvidenceKeyValuePairArray *evidence, + fiftyoneDegreesException *exception); + +void fiftyoneDegreesEvidenceFree(fiftyoneDegreesEvidenceKeyValuePairArray *evidence); + +void fiftyoneDegreesResultsHashFromUserAgent( + fiftyoneDegreesResultsHash *results, + const char* userAgent, + size_t userAgentLength, + fiftyoneDegreesException *exception); + +fiftyoneDegreesStatusCode fiftyoneDegreesFileReadToByteArray( + const char *fileName, + fiftyoneDegreesMemoryReader *reader); + +fiftyoneDegreesStatusCode +fiftyoneDegreesHashInitManagerFromMemory( + fiftyoneDegreesResourceManager *manager, + fiftyoneDegreesConfigHash *config, + fiftyoneDegreesPropertiesRequired *properties, + void *memory, + long size, + fiftyoneDegreesException *exception); + +const char* fiftyoneDegreesStatusGetMessage( + fiftyoneDegreesStatusCode status, + const char *fileName); + +#endif |