| 114 | } |
| 115 | |
| 116 | void |
| 117 | TSPluginInit(int argc, const char *argv[]) |
| 118 | { |
| 119 | TSPluginRegistrationInfo info; |
| 120 | char *end; |
| 121 | int tmp; |
| 122 | |
| 123 | info.plugin_name = PLUGIN_NAME; |
| 124 | info.vendor_name = "Apache Software Foundation"; |
| 125 | info.support_email = "dev@trafficserver.apache.org"; |
| 126 | |
| 127 | if (TSPluginRegister(&info) != TS_SUCCESS) { |
| 128 | TSError("[%s] Plugin registration failed", PLUGIN_NAME); |
| 129 | |
| 130 | goto error; |
| 131 | } |
| 132 | |
| 133 | /* default value */ |
| 134 | accept_port = 4666; |
| 135 | server_port = 4666; |
| 136 | |
| 137 | if (argc < 3) { |
| 138 | Dbg(dbg_ctl, "Usage: protocol.so <accept_port> <server_port>. Using default ports accept=%d server=%d", accept_port, |
| 139 | server_port); |
| 140 | } else { |
| 141 | tmp = strtol(argv[1], &end, 10); |
| 142 | if (*end == '\0') { |
| 143 | accept_port = tmp; |
| 144 | Dbg(dbg_ctl, "using accept_port %d", accept_port); |
| 145 | } else { |
| 146 | TSError("[%s] Wrong argument for accept_port, using default port %d", PLUGIN_NAME, accept_port); |
| 147 | } |
| 148 | |
| 149 | tmp = strtol(argv[2], &end, 10); |
| 150 | if (*end == '\0') { |
| 151 | server_port = tmp; |
| 152 | Dbg(dbg_ctl, "using server_port %d", server_port); |
| 153 | } else { |
| 154 | TSError("[%s] Wrong argument for server_port, using default port %d", PLUGIN_NAME, server_port); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | protocol_init(accept_port, server_port); |
| 159 | |
| 160 | error: |
| 161 | TSError("[%s] Plugin not initialized", PLUGIN_NAME); |
| 162 | } |
nothing calls this directly
no test coverage detected