summaryrefslogtreecommitdiffstats
path: root/addons/51degrees/dummy/pattern/51Degrees.c
blob: c002e5cdffb0ab3141005d0812d944833933ee87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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;
}