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

Function TSPluginInit

tests/tools/plugins/user_args.cc:98–128  ·  view source on GitHub ↗

Called by ATS as our initialization point

Source from the content-addressed store, hash-verified

96
97// Called by ATS as our initialization point
98void
99TSPluginInit(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
130TSReturnCode
131TSRemapInit(TSRemapInterface *api_info, char * /* errbuf ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */)

Callers

nothing calls this directly

Calls 6

TSPluginRegisterFunction · 0.85
TSUserArgIndexReserveFunction · 0.85
TSUserArgSetFunction · 0.85
TSContCreateFunction · 0.85
TSHttpHookAddFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected