]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/icap/OptXact.h
Source Format Enforcement (#963)
[thirdparty/squid.git] / src / adaptation / icap / OptXact.h
CommitLineData
774c051c 1/*
bf95c10a 2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
774c051c 3 *
bbc27441
AJ
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.
774c051c 7 */
8
9#ifndef SQUID_ICAPOPTXACT_H
10#define SQUID_ICAPOPTXACT_H
11
26cc52cb 12#include "adaptation/icap/Launcher.h"
602d9612 13#include "adaptation/icap/Xaction.h"
774c051c 14
af6a12ee
AJ
15namespace Adaptation
16{
e1381638
AJ
17namespace Icap
18{
c824c43b 19
26cc52cb 20/* OptXact sends an ICAP OPTIONS request to the ICAP service,
c824c43b 21 * parses the ICAP response, and sends it to the initiator. A NULL response
22 * means the ICAP service could not be contacted or did not return any
23 * valid response. */
774c051c 24
26cc52cb 25class OptXact: public Xaction
774c051c 26{
5c2f68b7 27 CBDATA_CLASS(OptXact);
774c051c 28
29public:
4299f876 30 OptXact(ServiceRep::Pointer &aService);
774c051c 31
774c051c 32protected:
2b6b1bcb 33 /* Xaction API */
5f8252d2 34 virtual void start();
2b6b1bcb 35 virtual void startShoveling();
774c051c 36 virtual void handleCommWrote(size_t size);
37 virtual void handleCommRead(size_t size);
38
39 void makeRequest(MemBuf &buf);
c7d51c86 40 bool parseResponse();
774c051c 41
42 void startReading();
0a1ac29e 43 virtual bool doneReading() const { return commEof || readAll; }
774c051c 44
3ff65596
AR
45 virtual void swanSong();
46
774c051c 47private:
3ff65596 48 virtual void finalizeLogInfo();
0a1ac29e
AR
49
50 bool readAll; ///< read the entire OPTIONS response
774c051c 51};
52
26cc52cb
AR
53// An Launcher that stores OptXact construction info and
54// creates OptXact when needed
55class OptXactLauncher: public Launcher
c824c43b 56{
5c2f68b7
AJ
57 CBDATA_CLASS(OptXactLauncher);
58
c824c43b 59public:
4299f876 60 OptXactLauncher(Adaptation::ServicePointer aService);
c824c43b 61
62protected:
26cc52cb 63 virtual Xaction *createXaction();
c824c43b 64};
5f8252d2 65
26cc52cb
AR
66} // namespace Icap
67} // namespace Adaptation
68
774c051c 69#endif /* SQUID_ICAPOPTXACT_H */
f53969cc 70