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

Function TSRemapNewInstance

plugins/conf_remap/conf_remap.cc:285–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283}
284
285TSReturnCode
286TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */)
287{
288 if (argc < 3) {
289 TSError("[%s] Unable to create remap instance, need configuration file", PLUGIN_NAME);
290 return TS_ERROR;
291 }
292
293 RemapConfigs *conf = new (RemapConfigs);
294 for (int i = 2; i < argc; ++i) {
295 if (strchr(argv[i], '=') != nullptr) {
296 // Parse as an inline key=value pair ...
297 if (!conf->parse_inline(argv[i])) {
298 goto fail;
299 }
300 } else {
301 // Parse as a config file ...
302 if (!conf->parse_file(argv[i])) {
303 goto fail;
304 }
305 }
306 }
307
308 *ih = static_cast<void *>(conf);
309 return TS_SUCCESS;
310
311fail:
312 delete conf;
313 return TS_ERROR;
314}
315
316void
317TSRemapDeleteInstance(void *ih)

Callers

nothing calls this directly

Calls 3

parse_inlineMethod · 0.80
parse_fileMethod · 0.80
TSErrorFunction · 0.50

Tested by

no test coverage detected