1 /*
2  * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #include "squid.h"
10 // XXX: need src/ to avoid clashes with ip/tools.h in testIpAddress
11 #include "src/tools.h"
12 
13 #define STUB_API "tools.cc"
14 #include "tests/STUB.h"
15 
16 int DebugSignal = -1;
17 SBuf service_name(APP_SHORTNAME);
releaseServerSockets(void)18 void releaseServerSockets(void) STUB_NOP
19 char * dead_msg(void) STUB_RETVAL(NULL)
20 void mail_warranty(void) STUB
21 void dumpMallocStats(void) STUB
22 void squid_getrusage(struct rusage *r) STUB
23 double rusage_cputime(struct rusage *r) STUB_RETVAL(0)
24 int rusage_maxrss(struct rusage *r) STUB_RETVAL(0)
25 int rusage_pagefaults(struct rusage *r) STUB_RETVAL(0)
26 void PrintRusage(void) STUB
27 void death(int sig) STUB
28 void BroadcastSignalIfAny(int& sig) STUB
29 void sigusr2_handle(int sig) STUB
30 void debug_trap(const char *message) STUB
31 void sig_child(int sig) STUB
32 const char * getMyHostname(void) STUB_RETVAL(NULL)
33 const char * uniqueHostname(void) STUB_RETVAL(NULL)
34 void leave_suid(void) STUB_NOP
35 void enter_suid(void) STUB
36 void no_suid(void) STUB
37 
38 bool
39 IamMasterProcess()
40 {
41     //std::cerr << STUB_API << " IamMasterProcess() Not implemented\n";
42     // Since most tests run as a single process, this is the best default.
43     // TODO: If some test case uses multiple processes and cares about
44     // its role, we may need to parameterize or remove this stub.
45     return true;
46 }
47 
48 bool
IamWorkerProcess()49 IamWorkerProcess()
50 {
51     //std::cerr << STUB_API << " IamWorkerProcess() Not implemented\n";
52     return true;
53 }
54 
55 bool IamDiskProcess() STUB_RETVAL_NOP(false)
56 bool InDaemonMode() STUB_RETVAL_NOP(false)
57 bool UsingSmp() STUB_RETVAL_NOP(false)
58 bool IamCoordinatorProcess() STUB_RETVAL(false)
59 bool IamPrimaryProcess() STUB_RETVAL(false)
60 int NumberOfKids() STUB_RETVAL(0)
61 
62 //not actually needed in the Stub, causes dependency on SBuf
63 //SBuf ProcessRoles() STUB_RETVAL(SBuf())
64 void setMaxFD(void) STUB
65 void setSystemLimits(void) STUB
66 void squid_signal(int sig, SIGHDLR * func, int flags) STUB
67 void logsFlush(void) STUB
68 void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm) STUB
69 void parseEtcHosts(void) STUB
70 int getMyPort(void) STUB_RETVAL(0)
71 void setUmask(mode_t mask) STUB
72 void strwordquote(MemBuf * mb, const char *str) STUB
73 void keepCapabilities(void) STUB
74 void restoreCapabilities(bool keep) STUB
75 pid_t WaitForOnePid(pid_t pid, PidStatus &status, int flags) STUB_RETVAL(0)
76 
77 #if _SQUID_WINDOWS_
78 SBuf WindowsErrorMessage(DWORD) STUB_RETVAL(SBuf())
79 #endif // _SQUID_WINDOWS_
80 
81