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

Method init

src/proxy/http/remap/RemapPluginInfo.cc:122–154  ·  view source on GitHub ↗

Initialize plugin (required). */

Source from the content-addressed store, hash-verified

120
121/* Initialize plugin (required). */
122bool
123RemapPluginInfo::init(std::string &error)
124{
125 TSRemapInterface ri;
126 bool result = true;
127
128 PluginDbg(_dbg_ctl(), "started initializing plugin '%s'", _configPath.c_str());
129
130 /* A buffer to get the error from the plugin instance init function, be defensive here. */
131 char tmpbuf[2048];
132 ink_zero(tmpbuf);
133
134 ink_zero(ri);
135 ri.size = sizeof(ri);
136 ri.tsremap_version = TSREMAP_VERSION;
137 ri.plugin_info = reinterpret_cast<TSRemapPluginInfo>(this);
138
139 setPluginContext();
140
141 if (init_cb && init_cb(&ri, tmpbuf, sizeof(tmpbuf) - 1) != TS_SUCCESS) {
142 error.assign("failed to initialize plugin ")
143 .append(_configPath.string())
144 .append(": ")
145 .append(tmpbuf[0] ? tmpbuf : "Unknown plugin error");
146 result = false;
147 }
148
149 resetPluginContext();
150
151 PluginDbg(_dbg_ctl(), "finished initializing plugin '%s'", _configPath.c_str());
152
153 return result;
154}
155
156/* Called when plugin is unloaded (optional). */
157void

Callers

nothing calls this directly

Calls 5

ink_zeroFunction · 0.85
c_strMethod · 0.45
appendMethod · 0.45
assignMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected