xref: /trafficserver/iocore/cache/test/stub.cc (revision 4cfd5a73)
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
initialize_thread_for_http_sessions(EThread *,int)30 initialize_thread_for_http_sessions(EThread *, int)
31 {
32   ink_assert(false);
33 }
34 
35 #include "InkAPIInternal.h"
36 void
append(INKContInternal * cont)37 APIHooks::append(INKContInternal *cont)
38 {
39 }
40 
41 int
invoke(int,void *) const42 APIHook::invoke(int, void *) const
43 {
44   ink_assert(false);
45   return 0;
46 }
47 
48 APIHook *
next() const49 APIHook::next() const
50 {
51   ink_assert(false);
52   return nullptr;
53 }
54 
55 APIHook *
head() const56 APIHooks::head() const
57 {
58   return nullptr;
59 }
60 
61 void
clear()62 APIHooks::clear()
63 {
64 }
65 
HttpHookState()66 HttpHookState::HttpHookState() {}
67 
68 void
init(TSHttpHookID id,HttpAPIHooks const * global,HttpAPIHooks const * ssn,HttpAPIHooks const * txn)69 HttpHookState::init(TSHttpHookID id, HttpAPIHooks const *global, HttpAPIHooks const *ssn, HttpAPIHooks const *txn)
70 {
71 }
72 
73 APIHook const *
getNext()74 HttpHookState::getNext()
75 {
76   return nullptr;
77 }
78 
79 void
invoke(const char *)80 ConfigUpdateCbTable::invoke(const char * /* name ATS_UNUSED */)
81 {
82   ink_release_assert(false);
83 }
84 
85 HttpAPIHooks *http_global_hooks        = nullptr;
86 SslAPIHooks *ssl_hooks                 = nullptr;
87 LifecycleAPIHooks *lifecycle_hooks     = nullptr;
88 ConfigUpdateCbTable *global_config_cbs = nullptr;
89 
90 HttpBodyFactory *body_factory = nullptr;
91 
92 intmax_t
svtoi(TextView src,TextView * out,int base)93 ts::svtoi(TextView src, TextView *out, int base)
94 {
95   intmax_t zret = 0;
96 
97   if (out) {
98     out->clear();
99   }
100   if (!(0 <= base && base <= 36)) {
101     return 0;
102   }
103   if (src.ltrim_if(&isspace) && src) {
104     const char *start = src.data();
105     int8_t v;
106     bool neg = false;
107     if ('-' == *src) {
108       ++src;
109       neg = true;
110     }
111     // If base is 0, it wasn't specified - check for standard base prefixes
112     if (0 == base) {
113       base = 10;
114       if ('0' == *src) {
115         ++src;
116         base = 8;
117         if (src && ('x' == *src || 'X' == *src)) {
118           ++src;
119           base = 16;
120         }
121       }
122     }
123 
124     // For performance in common cases, use the templated conversion.
125     switch (base) {
126     case 8:
127       zret = svto_radix<8>(src);
128       break;
129     case 10:
130       zret = svto_radix<10>(src);
131       break;
132     case 16:
133       zret = svto_radix<16>(src);
134       break;
135     default:
136       while (src.size() && (0 <= (v = svtoi_convert[static_cast<unsigned char>(*src)])) && v < base) {
137         auto n = zret * base + v;
138         if (n < zret) {
139           zret = std::numeric_limits<uintmax_t>::max();
140           break; // overflow, stop parsing.
141         }
142         zret = n;
143         ++src;
144       }
145       break;
146     }
147 
148     if (out && (src.data() > (neg ? start + 1 : start))) {
149       out->assign(start, src.data());
150     }
151 
152     if (neg) {
153       zret = -zret;
154     }
155   }
156   return zret;
157 }
158 
159 void
setHostStatus(const char * name,HostStatus_t status,const unsigned int down_time,const unsigned int reason)160 HostStatus::setHostStatus(const char *name, HostStatus_t status, const unsigned int down_time, const unsigned int reason)
161 {
162 }
163 
164 HostStatRec *
getHostStatus(const char * name)165 HostStatus::getHostStatus(const char *name)
166 {
167   return nullptr;
168 }
169 
170 void
createHostStat(const char * name,const char * data)171 HostStatus::createHostStat(const char *name, const char *data)
172 {
173 }
174 
HostStatus()175 HostStatus::HostStatus() {}
176 
~HostStatus()177 HostStatus::~HostStatus() {}
178 
179 int auto_clear_hostdb_flag = 0;
180 bool ts_is_draining        = false;
181 
182 void
do_io_close(int error)183 INKVConnInternal::do_io_close(int error)
184 {
185 }
186 
187 void
do_io_shutdown(ShutdownHowTo_t howto)188 INKVConnInternal::do_io_shutdown(ShutdownHowTo_t howto)
189 {
190 }
191 
192 VIO *
do_io_write(Continuation * c,int64_t nbytes,IOBufferReader * buf,bool owner)193 INKVConnInternal::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *buf, bool owner)
194 {
195   return nullptr;
196 }
197 
198 VIO *
do_io_read(Continuation * c,int64_t nbytes,MIOBuffer * buf)199 INKVConnInternal::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
200 {
201   return nullptr;
202 }
203 
204 void
destroy()205 INKVConnInternal::destroy()
206 {
207 }
208 
209 void
free()210 INKVConnInternal::free()
211 {
212 }
213 
214 void
clear()215 INKVConnInternal::clear()
216 {
217 }
218 
219 void
reenable(VIO *)220 INKVConnInternal::reenable(VIO * /* vio ATS_UNUSED */)
221 {
222 }
223 
224 bool
get_data(int id,void * data)225 INKVConnInternal::get_data(int id, void *data)
226 {
227   return false;
228 }
229 
230 bool
set_data(int id,void * data)231 INKVConnInternal::set_data(int id, void *data)
232 {
233   return false;
234 }
235 
236 void
do_io_transform(VConnection * vc)237 INKVConnInternal::do_io_transform(VConnection *vc)
238 {
239 }
240 
241 void
handle_event_count(int event)242 INKContInternal::handle_event_count(int event)
243 {
244 }
245 
246 void
retry(unsigned int delay)247 INKVConnInternal::retry(unsigned int delay)
248 {
249 }
250 
INKContInternal(TSEventFunc funcp,TSMutex mutexp)251 INKContInternal::INKContInternal(TSEventFunc funcp, TSMutex mutexp) : DummyVConnection(reinterpret_cast<ProxyMutex *>(mutexp)) {}
252 
INKContInternal()253 INKContInternal::INKContInternal() : DummyVConnection(nullptr) {}
254 
255 void
destroy()256 INKContInternal::destroy()
257 {
258 }
259 
260 void
clear()261 INKContInternal::clear()
262 {
263 }
264 
265 void
free()266 INKContInternal::free()
267 {
268 }
269 
INKVConnInternal()270 INKVConnInternal::INKVConnInternal() : INKContInternal() {}
271 
INKVConnInternal(TSEventFunc funcp,TSMutex mutexp)272 INKVConnInternal::INKVConnInternal(TSEventFunc funcp, TSMutex mutexp) : INKContInternal(funcp, mutexp) {}
273