Entry point for the plugin. - Attaches global hooks for session start and close. - Attaches global hooks for transaction start and close. - Attaches lifecycle hook for communication through traffic_ctl - Initializes all statistics as described in the README */
| 301 | - Initializes all statistics as described in the README |
| 302 | */ |
| 303 | void |
| 304 | TSPluginInit(int /* argc ATS_UNUSED */, const char ** /* argv ATS_UNUSED */) |
| 305 | { |
| 306 | Dbg(dbg_ctl_init, "initializing plugin"); |
| 307 | |
| 308 | TSPluginRegistrationInfo info; |
| 309 | |
| 310 | info.plugin_name = plugin_name; |
| 311 | info.vendor_name = vendor_name; |
| 312 | info.support_email = support_email; |
| 313 | |
| 314 | if (TSPluginRegister(&info) != TS_SUCCESS) { |
| 315 | Dbg(dbg_ctl_hook, "[%s] Plugin registration failed. \n", plugin_name); |
| 316 | } |
| 317 | |
| 318 | TSCont contp = TSContCreate(handle_order, TSMutexCreate()); |
| 319 | if (contp == nullptr) { |
| 320 | // Continuation initialization failed. Unrecoverable, report and exit. |
| 321 | Dbg(dbg_ctl_hook, "[%s] could not create continuation", plugin_name); |
| 322 | abort(); |
| 323 | } else { |
| 324 | // Continuation initialization succeeded. |
| 325 | |
| 326 | stat_ssn_start = TSStatCreate("ssntxnorder_verify.ssn.start", TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM); |
| 327 | stat_ssn_close = TSStatCreate("ssntxnorder_verify.ssn.close", TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM); |
| 328 | stat_txn_start = TSStatCreate("ssntxnorder_verify.txn.start", TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM); |
| 329 | stat_txn_close = TSStatCreate("ssntxnorder_verify.txn.close", TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM); |
| 330 | stat_err = TSStatCreate("ssntxnorder_verify.err", TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM); |
| 331 | stat_test_done = TSStatCreate("ssntxnorder_verify.test.done", TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM); |
| 332 | |
| 333 | // Add all hooks. |
| 334 | TSHttpHookAdd(TS_HTTP_SSN_START_HOOK, contp); |
| 335 | TSHttpHookAdd(TS_HTTP_SSN_CLOSE_HOOK, contp); |
| 336 | |
| 337 | TSHttpHookAdd(TS_HTTP_TXN_START_HOOK, contp); |
| 338 | TSHttpHookAdd(TS_HTTP_TXN_CLOSE_HOOK, contp); |
| 339 | |
| 340 | TSLifecycleHookAdd(TS_LIFECYCLE_MSG_HOOK, contp); |
| 341 | } |
| 342 | } |
nothing calls this directly
no test coverage detected