Squid Web Cache master
Loading...
Searching...
No Matches
XactionRep.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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/* DEBUG: section 93 eCAP Interface */
10
11#ifndef SQUID_SRC_ADAPTATION_ECAP_XACTIONREP_H
12#define SQUID_SRC_ADAPTATION_ECAP_XACTIONREP_H
13
16#include "adaptation/Initiate.h"
17#include "adaptation/Message.h"
18#include "BodyPipe.h"
19
20#if HAVE_LIBECAP_ADAPTER_XACTION_H
21#include <libecap/adapter/xaction.h>
22#endif
23#if HAVE_LIBECAP_HOST_XACTION_H
24#include <libecap/host/xaction.h>
25#endif
26
27namespace Adaptation
28{
29namespace Ecap
30{
31
32/* The eCAP xaction representative maintains information about a single eCAP
33 xaction that Squid communicates with. One eCAP module may register many
34 eCAP xactions. */
35class XactionRep : public Adaptation::Initiate, public libecap::host::Xaction,
36 public BodyConsumer, public BodyProducer
37{
39
40public:
42 ~XactionRep() override;
43
44 typedef libecap::shared_ptr<libecap::adapter::Xaction> AdapterXaction;
45 void master(const AdapterXaction &aMaster); // establish a link
46
47 // libecap::host::Xaction API
48 const libecap::Area option(const libecap::Name &name) const override;
49 void visitEachOption(libecap::NamedValueVisitor &visitor) const override;
50 libecap::Message &virgin() override;
51 const libecap::Message &cause() override;
52 libecap::Message &adapted() override;
53 void useVirgin() override;
54 void useAdapted(const libecap::shared_ptr<libecap::Message> &msg) override;
55 void blockVirgin() override;
56 void adaptationDelayed(const libecap::Delay &) override;
57 void adaptationAborted() override;
58 void resume() override;
59 void vbDiscard() override;
60 void vbMake() override;
61 void vbStopMaking() override;
62 void vbMakeMore() override;
63 libecap::Area vbContent(libecap::size_type offset, libecap::size_type size) override;
64 void vbContentShift(libecap::size_type size) override;
65 void noteAbContentDone(bool atEnd) override;
66 void noteAbContentAvailable() override;
67
68 // BodyProducer API
71
72 // BodyConsumer API
76
77 // Initiate API
78 void noteInitiatorAborted() override;
79
80 // AsyncJob API (via Initiate)
81 void start() override;
82 bool doneAll() const override;
83 void swanSong() override;
84 const char *status() const override;
85
86protected:
88
90
91 void sinkVb(const char *reason);
92 void preserveVb(const char *reason);
93 void forgetVb(const char *reason);
94
95 void moveAbContent();
96
98 void terminateMaster();
99 void scheduleStop(const char *reason);
101
102 const libecap::Area clientIpValue() const;
103 const libecap::Area usernameValue() const;
104 const libecap::Area masterxSharedValue(const libecap::Name &name) const;
106 const libecap::Area metaValue(const libecap::Name &name) const;
108 void visitEachMetaHeader(libecap::NamedValueVisitor &visitor) const;
109
110 void doResume();
111
112private:
113 AdapterXaction theMaster; // the actual adaptation xaction we represent
115
118
119 typedef libecap::shared_ptr<libecap::Message> MessagePtr;
121
123 OperationState makingVb; //< delivering virgin body from pipe to adapter
124 OperationState proxyingAb; // delivering adapted body from adapter to core
126 bool vbProductionFinished; // whether there can be no more vb bytes
127 bool abProductionFinished; // whether adapter has finished producing ab
128 bool abProductionAtEnd; // whether adapter produced a complete ab
130};
131
132} // namespace Ecap
133} // namespace Adaptation
134
135#endif /* SQUID_SRC_ADAPTATION_ECAP_XACTIONREP_H */
136
int size
Definition ModDevPoll.cc:70
void preserveVb(const char *reason)
const char * status() const override
internal cleanup; do not call directly
bool doneAll() const override
whether positive goal has been reached
void noteMoreBodySpaceAvailable(RefCount< BodyPipe > bp) override
Adaptation::ServicePointer theService
xaction's adaptation service
Definition XactionRep.h:114
void noteMoreBodyDataAvailable(RefCount< BodyPipe > bp) override
libecap::shared_ptr< libecap::Message > MessagePtr
Definition XactionRep.h:119
void visitEachMetaHeader(libecap::NamedValueVisitor &visitor) const
Return the adaptation meta headers and their values.
const libecap::Area clientIpValue() const
void noteInitiatorAborted() override
void forgetVb(const char *reason)
void start() override
called by AsyncStart; do not call directly
const libecap::Area metaValue(const libecap::Name &name) const
Return the adaptation meta header value for the given header "name".
const libecap::Area usernameValue() const
void adaptationDelayed(const libecap::Delay &) override
void noteAbContentAvailable() override
void adaptationAborted() override
void scheduleStop(const char *reason)
const libecap::Area option(const libecap::Name &name) const override
Definition XactionRep.cc:95
libecap::Message & adapted() override
void noteAbContentDone(bool atEnd) override
void updateHistory(Http::Message *adapted)
void visitEachOption(libecap::NamedValueVisitor &visitor) const override
int adaptHistoryId
adaptation history slot reservation
Definition XactionRep.h:125
void updateSources(Http::Message *adapted)
const libecap::Area masterxSharedValue(const libecap::Name &name) const
Adaptation::Message & answer()
void noteBodyProducerAborted(RefCount< BodyPipe > bp) override
void noteBodyProductionEnded(RefCount< BodyPipe > bp) override
AccessLogEntry::Pointer al
Master transaction AccessLogEntry.
Definition XactionRep.h:129
libecap::Message & virgin() override
const libecap::Message & cause() override
void master(const AdapterXaction &aMaster)
Definition XactionRep.cc:80
libecap::shared_ptr< libecap::adapter::Xaction > AdapterXaction
Definition XactionRep.h:44
libecap::Area vbContent(libecap::size_type offset, libecap::size_type size) override
void sinkVb(const char *reason)
void useAdapted(const libecap::shared_ptr< libecap::Message > &msg) override
void noteBodyConsumerAborted(RefCount< BodyPipe > bp) override
void vbContentShift(libecap::size_type size) override
common parts of HttpRequest and HttpReply
Definition Message.h:26