MCPcopy Create free account
hub / github.com/apache/trafficserver / TSPluginInit

Function TSPluginInit

tests/tools/plugins/ssntxnorder_verify.cc:303–342  ·  view source on GitHub ↗

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 */

Source from the content-addressed store, hash-verified

301 - Initializes all statistics as described in the README
302*/
303void
304TSPluginInit(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}

Callers

nothing calls this directly

Calls 7

TSPluginRegisterFunction · 0.85
TSContCreateFunction · 0.85
TSMutexCreateFunction · 0.85
abortFunction · 0.85
TSStatCreateFunction · 0.85
TSHttpHookAddFunction · 0.85
TSLifecycleHookAddFunction · 0.85

Tested by

no test coverage detected