xref: /trafficserver/iocore/cache/test/stub.cc (revision 97c3b342)
1 /** @file
2 
3   Stub file for linking libinknet.a from unit tests
4 
5   @section license License
6 
7   Licensed to the Apache Software Foundation (ASF) under one
8   or more contributor license agreements.  See the NOTICE file
9   distributed with this work for additional information
10   regarding copyright ownership.  The ASF licenses this file
11   to you under the Apache License, Version 2.0 (the
12   "License"); you may not use this file except in compliance
13   with the License.  You may obtain a copy of the License at
14 
15       http://www.apache.org/licenses/LICENSE-2.0
16 
17   Unless required by applicable law or agreed to in writing, software
18   distributed under the License is distributed on an "AS IS" BASIS,
19   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   See the License for the specific language governing permissions and
21   limitations under the License.
22  */
23 
24 #include "HttpSessionManager.h"
25 #include "HttpBodyFactory.h"
26 #include "DiagsConfig.h"
27 #include "ts/InkAPIPrivateIOCore.h"
28 
29 void
30 initialize_thread_for_http_sessions(EThread *, int)
31 {
32   ink_assert(false);
33 }
34 
35 #include "InkAPIInternal.h"
36 void
37 APIHooks::append(INKContInternal *cont)
38 {
39 }
40 
41 int
42 APIHook::invoke(int, void *)
43 {
44   ink_assert(false);
45   return 0;
46 }
47 
48 APIHook *
49 APIHook::next() const
50 {
51   ink_assert(false);
52   return nullptr;
53 }
54 
55 APIHook *
56 APIHooks::get() const
57 {
58   return nullptr;
59 }
60 
61 void
62 APIHooks::prepend(INKContInternal *cont)
63 {
64 }
65 
66 void
67 APIHooks::clear()
68 {
69 }
70 
71 void
72 ConfigUpdateCbTable::invoke(const char * /* name ATS_UNUSED */)
73 {
74   ink_release_assert(false);
75 }
76 
77 HttpAPIHooks *http_global_hooks        = nullptr;
78 SslAPIHooks *ssl_hooks                 = nullptr;
79 LifecycleAPIHooks *lifecycle_hooks     = nullptr;
80 ConfigUpdateCbTable *global_config_cbs = nullptr;
81 
82 HttpBodyFactory *body_factory = nullptr;
83 
84 intmax_t
85 ts::svtoi(TextView src, TextView *out, int base)
86 {
87   intmax_t zret = 0;
88 
89   if (out) {
90     out->clear();
91   }
92   if (!(0 <= base && base <= 36)) {
93     return 0;
94   }
95   if (src.ltrim_if(&isspace) && src) {
96     const char *start = src.data();
97     int8_t v;
98     bool neg = false;
99     if ('-' == *src) {
100       ++src;
101       neg = true;
102     }
103     // If base is 0, it wasn't specified - check for standard base prefixes
104     if (0 == base) {
105       base = 10;
106       if ('0' == *src) {
107         ++src;
108         base = 8;
109         if (src && ('x' == *src || 'X' == *src)) {
110           ++src;
111           base = 16;
112         }
113       }
114     }
115 
116     // For performance in common cases, use the templated conversion.
117     switch (base) {
118     case 8:
119       zret = svto_radix<8>(src);
120       break;
121     case 10:
122       zret = svto_radix<10>(src);
123       break;
124     case 16:
125       zret = svto_radix<16>(src);
126       break;
127     default:
128       while (src.size() && (0 <= (v = svtoi_convert[static_cast<unsigned char>(*src)])) && v < base) {
129         auto n = zret * base + v;
130         if (n < zret) {
131           zret = std::numeric_limits<uintmax_t>::max();
132           break; // overflow, stop parsing.
133         }
134         zret = n;
135         ++src;
136       }
137       break;
138     }
139 
140     if (out && (src.data() > (neg ? start + 1 : start))) {
141       out->assign(start, src.data());
142     }
143 
144     if (neg) {
145       zret = -zret;
146     }
147   }
148   return zret;
149 }
150 
151 void
152 HostStatus::setHostStatus(const char *name, HostStatus_t status, const unsigned int down_time, const unsigned int reason)
153 {
154 }
155 
156 HostStatRec *
157 HostStatus::getHostStatus(const char *name)
158 {
159   return nullptr;
160 }
161 
162 void
163 HostStatus::createHostStat(const char *name, const char *data)
164 {
165 }
166 
167 HostStatus::HostStatus() {}
168 
169 HostStatus::~HostStatus() {}
170 
171 int auto_clear_hostdb_flag = 0;
172 bool ts_is_draining        = false;
173 
174 void
175 INKVConnInternal::do_io_close(int error)
176 {
177 }
178 
179 void
180 INKVConnInternal::do_io_shutdown(ShutdownHowTo_t howto)
181 {
182 }
183 
184 VIO *
185 INKVConnInternal::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
186 {
187   return nullptr;
188 }
189 
190 VIO *
191 INKVConnInternal::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
192 {
193   return nullptr;
194 }
195 
196 void
197 INKVConnInternal::destroy()
198 {
199 }
200 
201 void
202 INKVConnInternal::free()
203 {
204 }
205 
206 void
207 INKVConnInternal::clear()
208 {
209 }
210 
211 void
212 INKVConnInternal::reenable(VIO * /* vio ATS_UNUSED */)
213 {
214 }
215 
216 bool
217 INKVConnInternal::get_data(int id, void *data)
218 {
219   return false;
220 }
221 
222 bool
223 INKVConnInternal::set_data(int id, void *data)
224 {
225   return false;
226 }
227 
228 void
229 INKVConnInternal::do_io_transform(VConnection *vc)
230 {
231 }
232 
233 void
234 INKContInternal::handle_event_count(int event)
235 {
236 }
237 
238 void
239 INKVConnInternal::retry(unsigned int delay)
240 {
241 }
242 
243 INKContInternal::INKContInternal(TSEventFunc funcp, TSMutex mutexp) : DummyVConnection((ProxyMutex *)mutexp) {}
244 
245 INKContInternal::INKContInternal() : DummyVConnection(nullptr) {}
246 
247 void
248 INKContInternal::destroy()
249 {
250 }
251 
252 void
253 INKContInternal::clear()
254 {
255 }
256 
257 void
258 INKContInternal::free()
259 {
260 }
261 
262 INKVConnInternal::INKVConnInternal() : INKContInternal() {}
263 
264 INKVConnInternal::INKVConnInternal(TSEventFunc funcp, TSMutex mutexp) : INKContInternal(funcp, mutexp) {}
265