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

Function TSRemapNewInstance

example/plugins/c-api/secure_link/secure_link.cc:168–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168TSReturnCode
169TSRemapNewInstance(int argc, char **argv, void **ih, char *errbuf, int errbuf_size)
170{
171 int i;
172 secure_link_info *sli;
173
174 // squash unused variable warnings ...
175 (void)errbuf;
176 (void)errbuf_size;
177
178 sli = static_cast<secure_link_info *>(TSmalloc(sizeof(secure_link_info)));
179 sli->secret = nullptr;
180 sli->strict = 0;
181
182 for (i = 2; i < argc; i++) {
183 char *ptr;
184 if ((ptr = strchr(argv[i], ':')) != nullptr) {
185 *ptr++ = '\0';
186 if (strcmp(argv[i], "secret") == 0) {
187 if (sli->secret != nullptr) {
188 TSfree(sli->secret);
189 }
190 sli->secret = TSstrdup(ptr);
191 } else if (strcmp(argv[i], "policy") == 0) {
192 sli->strict = !strcasecmp(ptr, "strict");
193 } else {
194 Dbg(dbg_ctl, "Unknown parameter [%s]", argv[i]);
195 }
196 } else {
197 TSError("[%s] Invalid parameter [%s]", PLUGIN_NAME, argv[i]);
198 }
199 }
200
201 if (sli->secret == nullptr) {
202 sli->secret = TSstrdup("");
203 }
204
205 *ih = (void *)sli;
206 return TS_SUCCESS;
207}
208
209void
210TSRemapDeleteInstance(void *ih)

Callers

nothing calls this directly

Calls 6

TSmallocFunction · 0.85
strcmpFunction · 0.85
TSfreeFunction · 0.85
TSstrdupFunction · 0.85
strcasecmpFunction · 0.85
TSErrorFunction · 0.50

Tested by

no test coverage detected