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

Function TSPluginInit

example/plugins/c-api/ssl_sni/ssl_sni.cc:93–121  ·  view source on GitHub ↗

Called by ATS as our initialization point

Source from the content-addressed store, hash-verified

91
92// Called by ATS as our initialization point
93void
94TSPluginInit(int /* argc ATS_UNUSED */, const char ** /* argv ATS_UNUSED */)
95{
96 bool success = false;
97 TSPluginRegistrationInfo info;
98 TSCont cb_cert = nullptr; // Certificate callback continuation
99
100 info.plugin_name = PLUGIN_NAME;
101 info.vendor_name = "Apache Software Foundation";
102 info.support_email = "dev@trafficserver.apache.org";
103
104 if (TS_SUCCESS != TSPluginRegister(&info)) {
105 TSError(PCP "registration failed");
106 } else if (TSTrafficServerVersionGetMajor() < 2) {
107 TSError(PCP "requires Traffic Server 2.0 or later");
108 } else if (nullptr == (cb_cert = TSContCreate(&CB_servername, TSMutexCreate()))) {
109 TSError(PCP "Failed to create cert callback");
110 } else {
111 TSHttpHookAdd(TS_SSL_CERT_HOOK, cb_cert);
112 success = true;
113 }
114
115 if (!success) {
116 TSError(PCP "not initialized");
117 }
118 Dbg(dbg_ctl, "Plugin %s", success ? "online" : "offline");
119
120 return;
121}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected