Lines Matching refs:qlog
57 QLOG *qlog = OPENSSL_zalloc(sizeof(QLOG)); in ossl_qlog_new() local
59 if (qlog == NULL) in ossl_qlog_new()
62 qlog->info.odcid = info->odcid; in ossl_qlog_new()
63 qlog->info.is_server = info->is_server; in ossl_qlog_new()
64 qlog->info.now_cb = info->now_cb; in ossl_qlog_new()
65 qlog->info.now_cb_arg = info->now_cb_arg; in ossl_qlog_new()
66 qlog->info.override_process_id = info->override_process_id; in ossl_qlog_new()
69 && (qlog->info.title = OPENSSL_strdup(info->title)) == NULL) in ossl_qlog_new()
73 && (qlog->info.description = OPENSSL_strdup(info->description)) == NULL) in ossl_qlog_new()
77 && (qlog->info.group_id = OPENSSL_strdup(info->group_id)) == NULL) in ossl_qlog_new()
81 && (qlog->info.override_impl_name in ossl_qlog_new()
85 if (!ossl_json_init(&qlog->json, NULL, in ossl_qlog_new()
89 if (qlog->info.now_cb == NULL) in ossl_qlog_new()
90 qlog->info.now_cb = default_now; in ossl_qlog_new()
92 return qlog; in ossl_qlog_new()
95 if (qlog != NULL) { in ossl_qlog_new()
96 OPENSSL_free((char *)qlog->info.title); in ossl_qlog_new()
97 OPENSSL_free((char *)qlog->info.description); in ossl_qlog_new()
98 OPENSSL_free((char *)qlog->info.group_id); in ossl_qlog_new()
99 OPENSSL_free((char *)qlog->info.override_impl_name); in ossl_qlog_new()
100 OPENSSL_free(qlog); in ossl_qlog_new()
107 QLOG *qlog = NULL; in ossl_qlog_new_from_env() local
138 qlog = ossl_qlog_new(info); in ossl_qlog_new_from_env()
139 if (qlog == NULL) in ossl_qlog_new_from_env()
142 if (!ossl_qlog_set_sink_filename(qlog, filename)) in ossl_qlog_new_from_env()
148 if (!ossl_qlog_set_filter(qlog, qfilter)) in ossl_qlog_new_from_env()
152 return qlog; in ossl_qlog_new_from_env()
156 ossl_qlog_free(qlog); in ossl_qlog_new_from_env()
160 void ossl_qlog_free(QLOG *qlog) in ossl_qlog_free() argument
162 if (qlog == NULL) in ossl_qlog_free()
165 ossl_json_flush_cleanup(&qlog->json); in ossl_qlog_free()
166 BIO_free_all(qlog->bio); in ossl_qlog_free()
167 OPENSSL_free((char *)qlog->info.title); in ossl_qlog_free()
168 OPENSSL_free((char *)qlog->info.description); in ossl_qlog_free()
169 OPENSSL_free((char *)qlog->info.group_id); in ossl_qlog_free()
170 OPENSSL_free((char *)qlog->info.override_impl_name); in ossl_qlog_free()
171 OPENSSL_free(qlog); in ossl_qlog_free()
178 int ossl_qlog_set_sink_bio(QLOG *qlog, BIO *bio) in ossl_qlog_set_sink_bio() argument
180 if (qlog == NULL) in ossl_qlog_set_sink_bio()
183 ossl_qlog_flush(qlog); /* best effort */ in ossl_qlog_set_sink_bio()
184 BIO_free_all(qlog->bio); in ossl_qlog_set_sink_bio()
185 qlog->bio = bio; in ossl_qlog_set_sink_bio()
186 ossl_json_set0_sink(&qlog->json, bio); in ossl_qlog_set_sink_bio()
192 int ossl_qlog_set_sink_file(QLOG *qlog, FILE *f, int close_flag) in ossl_qlog_set_sink_file() argument
196 if (qlog == NULL) in ossl_qlog_set_sink_file()
203 if (!ossl_qlog_set_sink_bio(qlog, bio)) { in ossl_qlog_set_sink_file()
213 int ossl_qlog_set_sink_filename(QLOG *qlog, const char *filename) in ossl_qlog_set_sink_filename() argument
217 if (qlog == NULL) in ossl_qlog_set_sink_filename()
228 if (!ossl_qlog_set_sink_bio(qlog, bio)) { in ossl_qlog_set_sink_filename()
236 int ossl_qlog_flush(QLOG *qlog) in ossl_qlog_flush() argument
238 if (qlog == NULL) in ossl_qlog_flush()
241 return ossl_json_flush(&qlog->json); in ossl_qlog_flush()
244 int ossl_qlog_set_event_type_enabled(QLOG *qlog, uint32_t event_type, in ossl_qlog_set_event_type_enabled() argument
247 if (qlog == NULL || event_type >= QLOG_EVENT_TYPE_NUM) in ossl_qlog_set_event_type_enabled()
250 bit_set(qlog->enabled, event_type, enabled); in ossl_qlog_set_event_type_enabled()
254 int ossl_qlog_enabled(QLOG *qlog, uint32_t event_type) in ossl_qlog_enabled() argument
256 if (qlog == NULL) in ossl_qlog_enabled()
259 return bit_get(qlog->enabled, event_type) != 0; in ossl_qlog_enabled()
266 static void write_str_once(QLOG *qlog, const char *key, char **p) in write_str_once() argument
271 ossl_json_key(&qlog->json, key); in write_str_once()
272 ossl_json_str(&qlog->json, *p); in write_str_once()
278 static void qlog_event_seq_header(QLOG *qlog) in qlog_event_seq_header() argument
280 if (qlog->header_done) in qlog_event_seq_header()
283 ossl_json_object_begin(&qlog->json); in qlog_event_seq_header()
285 ossl_json_key(&qlog->json, "qlog_version"); in qlog_event_seq_header()
286 ossl_json_str(&qlog->json, "0.3"); in qlog_event_seq_header()
288 ossl_json_key(&qlog->json, "qlog_format"); in qlog_event_seq_header()
289 ossl_json_str(&qlog->json, "JSON-SEQ"); in qlog_event_seq_header()
291 write_str_once(qlog, "title", (char **)&qlog->info.title); in qlog_event_seq_header()
292 write_str_once(qlog, "description", (char **)&qlog->info.description); in qlog_event_seq_header()
294 ossl_json_key(&qlog->json, "trace"); in qlog_event_seq_header()
295 ossl_json_object_begin(&qlog->json); in qlog_event_seq_header()
297 ossl_json_key(&qlog->json, "common_fields"); in qlog_event_seq_header()
298 ossl_json_object_begin(&qlog->json); in qlog_event_seq_header()
300 ossl_json_key(&qlog->json, "time_format"); in qlog_event_seq_header()
301 ossl_json_str(&qlog->json, "delta"); in qlog_event_seq_header()
303 ossl_json_key(&qlog->json, "protocol_type"); in qlog_event_seq_header()
304 ossl_json_array_begin(&qlog->json); in qlog_event_seq_header()
306 ossl_json_str(&qlog->json, "QUIC"); in qlog_event_seq_header()
308 ossl_json_array_end(&qlog->json); in qlog_event_seq_header()
310 write_str_once(qlog, "group_id", (char **)&qlog->info.group_id); in qlog_event_seq_header()
312 ossl_json_key(&qlog->json, "system_info"); in qlog_event_seq_header()
313 ossl_json_object_begin(&qlog->json); in qlog_event_seq_header()
315 if (qlog->info.override_process_id != 0) { in qlog_event_seq_header()
316 ossl_json_key(&qlog->json, "process_id"); in qlog_event_seq_header()
317 ossl_json_u64(&qlog->json, qlog->info.override_process_id); in qlog_event_seq_header()
320 ossl_json_key(&qlog->json, "process_id"); in qlog_event_seq_header()
321 ossl_json_u64(&qlog->json, (uint64_t)getpid()); in qlog_event_seq_header()
323 ossl_json_key(&qlog->json, "process_id"); in qlog_event_seq_header()
324 ossl_json_u64(&qlog->json, (uint64_t)GetCurrentProcessId()); in qlog_event_seq_header()
328 ossl_json_object_end(&qlog->json); in qlog_event_seq_header()
330 ossl_json_object_end(&qlog->json); in qlog_event_seq_header()
332 ossl_json_key(&qlog->json, "vantage_point"); in qlog_event_seq_header()
333 ossl_json_object_begin(&qlog->json); in qlog_event_seq_header()
338 if (qlog->info.override_impl_name != NULL) { in qlog_event_seq_header()
339 p = qlog->info.override_impl_name; in qlog_event_seq_header()
346 ossl_json_key(&qlog->json, "type"); in qlog_event_seq_header()
347 ossl_json_str(&qlog->json, in qlog_event_seq_header()
348 qlog->info.is_server ? "server" : "client"); in qlog_event_seq_header()
350 ossl_json_key(&qlog->json, "name"); in qlog_event_seq_header()
351 ossl_json_str(&qlog->json, p); in qlog_event_seq_header()
353 ossl_json_object_end(&qlog->json); in qlog_event_seq_header()
355 ossl_json_object_end(&qlog->json); in qlog_event_seq_header()
357 ossl_json_object_end(&qlog->json); in qlog_event_seq_header()
359 qlog->header_done = 1; in qlog_event_seq_header()
362 static void qlog_event_prologue(QLOG *qlog) in qlog_event_prologue() argument
364 qlog_event_seq_header(qlog); in qlog_event_prologue()
366 ossl_json_object_begin(&qlog->json); in qlog_event_prologue()
368 ossl_json_key(&qlog->json, "name"); in qlog_event_prologue()
369 ossl_json_str(&qlog->json, qlog->event_combined_name); in qlog_event_prologue()
371 ossl_json_key(&qlog->json, "data"); in qlog_event_prologue()
372 ossl_json_object_begin(&qlog->json); in qlog_event_prologue()
375 static void qlog_event_epilogue(QLOG *qlog) in qlog_event_epilogue() argument
377 ossl_json_object_end(&qlog->json); in qlog_event_epilogue()
379 ossl_json_key(&qlog->json, "time"); in qlog_event_epilogue()
380 if (!qlog->first_event_done) { in qlog_event_epilogue()
381 ossl_json_u64(&qlog->json, ossl_time2ms(qlog->event_time)); in qlog_event_epilogue()
382 qlog->prev_event_time = qlog->event_time; in qlog_event_epilogue()
383 qlog->first_event_done = 1; in qlog_event_epilogue()
385 OSSL_TIME delta = ossl_time_subtract(qlog->event_time, in qlog_event_epilogue()
386 qlog->prev_event_time); in qlog_event_epilogue()
388 ossl_json_u64(&qlog->json, ossl_time2ms(delta)); in qlog_event_epilogue()
389 qlog->prev_event_time = qlog->event_time; in qlog_event_epilogue()
392 ossl_json_object_end(&qlog->json); in qlog_event_epilogue()
395 int ossl_qlog_event_try_begin(QLOG *qlog, in ossl_qlog_event_try_begin() argument
401 if (qlog == NULL) in ossl_qlog_event_try_begin()
404 if (!ossl_assert(qlog->event_type == QLOG_EVENT_TYPE_NONE) in ossl_qlog_event_try_begin()
405 || !ossl_qlog_enabled(qlog, event_type)) in ossl_qlog_event_try_begin()
408 qlog->event_type = event_type; in ossl_qlog_event_try_begin()
409 qlog->event_cat = event_cat; in ossl_qlog_event_try_begin()
410 qlog->event_name = event_name; in ossl_qlog_event_try_begin()
411 qlog->event_combined_name = event_combined_name; in ossl_qlog_event_try_begin()
412 qlog->event_time = qlog->info.now_cb(qlog->info.now_cb_arg); in ossl_qlog_event_try_begin()
414 qlog_event_prologue(qlog); in ossl_qlog_event_try_begin()
418 void ossl_qlog_event_end(QLOG *qlog) in ossl_qlog_event_end() argument
420 if (!ossl_assert(qlog != NULL && qlog->event_type != QLOG_EVENT_TYPE_NONE)) in ossl_qlog_event_end()
423 qlog_event_epilogue(qlog); in ossl_qlog_event_end()
424 qlog->event_type = QLOG_EVENT_TYPE_NONE; in ossl_qlog_event_end()
431 void ossl_qlog_group_begin(QLOG *qlog, const char *name) in ossl_qlog_group_begin() argument
434 ossl_json_key(&qlog->json, name); in ossl_qlog_group_begin()
436 ossl_json_object_begin(&qlog->json); in ossl_qlog_group_begin()
439 void ossl_qlog_group_end(QLOG *qlog) in ossl_qlog_group_end() argument
441 ossl_json_object_end(&qlog->json); in ossl_qlog_group_end()
444 void ossl_qlog_array_begin(QLOG *qlog, const char *name) in ossl_qlog_array_begin() argument
447 ossl_json_key(&qlog->json, name); in ossl_qlog_array_begin()
449 ossl_json_array_begin(&qlog->json); in ossl_qlog_array_begin()
452 void ossl_qlog_array_end(QLOG *qlog) in ossl_qlog_array_end() argument
454 ossl_json_array_end(&qlog->json); in ossl_qlog_array_end()
457 void ossl_qlog_override_time(QLOG *qlog, OSSL_TIME event_time) in ossl_qlog_override_time() argument
459 qlog->event_time = event_time; in ossl_qlog_override_time()
462 void ossl_qlog_str(QLOG *qlog, const char *name, const char *value) in ossl_qlog_str() argument
465 ossl_json_key(&qlog->json, name); in ossl_qlog_str()
467 ossl_json_str(&qlog->json, value); in ossl_qlog_str()
470 void ossl_qlog_str_len(QLOG *qlog, const char *name, in ossl_qlog_str_len() argument
474 ossl_json_key(&qlog->json, name); in ossl_qlog_str_len()
476 ossl_json_str_len(&qlog->json, value, value_len); in ossl_qlog_str_len()
479 void ossl_qlog_u64(QLOG *qlog, const char *name, uint64_t value) in ossl_qlog_u64() argument
482 ossl_json_key(&qlog->json, name); in ossl_qlog_u64()
484 ossl_json_u64(&qlog->json, value); in ossl_qlog_u64()
487 void ossl_qlog_i64(QLOG *qlog, const char *name, int64_t value) in ossl_qlog_i64() argument
490 ossl_json_key(&qlog->json, name); in ossl_qlog_i64()
492 ossl_json_i64(&qlog->json, value); in ossl_qlog_i64()
495 void ossl_qlog_bool(QLOG *qlog, const char *name, int value) in ossl_qlog_bool() argument
498 ossl_json_key(&qlog->json, name); in ossl_qlog_bool()
500 ossl_json_bool(&qlog->json, value); in ossl_qlog_bool()
503 void ossl_qlog_bin(QLOG *qlog, const char *name, in ossl_qlog_bin() argument
507 ossl_json_key(&qlog->json, name); in ossl_qlog_bin()
509 ossl_json_str_hex(&qlog->json, value, value_len); in ossl_qlog_bin()
680 int ossl_qlog_set_filter(QLOG *qlog, const char *filter) in ossl_qlog_set_filter() argument
688 memcpy(enabled, qlog->enabled, sizeof(enabled)); in ossl_qlog_set_filter()
726 memcpy(qlog->enabled, enabled, sizeof(enabled)); in ossl_qlog_set_filter()