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

Function TSPluginInit

example/plugins/c-api/session_hooks/session_hooks.cc:86–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void
87TSPluginInit(int /* argc ATS_UNUSED */, const char ** /* argv ATS_UNUSED */)
88{
89 TSCont contp;
90 TSPluginRegistrationInfo info;
91
92 info.plugin_name = PLUGIN_NAME;
93 info.vendor_name = "Apache Software Foundation";
94 info.support_email = "dev@trafficserver.apache.org";
95
96 if (TSPluginRegister(&info) != TS_SUCCESS) {
97 TSError("[%s] Plugin registration failed.\n", PLUGIN_NAME);
98
99 goto error;
100 }
101
102 transaction_count_stat = TSStatCreate("transaction.count", TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM);
103 session_count_stat = TSStatCreate("session.count", TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM);
104
105 contp = TSContCreate(ssn_handler, nullptr);
106 TSHttpHookAdd(TS_HTTP_SSN_START_HOOK, contp);
107
108error:
109 TSError("[%s] Plugin not initialized", PLUGIN_NAME);
110}

Callers

nothing calls this directly

Calls 5

TSPluginRegisterFunction · 0.85
TSStatCreateFunction · 0.85
TSContCreateFunction · 0.85
TSHttpHookAddFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected