1
/* (C) 2008 The Measurement Factory */
3
#ifndef ECAP__HOST_XACTION_H
4
#define ECAP__HOST_XACTION_H
6
#include <libecap/common/forward.h>
7
#include <libecap/common/call.h>
8
#include <libecap/common/area.h>
9
#include <libecap/common/options.h>
14
// The host side of the eCAP transaction.
15
// Adapter::Xaction uses this interface to get a virgin message from the host.
16
class Xaction: public Callable, public Options {
20
// access to messages; these methods throw if the message is missing
21
virtual Message &virgin() = 0; // request or response, always present
22
virtual const Message &cause() = 0; // request for the above response
23
virtual Message &adapted() = 0; // returns useAdapted() message
25
// adaptation decision making
26
virtual void useVirgin() = 0; // use virgin; no adaptation
27
virtual void useAdapted(const shared_ptr<Message> &msg) = 0; // use msg
28
virtual void blockVirgin() = 0; // block or deny user access
30
// adapter transaction state notifications
31
virtual void adaptationDelayed(const Delay &) = 0; // needs time
32
virtual void adaptationAborted() = 0; // abnormal termination
34
// virgin body transmission control
35
virtual void vbDiscard() = 0; // adapter will not look at vb at all
36
virtual void vbMake() = 0; // adapter may look at vb
37
virtual void vbStopMaking() = 0; // adapter no longer needs vb
38
virtual void vbMakeMore() = 0; // adapter must have more vb
39
virtual void vbPause() {}; // ignored by default
40
virtual void vbResume() {}; // ignored iff vbPause is
42
// virgin body content extraction and consumption
43
virtual Area vbContent(size_type offset, size_type size) = 0;
44
virtual void vbContentShift(size_type size) = 0; // first size bytes
45
// TODO: add something like virtual void vbSearch(Searcher &s) = 0;
47
// adapted body state notification
48
virtual void noteAbContentDone(bool atEnd) = 0; // successful or not
49
virtual void noteAbContentAvailable() = 0;
53
} // namespace libecap