atscppapi
1.0.9
C++ wrapper for Apache Traffic Server API
|
The interface used when you wish to transform Request or Response body content. More...
#include "TransformationPlugin.h"
Public Types | |
enum | Type { REQUEST_TRANSFORMATION = 0, RESPONSE_TRANSFORMATION } |
Public Member Functions | |
virtual void | consume (const std::string &data)=0 |
virtual void | handleInputComplete ()=0 |
virtual | ~TransformationPlugin () |
![]() | |
void | registerHook (Plugin::HookType hook_type) |
![]() | |
virtual void | handleReadRequestHeadersPreRemap (Transaction &transaction) |
virtual void | handleReadRequestHeadersPostRemap (Transaction &transaction) |
virtual void | handleSendRequestHeaders (Transaction &transaction) |
virtual void | handleReadResponseHeaders (Transaction &transaction) |
virtual void | handleSendResponseHeaders (Transaction &transaction) |
virtual void | handleOsDns (Transaction &transaction) |
Protected Member Functions | |
size_t | produce (const std::string &) |
size_t | setOutputComplete () |
TransformationPlugin (Transaction &transaction, Type type) | |
![]() | |
TransactionPlugin (Transaction &transaction) | |
shared_ptr< Mutex > | getMutex () |
The interface used when you wish to transform Request or Response body content.
Transformations are deceptively simple, transformations are chained so the output of one TransformationPlugin becomes the input of another TransformationPlugin. As data arrives it will fire a consume() and when all the data has been sent you will receive a handleInputComplete(). Data can be sent to the next TransformationPlugin in the chain by calling produce() and when the transformation has no data left to send it will fire a setOutputCompete().
Since a TransformationPlugin is a type of TransactionPlugin you can call registerHook() and establish any hook for a Transaction also; however, remember that you must implement the appropriate callback for any hooks you register.
A simple example of how to use the TransformationPlugin interface follows, this is an example of a Response transformation, the avialable options are REQUEST_TRANSFORMATION and RESPONSE_TRANSFORMATION which are defined in Type.
This example is a Null Transformation, meaning it will just spit out the content it receives without actually doing any work on it.
|
virtual |
Destructor for a TransformationPlugin
|
protected |
a TransformationPlugin must implement this interface, it cannot be constructed directly
|
pure virtual |
A method that you must implement when writing a TransformationPlugin, this method will be fired whenever an upstream TransformationPlugin has produced output.
Implemented in atscppapi::transformations::GzipInflateTransformation, and atscppapi::transformations::GzipDeflateTransformation.
|
pure virtual |
A method that you must implement when writing a TransformationPlugin, this method will be fired whenever the upstream TransformationPlugin has completed writing data.
Implemented in atscppapi::transformations::GzipInflateTransformation, and atscppapi::transformations::GzipDeflateTransformation.
|
protected |
This method is how a TransformationPlugin will produce output for the downstream transformation plugin, if you need to produce binary data this can still be done with strings by a call to string::assign() or by constructing a string with string::string(char *, size_t).
|
protected |
This is the method that you must call when you're done producing output for the downstream TranformationPlugin.