Called by ATS as our initialization point
| 96 | |
| 97 | // Called by ATS as our initialization point |
| 98 | void |
| 99 | TSPluginInit(int /* argc ATS_UNUSED */, const char ** /* argv ATS_UNUSED */) |
| 100 | { |
| 101 | TSPluginRegistrationInfo info; |
| 102 | info.plugin_name = const_cast<char *>("user_args"); |
| 103 | info.vendor_name = const_cast<char *>("apache"); |
| 104 | info.support_email = const_cast<char *>("dev@trafficserver.apache.org"); |
| 105 | if (TSPluginRegister(&info) != TS_SUCCESS) { |
| 106 | TSError("[%s] Plugin registration failed", PLUGIN_NAME); |
| 107 | } |
| 108 | |
| 109 | if (TS_SUCCESS != TSUserArgIndexReserve(TS_USER_ARGS_TXN, PLUGIN_NAME, "User args tests TXN", &gIX.TXN)) { |
| 110 | TSError("[%s] Unable to initialize plugin (disabled). Failed to reserve TXN arg.", PLUGIN_NAME); |
| 111 | return; |
| 112 | } else if (TS_SUCCESS != TSUserArgIndexReserve(TS_USER_ARGS_SSN, PLUGIN_NAME, "User args tests SSN", &gIX.SSN)) { |
| 113 | TSError("[%s] Unable to initialize plugin (disabled). Failed to reserve SSN arg.", PLUGIN_NAME); |
| 114 | return; |
| 115 | } else if (TS_SUCCESS != TSUserArgIndexReserve(TS_USER_ARGS_VCONN, PLUGIN_NAME, "User args tests VCONN", &gIX.VCONN)) { |
| 116 | TSError("[%s] Unable to initialize plugin (disabled). Failed to reserve VCONN arg.", PLUGIN_NAME); |
| 117 | return; |
| 118 | } else if (TS_SUCCESS != TSUserArgIndexReserve(TS_USER_ARGS_GLB, PLUGIN_NAME, "User args tests GLB", &gIX.GLB)) { |
| 119 | TSError("[%s] Unable to initialize plugin (disabled). Failed to reserve GLB arg.", PLUGIN_NAME); |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | // Setup the global slot value |
| 124 | TSUserArgSet(nullptr, gIX.GLB, (void *)"Global Data"); |
| 125 | |
| 126 | gIX.contp = TSContCreate(cont_global, nullptr); |
| 127 | TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, gIX.contp); |
| 128 | } |
| 129 | |
| 130 | TSReturnCode |
| 131 | TSRemapInit(TSRemapInterface *api_info, char * /* errbuf ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */) |
nothing calls this directly
no test coverage detected