Lines Matching refs:category
61 int category; member
69 size_t cnt = ctx->callback(buf, num, ctx->category, OSSL_TRACE_CTRL_WRITE, in trace_write()
94 ctx->callback("", 0, ctx->category, cmd, ctx->data); in trace_ctrl()
197 static int trace_attach_cb(int category, int type, const void *data) in trace_attach_cb() argument
202 data, trace_categories[category].name); in trace_attach_cb()
206 (const char *)data, trace_categories[category].name); in trace_attach_cb()
210 (const char *)data, trace_categories[category].name); in trace_attach_cb()
218 static int trace_detach_cb(int category, int type, const void *data) in trace_detach_cb() argument
223 data, trace_categories[category].name); in trace_detach_cb()
227 (const char *)data, trace_categories[category].name); in trace_detach_cb()
231 (const char *)data, trace_categories[category].name); in trace_detach_cb()
246 static int set_trace_data(int category, int type, BIO **channel, in set_trace_data() argument
259 curr_channel = trace_channels[category].bio; in set_trace_data()
260 curr_prefix = trace_channels[category].prefix; in set_trace_data()
261 curr_suffix = trace_channels[category].suffix; in set_trace_data()
265 detach_cb(category, PREFIX, curr_prefix); in set_trace_data()
269 detach_cb(category, SUFFIX, curr_suffix); in set_trace_data()
273 detach_cb(category, CHANNEL, curr_channel); in set_trace_data()
279 trace_channels[category].prefix = NULL; in set_trace_data()
284 trace_channels[category].suffix = NULL; in set_trace_data()
289 trace_channels[category].type = 0; in set_trace_data()
290 trace_channels[category].bio = NULL; in set_trace_data()
297 trace_channels[category].prefix = curr_prefix; in set_trace_data()
303 trace_channels[category].suffix = curr_suffix; in set_trace_data()
307 trace_channels[category].type = type; in set_trace_data()
308 trace_channels[category].bio = *channel; in set_trace_data()
317 attach_cb(category, CHANNEL, *channel); in set_trace_data()
321 attach_cb(category, PREFIX, *prefix); in set_trace_data()
325 attach_cb(category, SUFFIX, *suffix); in set_trace_data()
342 int category; in ossl_trace_cleanup() local
347 for (category = 0; category < OSSL_TRACE_CATEGORY_NUM; category++) { in ossl_trace_cleanup()
349 if (category == OSSL_TRACE_CATEGORY_TRACE) in ossl_trace_cleanup()
351 set_trace_data(category, 0, &channel, &prefix, &suffix, in ossl_trace_cleanup()
361 int OSSL_trace_set_channel(int category, BIO *channel) in OSSL_trace_set_channel() argument
364 if (category >= 0 && category < OSSL_TRACE_CATEGORY_NUM) in OSSL_trace_set_channel()
365 return set_trace_data(category, SIMPLE_CHANNEL, &channel, NULL, NULL, in OSSL_trace_set_channel()
372 static int trace_attach_w_callback_cb(int category, int type, const void *data) in trace_attach_w_callback_cb() argument
378 data, trace_categories[category].name); in trace_attach_w_callback_cb()
382 (const char *)data, trace_categories[category].name); in trace_attach_w_callback_cb()
386 (const char *)data, trace_categories[category].name); in trace_attach_w_callback_cb()
395 int OSSL_trace_set_callback(int category, OSSL_trace_cb callback, void *data) in OSSL_trace_set_callback() argument
401 if (category < 0 || category >= OSSL_TRACE_CATEGORY_NUM) in OSSL_trace_set_callback()
411 trace_data->category = category; in OSSL_trace_set_callback()
417 if (!set_trace_data(category, CALLBACK_CHANNEL, &channel, NULL, NULL, in OSSL_trace_set_callback()
431 int OSSL_trace_set_prefix(int category, const char *prefix) in OSSL_trace_set_prefix() argument
434 if (category >= 0 && category < OSSL_TRACE_CATEGORY_NUM) in OSSL_trace_set_prefix()
435 return set_trace_data(category, 0, NULL, &prefix, NULL, in OSSL_trace_set_prefix()
441 int OSSL_trace_set_suffix(int category, const char *suffix) in OSSL_trace_set_suffix() argument
444 if (category >= 0 && category < OSSL_TRACE_CATEGORY_NUM) in OSSL_trace_set_suffix()
445 return set_trace_data(category, 0, NULL, NULL, &suffix, in OSSL_trace_set_suffix()
452 static int ossl_trace_get_category(int category) in ossl_trace_get_category() argument
454 if (category < 0 || category >= OSSL_TRACE_CATEGORY_NUM) in ossl_trace_get_category()
456 if (trace_channels[category].bio != NULL) in ossl_trace_get_category()
457 return category; in ossl_trace_get_category()
462 int OSSL_trace_enabled(int category) in OSSL_trace_enabled() argument
466 category = ossl_trace_get_category(category); in OSSL_trace_enabled()
467 if (category >= 0) in OSSL_trace_enabled()
468 ret = trace_channels[category].bio != NULL; in OSSL_trace_enabled()
473 BIO *OSSL_trace_begin(int category) in OSSL_trace_begin() argument
479 category = ossl_trace_get_category(category); in OSSL_trace_begin()
480 if (category < 0 || !OSSL_trace_enabled(category)) in OSSL_trace_begin()
483 channel = trace_channels[category].bio; in OSSL_trace_begin()
484 prefix = trace_channels[category].prefix; in OSSL_trace_begin()
490 switch (trace_channels[category].type) { in OSSL_trace_begin()
507 void OSSL_trace_end(int category, BIO *channel) in OSSL_trace_end() argument
512 category = ossl_trace_get_category(category); in OSSL_trace_end()
513 if (category < 0) in OSSL_trace_end()
515 suffix = trace_channels[category].suffix; in OSSL_trace_end()
519 switch (trace_channels[category].type) { in OSSL_trace_end()