XactionRep.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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_ECAP_XACTION_REP_H
12#define SQUID_ECAP_XACTION_REP_H
13
16#include "adaptation/Initiate.h"
17#include "adaptation/Message.h"
18#include "BodyPipe.h"
19#include <libecap/common/forward.h>
20#include <libecap/common/memory.h>
21#include <libecap/host/xaction.h>
22#include <libecap/adapter/xaction.h>
23
24namespace Adaptation
25{
26namespace Ecap
27{
28
29/* The eCAP xaction representative maintains information about a single eCAP
30 xaction that Squid communicates with. One eCAP module may register many
31 eCAP xactions. */
33 public BodyConsumer, public BodyProducer
34{
36
37public:
39 virtual ~XactionRep();
40
41 typedef libecap::shared_ptr<libecap::adapter::Xaction> AdapterXaction;
42 void master(const AdapterXaction &aMaster); // establish a link
43
44 // libecap::host::Xaction API
45 virtual const libecap::Area option(const libecap::Name &name) const;
46 virtual void visitEachOption(libecap::NamedValueVisitor &visitor) const;
47 virtual libecap::Message &virgin();
48 virtual const libecap::Message &cause();
49 virtual libecap::Message &adapted();
50 virtual void useVirgin();
51 virtual void useAdapted(const libecap::shared_ptr<libecap::Message> &msg);
52 virtual void blockVirgin();
53 virtual void adaptationDelayed(const libecap::Delay &);
54 virtual void adaptationAborted();
55 virtual void resume();
56 virtual void vbDiscard();
57 virtual void vbMake();
58 virtual void vbStopMaking();
59 virtual void vbMakeMore();
60 virtual libecap::Area vbContent(libecap::size_type offset, libecap::size_type size);
61 virtual void vbContentShift(libecap::size_type size);
62 virtual void noteAbContentDone(bool atEnd);
63 virtual void noteAbContentAvailable();
64
65 // BodyProducer API
68
69 // BodyConsumer API
73
74 // Initiate API
75 virtual void noteInitiatorAborted();
76
77 // AsyncJob API (via Initiate)
78 virtual void start();
79 virtual bool doneAll() const;
80 virtual void swanSong();
81 virtual const char *status() const;
82
83protected:
85
87
88 void sinkVb(const char *reason);
89 void preserveVb(const char *reason);
90 void forgetVb(const char *reason);
91
92 void moveAbContent();
93
95 void terminateMaster();
96 void scheduleStop(const char *reason);
98
99 const libecap::Area clientIpValue() const;
100 const libecap::Area usernameValue() const;
101 const libecap::Area masterxSharedValue(const libecap::Name &name) const;
103 const libecap::Area metaValue(const libecap::Name &name) const;
105 void visitEachMetaHeader(libecap::NamedValueVisitor &visitor) const;
106
107 void doResume();
108
109private:
110 AdapterXaction theMaster; // the actual adaptation xaction we represent
112
115
116 typedef libecap::shared_ptr<libecap::Message> MessagePtr;
118
120 OperationState makingVb; //< delivering virgin body from pipe to adapter
121 OperationState proxyingAb; // delivering adapted body from adapter to core
123 bool vbProductionFinished; // whether there can be no more vb bytes
124 bool abProductionFinished; // whether adapter has finished producing ab
125 bool abProductionAtEnd; // whether adapter produced a complete ab
127};
128
129} // namespace Ecap
130} // namespace Adaptation
131
132#endif /* SQUID_ECAP_XACTION_REP_H */
133
int size
Definition: ModDevPoll.cc:75
virtual libecap::Message & virgin()
Definition: XactionRep.cc:304
virtual void adaptationDelayed(const libecap::Delay &)
Definition: XactionRep.cc:611
void preserveVb(const char *reason)
Definition: XactionRep.cc:364
Adaptation::ServicePointer theService
xaction's adaptation service
Definition: XactionRep.h:111
libecap::shared_ptr< libecap::Message > MessagePtr
Definition: XactionRep.h:116
void visitEachMetaHeader(libecap::NamedValueVisitor &visitor) const
Return the adaptation meta headers and their values.
Definition: XactionRep.cc:205
virtual void useAdapted(const libecap::shared_ptr< libecap::Message > &msg)
Definition: XactionRep.cc:413
virtual void start()
called by AsyncStart; do not call directly
Definition: XactionRep.cc:223
const libecap::Area clientIpValue() const
Definition: XactionRep.cc:122
virtual libecap::Area vbContent(libecap::size_type offset, libecap::size_type size)
Definition: XactionRep.cc:545
virtual const char * status() const
internal cleanup; do not call directly
Definition: XactionRep.cc:692
virtual void noteAbContentAvailable()
Definition: XactionRep.cc:593
void forgetVb(const char *reason)
Definition: XactionRep.cc:380
virtual void noteBodyConsumerAborted(RefCount< BodyPipe > bp)
Definition: XactionRep.cc:633
const libecap::Area metaValue(const libecap::Name &name) const
Return the adaptation meta header value for the given header "name".
Definition: XactionRep.cc:182
virtual void noteMoreBodyDataAvailable(RefCount< BodyPipe > bp)
Definition: XactionRep.cc:643
const libecap::Area usernameValue() const
Definition: XactionRep.cc:147
virtual void noteBodyProductionEnded(RefCount< BodyPipe > bp)
Definition: XactionRep.cc:651
void scheduleStop(const char *reason)
virtual void noteInitiatorAborted()
Definition: XactionRep.cc:669
virtual const libecap::Area option(const libecap::Name &name) const
Definition: XactionRep.cc:87
virtual void visitEachOption(libecap::NamedValueVisitor &visitor) const
Definition: XactionRep.cc:103
virtual void noteAbContentDone(bool atEnd)
Definition: XactionRep.cc:583
XactionRep(Http::Message *virginHeader, HttpRequest *virginCause, AccessLogEntry::Pointer &alp, const Adaptation::ServicePointer &service)
Definition: XactionRep.cc:47
void updateHistory(Http::Message *adapted)
Definition: XactionRep.cc:459
virtual bool doneAll() const
whether positive goal has been reached
Definition: XactionRep.cc:342
virtual libecap::Message & adapted()
Definition: XactionRep.cc:317
int adaptHistoryId
adaptation history slot reservation
Definition: XactionRep.h:122
void updateSources(Http::Message *adapted)
Definition: XactionRep.cc:735
const libecap::Area masterxSharedValue(const libecap::Name &name) const
Definition: XactionRep.cc:165
Adaptation::Message & answer()
Definition: XactionRep.cc:324
AccessLogEntry::Pointer al
Master transaction AccessLogEntry.
Definition: XactionRep.h:126
virtual void adaptationAborted()
Definition: XactionRep.cc:619
virtual void noteMoreBodySpaceAvailable(RefCount< BodyPipe > bp)
Definition: XactionRep.cc:626
void master(const AdapterXaction &aMaster)
Definition: XactionRep.cc:72
virtual void vbContentShift(libecap::size_type size)
Definition: XactionRep.cc:569
libecap::shared_ptr< libecap::adapter::Xaction > AdapterXaction
Definition: XactionRep.h:41
void sinkVb(const char *reason)
Definition: XactionRep.cc:350
virtual void noteBodyProducerAborted(RefCount< BodyPipe > bp)
Definition: XactionRep.cc:660
virtual const libecap::Message & cause()
Definition: XactionRep.cc:310
common parts of HttpRequest and HttpReply
Definition: Message.h:26

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors