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

Function TSPluginInit

plugins/esi/esi.cc:1699–1733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1697}
1698
1699void
1700TSPluginInit(int argc, const char *argv[])
1701{
1702 TSPluginRegistrationInfo info;
1703 info.plugin_name = (char *)"esi";
1704 info.vendor_name = (char *)"Apache Software Foundation";
1705 info.support_email = (char *)"dev@trafficserver.apache.org";
1706
1707 if (TSPluginRegister(&info) != TS_SUCCESS) {
1708 TSError("[esi][%s] plugin registration failed", __FUNCTION__);
1709 return;
1710 }
1711
1712 auto pOptionInfo = TSRalloc<OptionInfo>();
1713 if (pOptionInfo == nullptr) {
1714 TSError("[esi][%s] malloc %d bytes fail", __FUNCTION__, static_cast<int>(sizeof(OptionInfo)));
1715 return;
1716 }
1717 if (esiPluginInit(argc, argv, pOptionInfo) != 0) {
1718 TSfree(pOptionInfo);
1719 return;
1720 }
1721
1722 TSCont global_contp = TSContCreate(globalHookHandler, nullptr);
1723 if (!global_contp) {
1724 TSError("[esi][%s] Could not create global continuation", __FUNCTION__);
1725 TSfree(pOptionInfo);
1726 return;
1727 }
1728 TSContDataSet(global_contp, pOptionInfo);
1729
1730 TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, global_contp);
1731 TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, global_contp);
1732 TSHttpHookAdd(TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK, global_contp);
1733}
1734
1735///////////////////////////////////////////////////////////////////////////////
1736// Initialize the plugin as a remap plugin.

Callers

nothing calls this directly

Calls 7

TSPluginRegisterFunction · 0.85
esiPluginInitFunction · 0.85
TSfreeFunction · 0.85
TSContCreateFunction · 0.85
TSContDataSetFunction · 0.85
TSHttpHookAddFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected