| 563 | } |
| 564 | |
| 565 | void |
| 566 | TSPluginInit(int argc, const char *argv[]) |
| 567 | { |
| 568 | Dbg(dbg_ctl, "initializing plugin"); |
| 569 | // Initialization data and callback |
| 570 | TSPluginRegistrationInfo info; |
| 571 | TSCont cb_shadow = nullptr; |
| 572 | info.plugin_name = "certifier"; |
| 573 | info.vendor_name = "Apache Software Foundation"; |
| 574 | info.support_email = "dev@trafficserver.apache.org"; |
| 575 | |
| 576 | const char *key = nullptr; |
| 577 | const char *cert = nullptr; |
| 578 | const char *serial = nullptr; |
| 579 | |
| 580 | // Read options from plugin.config |
| 581 | static const struct option longopts[] = { |
| 582 | {"sign-cert", required_argument, nullptr, 'c'}, |
| 583 | {"sign-key", required_argument, nullptr, 'k'}, |
| 584 | {"sign-serial", required_argument, nullptr, 'r'}, |
| 585 | {"max", required_argument, nullptr, 'm'}, |
| 586 | {"store", required_argument, nullptr, 's'}, |
| 587 | {nullptr, no_argument, nullptr, 0 } |
| 588 | }; |
| 589 | |
| 590 | int opt = 0; |
| 591 | while (opt >= 0) { |
| 592 | opt = getopt_long(argc, const_cast<char *const *>(argv), "c:k:r:m:s:", longopts, nullptr); |
| 593 | switch (opt) { |
| 594 | case 'c': { |
| 595 | cert = optarg; |
| 596 | break; |
| 597 | } |
| 598 | case 'k': { |
| 599 | key = optarg; |
| 600 | break; |
| 601 | } |
| 602 | case 'r': { |
| 603 | serial = optarg; |
| 604 | break; |
| 605 | } |
| 606 | case 'm': { |
| 607 | ssl_list.reset(new SslLRUList(static_cast<int>(std::strtol(optarg, nullptr, 0)))); |
| 608 | break; |
| 609 | } |
| 610 | case 's': { |
| 611 | store_path = std::string(optarg); |
| 612 | break; |
| 613 | } |
| 614 | case -1: |
| 615 | case '?': |
| 616 | break; |
| 617 | default: |
| 618 | Dbg(dbg_ctl, "unexpected options"); |
| 619 | TSError("[%s] unexpected options error", PLUGIN_NAME); |
| 620 | return; |
| 621 | } |
| 622 | } |
nothing calls this directly
no test coverage detected