Public Member Functions | Protected Member Functions

atscppapi::GlobalPlugin Class Reference

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

#include <GlobalPlugin.h>

Inherits atscppapi::Plugin.

Collaboration diagram for atscppapi::GlobalPlugin:
Collaboration graph
[legend]

Public Member Functions

void registerHook (Plugin::HookType)
 registerHook is the mechanism used to attach a global hook.
virtual ~GlobalPlugin ()

Protected Member Functions

 GlobalPlugin (bool ignore_internal_transactions=false)
 Constructor.

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() {
   registerHook(HOOK_READ_REQUEST_HEADERS_PRE_REMAP);
  }
  virtual void handleReadRequestHeadersPreRemap(Transaction &transaction) {
    std::cout << "Hello from handleReadRequesHeadersPreRemap!" << std::endl;
    transaction.resume();
  }
 };
See also:
Plugin

Definition at line 59 of file GlobalPlugin.h.


Constructor & Destructor Documentation

virtual atscppapi::GlobalPlugin::~GlobalPlugin (  )  [virtual]
atscppapi::GlobalPlugin::GlobalPlugin ( bool  ignore_internal_transactions = false  )  [protected]

Constructor.

Parameters:
ignore_internal_transactions When 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 atscppapi::GlobalPlugin::registerHook ( Plugin::HookType   ) 

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:
HookType the type of hook you wish to register
See also:
HookType
Plugin

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