| 283 | } |
| 284 | |
| 285 | TSReturnCode |
| 286 | TSRemapNewInstance(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 | |
| 311 | fail: |
| 312 | delete conf; |
| 313 | return TS_ERROR; |
| 314 | } |
| 315 | |
| 316 | void |
| 317 | TSRemapDeleteInstance(void *ih) |
nothing calls this directly
no test coverage detected