TSPluginInit¶
Traffic Server plugin loading and registration.
概要¶
#include <ts/ts.h>
-
void
TSPluginInit
(int argc, const char* argv[])¶
-
TSReturnCode
TSPluginRegister
(TSPluginRegistrationInfo* plugin_info)¶
解説¶
TSPluginInit()
はすべてのプラグインで定義されなければなりません。 Traffic Server はプラグインを読み込み argc と argv を plugin.config
の値をもとに適切に設定する際にこの初期化ルーチンを呼びます。
argc is a count of the number of arguments in the argument vector, argv. The count is at least one because the first argument in the argument vector is the plugins name, which must exist in order for the plugin to be loaded.
TSPluginRegister()
registers the appropriate SDK version specific in
sdk_version for your plugin. Use this function to make sure that the
version of Traffic Server on which your plugin is running supports the plugin.
Return Values¶
TSPluginRegister()
はプラグインの登録に失敗すると TS_ERROR
を返します。
例¶
#include <ts/ts.h>
void
TSPluginInit (int argc, const char *argv[])
{
TSPluginRegistrationInfo info;
info.plugin_name = "hello-world";
info.vendor_name = "MyCompany";
info.support_email = "ts-api-support@MyCompany.com";
if (TSPluginRegister(&info) != TS_SUCCESS) {
TSError("Plugin registration failed. 0);
}
}
参照¶
TSAPI(3ts), TSInstallDirGet(3ts)