* @brief Global plugin instance initialization. * * Processes the configuration and initializes a global plugin instance. * @param argc plugin arguments number * @param argv plugin arguments */
| 96 | * @param argv plugin arguments |
| 97 | */ |
| 98 | void |
| 99 | TSPluginInit(int argc, const char *argv[]) |
| 100 | { |
| 101 | TSPluginRegistrationInfo info; |
| 102 | |
| 103 | info.plugin_name = PLUGIN_NAME; |
| 104 | info.vendor_name = "Apache Software Foundation"; |
| 105 | info.support_email = "dev@trafficserver.apache.org"; |
| 106 | |
| 107 | if (TSPluginRegister(&info) != TS_SUCCESS) { |
| 108 | CacheKeyError("global plugin registration failed"); |
| 109 | } |
| 110 | |
| 111 | globalConfig = new Configs(); |
| 112 | if (nullptr != globalConfig && globalConfig->init(argc, argv, /* perRemapConfig */ false)) { |
| 113 | TSCont cont = TSContCreate(contSetCachekey, nullptr); |
| 114 | TSHttpHookAdd(TS_HTTP_POST_REMAP_HOOK, cont); |
| 115 | |
| 116 | CacheKeyDebug("global plugin initialized"); |
| 117 | } else { |
| 118 | globalConfig = nullptr; |
| 119 | delete globalConfig; |
| 120 | |
| 121 | CacheKeyError("failed to initialize global plugin"); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * @brief Plugin initialization. |
nothing calls this directly
no test coverage detected