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

Function setup_callbacks

tests/tools/plugins/ssl_hook_test.cc:302–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302void
303setup_callbacks(TSHttpTxn txn, int preaccept_count, int client_hello_count, int client_hello_count_immediate, int sni_count,
304 int cert_count, int cert_count_immediate, int preaccept_count_delay, int close_count, int out_start_count,
305 int out_start_delay_count, int out_close_count)
306{
307 TSCont cb = nullptr; // pre-accept callback continuation
308 int i;
309
310 Dbg(dbg_ctl, "Setup callbacks pa=%d client_hello=%d client_hello_imm=%d sni=%d cert=%d cert_imm=%d pa_delay=%d", preaccept_count,
311 client_hello_count, client_hello_count_immediate, sni_count, cert_count, cert_count_immediate, preaccept_count_delay);
312 for (i = 0; i < preaccept_count; i++) {
313 cb = TSContCreate(&CB_Pre_Accept, nullptr);
314 TSContDataSet(cb, (void *)static_cast<intptr_t>(i));
315 if (txn) {
316 TSHttpTxnHookAdd(txn, TS_VCONN_START_HOOK, cb);
317 } else {
318 TSHttpHookAdd(TS_VCONN_START_HOOK, cb);
319 }
320 }
321 for (i = 0; i < preaccept_count_delay; i++) {
322 cb = TSContCreate(&CB_Pre_Accept_Delay, nullptr);
323 TSContDataSet(cb, (void *)static_cast<intptr_t>(i));
324 if (txn) {
325 TSHttpTxnHookAdd(txn, TS_VCONN_START_HOOK, cb);
326 } else {
327 TSHttpHookAdd(TS_VCONN_START_HOOK, cb);
328 }
329 }
330 for (i = 0; i < client_hello_count; i++) {
331 cb = TSContCreate(&CB_Client_Hello, TSMutexCreate());
332 TSContDataSet(cb, (void *)static_cast<intptr_t>(i));
333 if (txn) {
334 TSHttpTxnHookAdd(txn, TS_SSL_CLIENT_HELLO_HOOK, cb);
335 } else {
336 TSHttpHookAdd(TS_SSL_CLIENT_HELLO_HOOK, cb);
337 }
338 }
339 for (i = 0; i < client_hello_count_immediate; i++) {
340 cb = TSContCreate(&CB_Client_Hello_Immediate, TSMutexCreate());
341 TSContDataSet(cb, (void *)static_cast<intptr_t>(i));
342 if (txn) {
343 TSHttpTxnHookAdd(txn, TS_SSL_CLIENT_HELLO_HOOK, cb);
344 } else {
345 TSHttpHookAdd(TS_SSL_CLIENT_HELLO_HOOK, cb);
346 }
347 }
348 for (i = 0; i < sni_count; i++) {
349 cb = TSContCreate(&CB_SNI, nullptr);
350 TSContDataSet(cb, (void *)static_cast<intptr_t>(i));
351 if (txn) {
352 TSHttpTxnHookAdd(txn, TS_SSL_SERVERNAME_HOOK, cb);
353 } else {
354 TSHttpHookAdd(TS_SSL_SERVERNAME_HOOK, cb);
355 }
356 }
357 for (i = 0; i < cert_count; i++) {
358 cb = TSContCreate(&CB_Cert, nullptr);
359 TSContDataSet(cb, (void *)static_cast<intptr_t>(i));

Callers 1

TSPluginInitFunction · 0.70

Calls 5

TSContCreateFunction · 0.85
TSContDataSetFunction · 0.85
TSHttpTxnHookAddFunction · 0.85
TSHttpHookAddFunction · 0.85
TSMutexCreateFunction · 0.85

Tested by

no test coverage detected