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

Function TSPluginInit

example/plugins/c-api/denylist_1/denylist_1.cc:309–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309void
310TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
311{
312 int i;
313 TSPluginRegistrationInfo info;
314 TSReturnCode error;
315
316 info.plugin_name = PLUGIN_NAME;
317 info.vendor_name = "Apache Software Foundation";
318 info.support_email = "dev@trafficserver.apache.org";
319
320 if (TSPluginRegister(&info) != TS_SUCCESS) {
321 TSError("[%s] Plugin registration failed", PLUGIN_NAME);
322 }
323
324 /* create an TSTextLogObject to log denied requests to */
325 error = TSTextLogObjectCreate("denylist", TS_LOG_MODE_ADD_TIMESTAMP, &ts_log);
326 if (!ts_log || error == TS_ERROR) {
327 Dbg(dbg_ctl, "error while creating log");
328 }
329
330 sites_mutex = TSMutexCreate();
331
332 nsites = 0;
333 for (i = 0; i < MAX_NSITES; i++) {
334 sites[i] = nullptr;
335 }
336
337 global_contp = TSContCreate(denylist_plugin, sites_mutex);
338 read_denylist(global_contp);
339
340 /*TSHttpHookAdd (TS_HTTP_OS_DNS_HOOK, contp); */
341 TSHttpHookAdd(TS_HTTP_TXN_START_HOOK, global_contp);
342}

Callers

nothing calls this directly

Calls 7

TSPluginRegisterFunction · 0.85
TSTextLogObjectCreateFunction · 0.85
TSMutexCreateFunction · 0.85
TSContCreateFunction · 0.85
read_denylistFunction · 0.85
TSHttpHookAddFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected