TSRemapInit¶
Traffic Server remap plugin entry points.
概要¶
#include <ts/ts.h> #include <ts/remap.h>
-
TSReturnCode
TSRemapInit
(TSRemapInterface * api_info, char * errbuf, int errbuf_size)¶
-
void
TSRemapDone
(void)¶
-
TSRemapStatus
TSRemapDoRemap
(void * ih, TSHttpTxn rh, TSRemapRequestInfo * rri)¶
-
TSReturnCode
TSRemapNewInstance
(int argc, char * argv[], void ** ih, char * errbuf, int errbuf_size)¶
-
void
TSRemapDeleteInstance
(void *)¶
解説¶
Traffic Server の remap インターフェースはプラグインが HTTP トランザクションを操作するための簡素な仕組みを提供します。remap プラグインは大域的ではありません。それは remap ルール毎に設定され、 remap.config
ファイル内の個々のルールに基づいて URL がどのようにリダイレクトされるかをカスタマイズできるようにしています。一つ以上の remap エントリーポイントを満たすことと、トランザクションがプラグインを通るように remap.config
を設定することから remap プラグインを書くことは成り立っています。複数の remap プラグインが一つの remap ルールに指定されることもあり、HTTP トランザクションを検査する機会が各プラグインに与えられる remap プラグインチェーンとなります。
TSRemapInit()
は必須のエントリーポイントです。この関数は Traffic Serverがプラグインをロードする際に一度だけ呼ばれます。省略可能な TSRemapDone()
関数がある場合、Traffic Server は remap プラグインをアンロードするときにそれを呼び出します。
remap プラグインは異なる remap ルールのために呼び出されます。Traffic Server はプラグインが remap ルールに指定されるたびにエントリーポイントを呼び出します。remap プラグインインスタンスが必要なくなると、Traffic Server は TSRemapDeleteInstance()
を呼び出します。
TSRemapDoRemap()
は各 HTTP トランザクションで呼び出されます。これは必須のエントリーポイントです。この関数では remap プラグインが HTTP トランザクションを検査し変更するかもしれません。
Types¶
-
TSRemapStatus
¶ Status return value for remap callback.
-
TSREMAP_DID_REMAP
¶ The remap callback modified the request.
-
TSREMAP_DID_REMAP_STOP
¶ The remap callback modified the request and that no more remapping callbacks should be invoked.
-
TSREMAP_NO_REMAP
¶ The remap callback did not modify the request.
-
TSREMAP_NO_REMAP_STOP
¶ The remap callback did not modify the request and that no further remapping callbacks should be invoked.
-
TSREMAP_ERROR
¶ The remapping attempt in general failed and the transaction should fail with an error return to the user agent.
-
Return Values¶
TSRemapInit()
と TSRemapNewInstance()
は成功時に TS_SUCCESS
を、それ以外の時には TS_ERROR
を返すべきです。戻り値 TS_ERROR
は回復不可能です。
TSRemapDoRemap()
returns a status code that indicates whether the HTTP transaction has been
modified and whether Traffic Server should continue to evaluate the chain of remap plugins. If the
transaction was modified, the plugin should return TSREMAP_DID_REMAP
or
TSREMAP_DID_REMAP_STOP
; otherwise it should return TSREMAP_NO_REMAP
or
TSREMAP_NO_REMAP_STOP
. If Traffic Server should not send the transaction to subsequent
plugins in the remap chain, return TSREMAP_NO_REMAP_STOP
or TSREMAP_DID_REMAP_STOP
.
Returning TSREMAP_ERROR
causes Traffic Server to stop evaluating the remap chain and respond
with an error.
参照¶
TSAPI(3ts)