------------------------------------------------------------------------- TSPluginInit Function called at plugin init time Input: argc number of args argv list vof args Output : Return Value: -------------------------------------------------------------------------*/
| 959 | Return Value: |
| 960 | -------------------------------------------------------------------------*/ |
| 961 | void |
| 962 | TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED) |
| 963 | { |
| 964 | TSPluginRegistrationInfo info; |
| 965 | int i; |
| 966 | TSReturnCode retval; |
| 967 | |
| 968 | info.plugin_name = "psi"; |
| 969 | info.vendor_name = "Apache"; |
| 970 | info.support_email = ""; |
| 971 | |
| 972 | if (TSPluginRegister(&info) != TS_SUCCESS) { |
| 973 | TSError("[%s] Plugin registration failed", PLUGIN_NAME); |
| 974 | } |
| 975 | |
| 976 | /* Initialize the psi directory = <plugin_path>/include */ |
| 977 | snprintf(psi_directory, sizeof(psi_directory), "%s/%s", TSPluginDirGet(), PSI_PATH); |
| 978 | |
| 979 | /* create an TSTextLogObject to log any psi include */ |
| 980 | retval = TSTextLogObjectCreate("psi", TS_LOG_MODE_ADD_TIMESTAMP, &ts_log); |
| 981 | if (retval == TS_ERROR) { |
| 982 | TSError("[%s] Failed creating log for psi plugin", PLUGIN_NAME); |
| 983 | ts_log = nullptr; |
| 984 | } |
| 985 | |
| 986 | /* Create working threads */ |
| 987 | thread_init(); |
| 988 | init_queue(&job_queue); |
| 989 | |
| 990 | for (i = 0; i < NB_THREADS; i++) { |
| 991 | char *thread_name = static_cast<char *>(TSmalloc(64)); |
| 992 | snprintf(thread_name, 64, "Thread[%d]", i); |
| 993 | if (!TSThreadCreate(thread_loop, thread_name)) { |
| 994 | TSError("[%s] Failed creating threads", PLUGIN_NAME); |
| 995 | return; |
| 996 | } |
| 997 | } |
| 998 | |
| 999 | TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, TSContCreate(read_response_handler, TSMutexCreate())); |
| 1000 | Dbg(dbg_ctl, "Plugin started"); |
| 1001 | } |
nothing calls this directly
no test coverage detected