summaryrefslogtreecommitdiffstats
path: root/addons/wurfl/dummy/dummy-wurfl.c
blob: 0d5f068280fc198666b5b69586d06bf301c219dc (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
115
116
117
118
119
120
121
122
123
124
125
126
/*
 * InFuze C API - HAPROXY Dummy library version of include
 *
 * Author : Paul Stephen Borile, Mon Apr 8, 2019
 * Copyright (c) ScientiaMobile, Inc.
 * http://www.scientiamobile.com
 *
 * This is a dummy implementation of the wurfl C API that builds and runs
 * like the normal API simply without returning device detection data
 *
 *
 */

#include "wurfl/wurfl.h"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"

const char *wurfl_get_api_version(void)
{
 return "1.11.2.100"; // 100 indicates the dummy
}

wurfl_handle wurfl_create(void)
{
  return (void*) 0xbeffa;
}

void wurfl_destroy(wurfl_handle handle)
{
  return;
}

wurfl_error wurfl_set_root(wurfl_handle hwurfl, const char* root)
{
  return WURFL_OK;
}
wurfl_error wurfl_add_patch(wurfl_handle hwurfl, const char *patch)
{
  return WURFL_OK;
}

wurfl_error wurfl_add_requested_capability(wurfl_handle hwurfl, const char *requested_capability)
{
  return WURFL_OK;
}

const char *wurfl_get_error_message(wurfl_handle hwurfl)
{
  return "wurfl dummy library error message";
}

int wurfl_has_virtual_capability(wurfl_handle hwurfl, const char *virtual_capability)
{
  return 0;
}

wurfl_error wurfl_set_cache_provider(wurfl_handle hwurfl, wurfl_cache_provider cache_provider, const char *config)
{
  return WURFL_OK;
}

wurfl_error wurfl_load(wurfl_handle hwurfl)
{
  return WURFL_OK;
}

wurfl_device_handle wurfl_lookup(wurfl_handle hwurfl, wurfl_header_retrieve_callback header_retrieve_callback, const void *header_retrieve_callback_data)
{
  // call callback, on a probably existing header
  const char *hvalue = header_retrieve_callback("User-Agent", header_retrieve_callback_data);
  // and on a non existing one
  hvalue = header_retrieve_callback("Non-Existing-Header", header_retrieve_callback_data);
  (void)hvalue;
  return (void *) 0xdeffa;
}

const char *wurfl_device_get_capability(wurfl_device_handle hwurfldevice, const char *capability)
{
  return "dummy_cap_val";
}

const char *wurfl_device_get_virtual_capability(wurfl_device_handle hwurfldevice, const char *capability)
{
  return "dummy_vcap_val";
}

void wurfl_device_destroy(wurfl_device_handle handle)
{
  return;
}

const char *wurfl_device_get_id(wurfl_device_handle hwurfldevice)
{
  return "generic_dummy_device";
}

const char *wurfl_device_get_root_id(wurfl_device_handle hwurfldevice)
{
  return "generic_dummy_device";
}

const char *wurfl_device_get_original_useragent(wurfl_device_handle hwurfldevice)
{
  return "original_useragent";
}
const char *wurfl_device_get_normalized_useragent(wurfl_device_handle hwurfldevice)
{
  return "normalized_useragent";
}
int wurfl_device_is_actual_device_root(wurfl_device_handle hwurfldevice)
{
  return 1;
}

const char *wurfl_get_wurfl_info(wurfl_handle hwurfl)
{
  return "dummy wurfl info";
}

const char *wurfl_get_last_load_time_as_string(wurfl_handle hwurfl)
{
  return "dummy wurfl last load time";
}

#pragma GCC diagnostic pop