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

Function TSPluginInit

plugins/background_fetch/background_fetch.cc:563–592  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////// Setup global hooks

Source from the content-addressed store, hash-verified

561///////////////////////////////////////////////////////////////////////////
562// Setup global hooks
563void
564TSPluginInit(int argc, const char *argv[])
565{
566 TSPluginRegistrationInfo info;
567
568 info.plugin_name = (char *)PLUGIN_NAME;
569 info.vendor_name = (char *)"Apache Software Foundation";
570 info.support_email = (char *)"dev@trafficserver.apache.org";
571
572 if (TS_SUCCESS != TSPluginRegister(&info)) {
573 TSError("[%s] Plugin registration failed", PLUGIN_NAME);
574 }
575
576 TSCont cont = TSContCreate(cont_handle_response, nullptr);
577
578 gConfig = new BgFetchConfig(cont);
579
580 if (gConfig->parseOptions(argc, argv)) {
581 // Create the global log file. Note that calling this multiple times currently has no
582 // effect, only one log file is ever created. The BgFetchState is a singleton.
583 if (!gConfig->logFile().empty()) {
584 BgFetchState::getInstance().createLog(gConfig->logFile());
585 }
586 Dbg(Bg_dbg_ctl, "Initialized");
587 TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, cont);
588 } else {
589 // ToDo: Hmmm, no way to fail a global plugin here?
590 Dbg(Bg_dbg_ctl, "Failed to initialize as global plugin");
591 }
592}
593
594///////////////////////////////////////////////////////////////////////////
595// Setup Remap mode

Callers

nothing calls this directly

Calls 7

TSPluginRegisterFunction · 0.85
TSContCreateFunction · 0.85
TSHttpHookAddFunction · 0.85
createLogMethod · 0.80
TSErrorFunction · 0.50
parseOptionsMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected