atscppapi  1.0.9
C++ wrapper for Apache Traffic Server API
 All Classes Files Functions Enumerations Enumerator Macros
Public Member Functions | Protected Member Functions | List of all members
atscppapi::GlobalPlugin Class Reference

The interface used when creating a GlobalPlugin. More...

#include "GlobalPlugin.h"

Inheritance diagram for atscppapi::GlobalPlugin:
atscppapi::Plugin

Public Member Functions

void registerHook (Plugin::HookType)
 
- Public Member Functions inherited from atscppapi::Plugin
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

 GlobalPlugin (bool ignore_internal_transactions=false)
 

Additional Inherited Members

- Public Types inherited from atscppapi::Plugin
enum  HookType {
  HOOK_READ_REQUEST_HEADERS_PRE_REMAP = 0, HOOK_READ_REQUEST_HEADERS_POST_REMAP, HOOK_SEND_REQUEST_HEADERS, HOOK_READ_RESPONSE_HEADERS,
  HOOK_SEND_RESPONSE_HEADERS, HOOK_OS_DNS
}
 

Detailed Description

The interface used when creating a GlobalPlugin.

A GlobalPlugin is a Plugin that will fire for a given hook on all Transactions. In otherwords, a GlobalPlugin is not tied to a specific plugin, a Transaction specific plugin would be a TransactionPlugin.

Depending on the type of hook you choose to build you will implement one or more callback methods. Here is a simple example of a GlobalPlugin:

class GlobalHookPlugin : public GlobalPlugin {
public:
GlobalHookPlugin() {
}
virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) {
std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl;
transaction.resume();
}
};
See Also
Plugin

Constructor & Destructor Documentation

GlobalPlugin::GlobalPlugin ( bool  ignore_internal_transactions = false)
protected

Constructor.

Parameters
ignore_internal_transactionsWhen true, all hooks registered by this plugin are ignored for internal transactions (internal transactions are created when other plugins create requests). Defaults to false.

Member Function Documentation

void GlobalPlugin::registerHook ( Plugin::HookType  hook_type)

registerHook is the mechanism used to attach a global hook.

Note
Whenever you register a hook you must have the appropriate callback definied in your GlobalPlugin see HookType and Plugin for the correspond HookTypes and callback methods. If you fail to implement the callback, a default implmentation will be used that will only resume the Transaction.
Parameters
HookTypethe type of hook you wish to register
See Also
HookType
Plugin

The documentation for this class was generated from the following files: