| 1697 | } |
| 1698 | |
| 1699 | void |
| 1700 | TSPluginInit(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. |
nothing calls this directly
no test coverage detected