atscppapi
1.0.9
C++ wrapper for Apache Traffic Server API
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Enumerations
Enumerator
Macros
src
include
atscppapi
Plugin.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2013 LinkedIn Corp. All rights reserved.
3
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4
* except in compliance with the License. You may obtain a copy of the license at
5
* http://www.apache.org/licenses/LICENSE-2.0
6
*
7
* Unless required by applicable law or agreed to in writing, software distributed under the
8
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
9
* either express or implied.
10
*
11
*/
12
13
/**
14
* @file Plugin.h
15
* @author Brian Geffon
16
* @author Manjesh Nilange
17
*
18
* @brief Contains the base interface used in creating Global and Transaciton plugins.
19
* \note This interface can never be implemented directly, it should be implemented
20
* through extending GlobalPlugin, TransactionPlugin, or TransformationPlugin.
21
*/
22
23
#pragma once
24
#ifndef ATSCPPAPI_PLUGIN_H_
25
#define ATSCPPAPI_PLUGIN_H_
26
27
#include <
atscppapi/Transaction.h
>
28
#include <
atscppapi/noncopyable.h
>
29
30
namespace
atscppapi {
31
32
/**
33
* @brief The base interface used when creating a Plugin.
34
*
35
* \note This interface can never be implemented directly, it should be implemented
36
* through extending GlobalPlugin, TransactionPlugin, or TransformationPlugin.
37
*
38
* @see TransactionPlugin
39
* @see GlobalPlugin
40
* @see TransformationPlugin
41
*/
42
class
Plugin
: noncopyable {
43
public
:
44
/**
45
* A enumeration of the available types of Hooks. These are used with GlobalPlugin::registerHook()
46
* and TransactionPlugin::registerHook().
47
*/
48
enum
HookType
{
49
HOOK_READ_REQUEST_HEADERS_PRE_REMAP
= 0,
/**< This hook will be fired before remap has occured. */
50
HOOK_READ_REQUEST_HEADERS_POST_REMAP
,
/**< This hook will be fired directly after remap has occured. */
51
HOOK_SEND_REQUEST_HEADERS
,
/**< This hook will be fired right before request headers are sent to the origin */
52
HOOK_READ_RESPONSE_HEADERS
,
/**< This hook will be fired right after response headers have been read from the origin */
53
HOOK_SEND_RESPONSE_HEADERS
,
/**< This hook will be fired right before the response headers are sent to the client */
54
HOOK_OS_DNS
/**< This hook will be fired right after the OS DNS lookup */
55
};
56
57
/**
58
* This method must be implemented when you hook HOOK_READ_REQUEST_HEADERS_PRE_REMAP
59
*/
60
virtual
void
handleReadRequestHeadersPreRemap
(
Transaction
&transaction) { transaction.
resume
(); };
61
62
/**
63
* This method must be implemented when you hook HOOK_READ_REQUEST_HEADERS_POST_REMAP
64
*/
65
virtual
void
handleReadRequestHeadersPostRemap
(
Transaction
&transaction) { transaction.
resume
(); };
66
67
/**
68
* This method must be implemented when you hook HOOK_SEND_REQUEST_HEADERS
69
*/
70
virtual
void
handleSendRequestHeaders
(
Transaction
&transaction) { transaction.
resume
(); };
71
72
/**
73
* This method must be implemented when you hook HOOK_READ_RESPONSE_HEADERS
74
*/
75
virtual
void
handleReadResponseHeaders
(
Transaction
&transaction) { transaction.
resume
(); };
76
77
/**
78
* This method must be implemented when you hook HOOK_SEND_RESPONSE_HEADERS
79
*/
80
virtual
void
handleSendResponseHeaders
(
Transaction
&transaction) { transaction.
resume
(); };
81
82
/**
83
* This method must be implemented when you hook HOOK_OS_DNS
84
*/
85
virtual
void
handleOsDns
(
Transaction
&transaction) { transaction.
resume
(); };
86
87
virtual
~
Plugin
() { };
88
protected
:
89
/**
90
* \note This interface can never be implemented directly, it should be implemented
91
* through extending GlobalPlugin, TransactionPlugin, or TransformationPlugin.
92
*
93
* @private
94
*/
95
Plugin() { };
96
};
97
98
/**< Human readable strings for each HookType, you can access them as HOOK_TYPE_STRINGS[HOOK_OS_DNS] for example. */
99
extern
const
std::string HOOK_TYPE_STRINGS[];
100
101
}
/* atscppapi */
102
103
#endif
/* ATSCPPAPI_GLOBALPLUGIN_H_ */
Generated on Mon Oct 14 2013 11:39:29 for atscppapi by
1.8.3.1