34
34
#define SQUID_ICAPOPTXACT_H
36
36
#include "ICAPXaction.h"
37
#include "ICAPLauncher.h"
40
42
/* ICAPOptXact sends an ICAP OPTIONS request to the ICAP service,
41
* converts the response into ICAPOptions object, and notifies
42
* the caller via the callback. NULL options objects means the
43
* ICAP service could not be contacted or did not return any response */
43
* parses the ICAP response, and sends it to the initiator. A NULL response
44
* means the ICAP service could not be contacted or did not return any
45
47
class ICAPOptXact: public ICAPXaction
49
typedef void Callback(ICAPOptXact*, void *data);
52
virtual ~ICAPOptXact();
54
void start(ICAPServiceRep::Pointer &aService, Callback *aCb, void *aCbData);
56
ICAPOptions *options; // result for the caller to take/handle
51
ICAPOptXact(ICAPInitiator *anInitiator, ICAPServiceRep::Pointer &aService);
59
55
virtual void handleCommConnected();
60
56
virtual void handleCommWrote(size_t size);
61
57
virtual void handleCommRead(size_t size);
62
virtual bool doneAll() const;
64
59
void makeRequest(MemBuf &buf);
60
HttpMsg *parseResponse();
67
62
void startReading();
69
virtual void doStop();
75
65
CBDATA_CLASS2(ICAPOptXact);
68
// An ICAPLauncher that stores ICAPOptXact construction info and
69
// creates ICAPOptXact when needed
70
class ICAPOptXactLauncher: public ICAPLauncher
73
ICAPOptXactLauncher(ICAPInitiator *anInitiator, ICAPServiceRep::Pointer &aService);
76
virtual ICAPXaction *createXaction();
79
CBDATA_CLASS2(ICAPOptXactLauncher);
78
82
#endif /* SQUID_ICAPOPTXACT_H */