]>
Commit | Line | Data |
---|---|---|
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 |
15 | namespace Adaptation |
16 | { | |
e1381638 AJ |
17 | namespace 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 | 25 | class OptXact: public Xaction |
774c051c | 26 | { |
5c2f68b7 | 27 | CBDATA_CLASS(OptXact); |
774c051c | 28 | |
29 | public: | |
4299f876 | 30 | OptXact(ServiceRep::Pointer &aService); |
774c051c | 31 | |
774c051c | 32 | protected: |
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 | 47 | private: |
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 | |
55 | class OptXactLauncher: public Launcher | |
c824c43b | 56 | { |
5c2f68b7 AJ |
57 | CBDATA_CLASS(OptXactLauncher); |
58 | ||
c824c43b | 59 | public: |
4299f876 | 60 | OptXactLauncher(Adaptation::ServicePointer aService); |
c824c43b | 61 | |
62 | protected: | |
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 |