lsquic_ev_log.h revision c51ce338
150aadb33SDmitri Tikhonov/* Copyright (c) 2017 LiteSpeed Technologies Inc. See LICENSE. */ 250aadb33SDmitri Tikhonov/* 350aadb33SDmitri Tikhonov * lsquic_ev_log.h -- Event logger 450aadb33SDmitri Tikhonov */ 550aadb33SDmitri Tikhonov 650aadb33SDmitri Tikhonov#ifndef LSQUIC_EV_LOG_H 750aadb33SDmitri Tikhonov#define LSQUIC_EV_LOG_H 1 850aadb33SDmitri Tikhonov 950aadb33SDmitri Tikhonov#include "lsquic_int_types.h" 1050aadb33SDmitri Tikhonov 1150aadb33SDmitri Tikhonovstruct ack_info; 1250aadb33SDmitri Tikhonovstruct http_prio_frame; 1350aadb33SDmitri Tikhonovstruct lsquic_http_headers; 1450aadb33SDmitri Tikhonovstruct lsquic_packet_in; 1550aadb33SDmitri Tikhonovstruct lsquic_packet_out; 1650aadb33SDmitri Tikhonovstruct parse_funcs; 1750aadb33SDmitri Tikhonovstruct stream_frame; 1850aadb33SDmitri Tikhonovstruct uncompressed_headers; 1950aadb33SDmitri Tikhonov 2050aadb33SDmitri Tikhonov 2150aadb33SDmitri Tikhonov/* Log a generic event not tied to any particular connection */ 2250aadb33SDmitri Tikhonov#define EV_LOG_GENERIC_EVENT(args...) do { \ 2350aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 2450aadb33SDmitri Tikhonov lsquic_logger_log1(LSQ_LOG_DEBUG, LSQLM_EVENT, args); \ 2550aadb33SDmitri Tikhonov} while (0) 2650aadb33SDmitri Tikhonov 2750aadb33SDmitri Tikhonov/* Log a generic event associated with connection `cid' */ 2850aadb33SDmitri Tikhonov#define EV_LOG_CONN_EVENT(cid, args...) do { \ 2950aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 3050aadb33SDmitri Tikhonov lsquic_logger_log2(LSQ_LOG_DEBUG, LSQLM_EVENT, cid, args); \ 3150aadb33SDmitri Tikhonov} while (0) 3250aadb33SDmitri Tikhonov 3350aadb33SDmitri Tikhonovvoid 3450aadb33SDmitri Tikhonovlsquic_ev_log_packet_in (lsquic_cid_t, const struct lsquic_packet_in *); 3550aadb33SDmitri Tikhonov 3650aadb33SDmitri Tikhonov#define EV_LOG_PACKET_IN(args...) do { \ 3750aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 3850aadb33SDmitri Tikhonov lsquic_ev_log_packet_in(args); \ 3950aadb33SDmitri Tikhonov} while (0) 4050aadb33SDmitri Tikhonov 4150aadb33SDmitri Tikhonovvoid 4250aadb33SDmitri Tikhonovlsquic_ev_log_ack_frame_in (lsquic_cid_t, const struct ack_info *); 4350aadb33SDmitri Tikhonov 4450aadb33SDmitri Tikhonov#define EV_LOG_ACK_FRAME_IN(args...) do { \ 4550aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 4650aadb33SDmitri Tikhonov lsquic_ev_log_ack_frame_in(args); \ 4750aadb33SDmitri Tikhonov} while (0) 4850aadb33SDmitri Tikhonov 4950aadb33SDmitri Tikhonovvoid 5050aadb33SDmitri Tikhonovlsquic_ev_log_stream_frame_in (lsquic_cid_t, const struct stream_frame *); 5150aadb33SDmitri Tikhonov 5250aadb33SDmitri Tikhonov#define EV_LOG_STREAM_FRAME_IN(args...) do { \ 5350aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 5450aadb33SDmitri Tikhonov lsquic_ev_log_stream_frame_in(args); \ 5550aadb33SDmitri Tikhonov} while (0) 5650aadb33SDmitri Tikhonov 5750aadb33SDmitri Tikhonovvoid 5850aadb33SDmitri Tikhonovlsquic_ev_log_window_update_frame_in (lsquic_cid_t, uint32_t stream_id, 5950aadb33SDmitri Tikhonov uint64_t offset); 6050aadb33SDmitri Tikhonov 6150aadb33SDmitri Tikhonov#define EV_LOG_WINDOW_UPDATE_FRAME_IN(args...) do { \ 6250aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 6350aadb33SDmitri Tikhonov lsquic_ev_log_window_update_frame_in(args); \ 6450aadb33SDmitri Tikhonov} while (0) 6550aadb33SDmitri Tikhonov 6650aadb33SDmitri Tikhonovvoid 6750aadb33SDmitri Tikhonovlsquic_ev_log_blocked_frame_in (lsquic_cid_t, uint32_t stream_id); 6850aadb33SDmitri Tikhonov 6950aadb33SDmitri Tikhonov#define EV_LOG_BLOCKED_FRAME_IN(args...) do { \ 7050aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 7150aadb33SDmitri Tikhonov lsquic_ev_log_blocked_frame_in(args); \ 7250aadb33SDmitri Tikhonov} while (0) 7350aadb33SDmitri Tikhonov 7450aadb33SDmitri Tikhonovvoid 7550aadb33SDmitri Tikhonovlsquic_ev_log_stop_waiting_frame_in (lsquic_cid_t, lsquic_packno_t); 7650aadb33SDmitri Tikhonov 7750aadb33SDmitri Tikhonov#define EV_LOG_STOP_WAITING_FRAME_IN(args...) do { \ 7850aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 7950aadb33SDmitri Tikhonov lsquic_ev_log_stop_waiting_frame_in(args); \ 8050aadb33SDmitri Tikhonov} while (0) 8150aadb33SDmitri Tikhonov 8250aadb33SDmitri Tikhonovvoid 8350aadb33SDmitri Tikhonovlsquic_ev_log_connection_close_frame_in (lsquic_cid_t, uint32_t error_code, 8450aadb33SDmitri Tikhonov int reason_len, const char *reason); 8550aadb33SDmitri Tikhonov 8650aadb33SDmitri Tikhonov#define EV_LOG_CONNECTION_CLOSE_FRAME_IN(args...) do { \ 8750aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 8850aadb33SDmitri Tikhonov lsquic_ev_log_connection_close_frame_in(args); \ 8950aadb33SDmitri Tikhonov} while (0) 9050aadb33SDmitri Tikhonov 9150aadb33SDmitri Tikhonovvoid 9250aadb33SDmitri Tikhonovlsquic_ev_log_goaway_frame_in (lsquic_cid_t, uint32_t error_code, 9350aadb33SDmitri Tikhonov uint32_t stream_id, int reason_len, const char *reason); 9450aadb33SDmitri Tikhonov 9550aadb33SDmitri Tikhonov#define EV_LOG_GOAWAY_FRAME_IN(args...) do { \ 9650aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 9750aadb33SDmitri Tikhonov lsquic_ev_log_goaway_frame_in(args); \ 9850aadb33SDmitri Tikhonov} while (0) 9950aadb33SDmitri Tikhonov 10050aadb33SDmitri Tikhonovvoid 10150aadb33SDmitri Tikhonovlsquic_ev_log_rst_stream_frame_in (lsquic_cid_t, uint32_t stream_id, 10250aadb33SDmitri Tikhonov uint64_t offset, uint32_t error_code); 10350aadb33SDmitri Tikhonov 10450aadb33SDmitri Tikhonov#define EV_LOG_RST_STREAM_FRAME_IN(args...) do { \ 10550aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 10650aadb33SDmitri Tikhonov lsquic_ev_log_rst_stream_frame_in(args); \ 10750aadb33SDmitri Tikhonov} while (0) 10850aadb33SDmitri Tikhonov 10950aadb33SDmitri Tikhonovvoid 11050aadb33SDmitri Tikhonovlsquic_ev_log_padding_frame_in (lsquic_cid_t, size_t len); 11150aadb33SDmitri Tikhonov 11250aadb33SDmitri Tikhonov#define EV_LOG_PADDING_FRAME_IN(args...) do { \ 11350aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 11450aadb33SDmitri Tikhonov lsquic_ev_log_padding_frame_in(args); \ 11550aadb33SDmitri Tikhonov} while (0) 11650aadb33SDmitri Tikhonov 11750aadb33SDmitri Tikhonovvoid 11850aadb33SDmitri Tikhonovlsquic_ev_log_ping_frame_in (lsquic_cid_t); 11950aadb33SDmitri Tikhonov 12050aadb33SDmitri Tikhonov#define EV_LOG_PING_FRAME_IN(args...) do { \ 12150aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 12250aadb33SDmitri Tikhonov lsquic_ev_log_ping_frame_in(args); \ 12350aadb33SDmitri Tikhonov} while (0) 12450aadb33SDmitri Tikhonov 12550aadb33SDmitri Tikhonovvoid 12650aadb33SDmitri Tikhonovlsquic_ev_log_packet_created (lsquic_cid_t, const struct lsquic_packet_out *); 12750aadb33SDmitri Tikhonov 12850aadb33SDmitri Tikhonov#define EV_LOG_PACKET_CREATED(args...) do { \ 12950aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 13050aadb33SDmitri Tikhonov lsquic_ev_log_packet_created(args); \ 13150aadb33SDmitri Tikhonov} while (0) 13250aadb33SDmitri Tikhonov 13350aadb33SDmitri Tikhonovvoid 13450aadb33SDmitri Tikhonovlsquic_ev_log_packet_sent (lsquic_cid_t, const struct lsquic_packet_out *); 13550aadb33SDmitri Tikhonov 13650aadb33SDmitri Tikhonov#define EV_LOG_PACKET_SENT(args...) do { \ 13750aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 13850aadb33SDmitri Tikhonov lsquic_ev_log_packet_sent(args); \ 13950aadb33SDmitri Tikhonov} while (0) 14050aadb33SDmitri Tikhonov 14150aadb33SDmitri Tikhonovvoid 14250aadb33SDmitri Tikhonovlsquic_ev_log_packet_not_sent (lsquic_cid_t, const struct lsquic_packet_out *); 14350aadb33SDmitri Tikhonov 14450aadb33SDmitri Tikhonov#define EV_LOG_PACKET_NOT_SENT(args...) do { \ 14550aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 14650aadb33SDmitri Tikhonov lsquic_ev_log_packet_not_sent(args); \ 14750aadb33SDmitri Tikhonov} while (0) 14850aadb33SDmitri Tikhonov 14950aadb33SDmitri Tikhonovvoid 15050aadb33SDmitri Tikhonovlsquic_ev_log_http_headers_in (lsquic_cid_t, int is_server, 15150aadb33SDmitri Tikhonov const struct uncompressed_headers *); 15250aadb33SDmitri Tikhonov 15350aadb33SDmitri Tikhonov#define EV_LOG_HTTP_HEADERS_IN(args...) do { \ 15450aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 15550aadb33SDmitri Tikhonov lsquic_ev_log_http_headers_in(args); \ 15650aadb33SDmitri Tikhonov} while (0) 15750aadb33SDmitri Tikhonov 15850aadb33SDmitri Tikhonovvoid 159c51ce338SDmitri Tikhonovlsquic_ev_log_action_stream_frame (lsquic_cid_t, const struct parse_funcs *pf, 160c51ce338SDmitri Tikhonov const unsigned char *, size_t len, const char *action); 16150aadb33SDmitri Tikhonov 16250aadb33SDmitri Tikhonov#define EV_LOG_GENERATED_STREAM_FRAME(args...) do { \ 16350aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 164c51ce338SDmitri Tikhonov lsquic_ev_log_action_stream_frame(args, "generated"); \ 165c51ce338SDmitri Tikhonov} while (0) 166c51ce338SDmitri Tikhonov 167c51ce338SDmitri Tikhonov#define EV_LOG_UPDATED_STREAM_FRAME(args...) do { \ 168c51ce338SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 169c51ce338SDmitri Tikhonov lsquic_ev_log_action_stream_frame(args, "updated"); \ 17050aadb33SDmitri Tikhonov} while (0) 17150aadb33SDmitri Tikhonov 17250aadb33SDmitri Tikhonovvoid 17350aadb33SDmitri Tikhonovlsquic_ev_log_generated_ack_frame (lsquic_cid_t, const struct parse_funcs *, 17450aadb33SDmitri Tikhonov const unsigned char *, size_t len); 17550aadb33SDmitri Tikhonov 17650aadb33SDmitri Tikhonov#define EV_LOG_GENERATED_ACK_FRAME(args...) do { \ 17750aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 17850aadb33SDmitri Tikhonov lsquic_ev_log_generated_ack_frame(args); \ 17950aadb33SDmitri Tikhonov} while (0) 18050aadb33SDmitri Tikhonov 18150aadb33SDmitri Tikhonovvoid 18250aadb33SDmitri Tikhonovlsquic_ev_log_generated_stop_waiting_frame (lsquic_cid_t, lsquic_packno_t); 18350aadb33SDmitri Tikhonov 18450aadb33SDmitri Tikhonov#define EV_LOG_GENERATED_STOP_WAITING_FRAME(args...) do { \ 18550aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 18650aadb33SDmitri Tikhonov lsquic_ev_log_generated_stop_waiting_frame(args); \ 18750aadb33SDmitri Tikhonov} while (0) 18850aadb33SDmitri Tikhonov 18950aadb33SDmitri Tikhonovvoid 19050aadb33SDmitri Tikhonovlsquic_ev_log_generated_http_headers (lsquic_cid_t, uint32_t stream_id, 19150aadb33SDmitri Tikhonov int is_server, const struct http_prio_frame *, 19250aadb33SDmitri Tikhonov const struct lsquic_http_headers *); 19350aadb33SDmitri Tikhonov 19450aadb33SDmitri Tikhonov 19550aadb33SDmitri Tikhonov#define EV_LOG_GENERATED_HTTP_HEADERS(args...) do { \ 19650aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 19750aadb33SDmitri Tikhonov lsquic_ev_log_generated_http_headers(args); \ 19850aadb33SDmitri Tikhonov} while (0) 19950aadb33SDmitri Tikhonov 20050aadb33SDmitri Tikhonovvoid 20150aadb33SDmitri Tikhonovlsquic_ev_log_generated_http_push_promise (lsquic_cid_t, uint32_t stream_id, 20250aadb33SDmitri Tikhonov uint32_t promised_stream_id, 20350aadb33SDmitri Tikhonov const struct lsquic_http_headers *headers, 20450aadb33SDmitri Tikhonov const struct lsquic_http_headers *extra_headers); 20550aadb33SDmitri Tikhonov 20650aadb33SDmitri Tikhonov#define EV_LOG_GENERATED_HTTP_PUSH_PROMISE(args...) do { \ 20750aadb33SDmitri Tikhonov if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 20850aadb33SDmitri Tikhonov lsquic_ev_log_generated_http_push_promise(args); \ 20950aadb33SDmitri Tikhonov} while (0) 21050aadb33SDmitri Tikhonov 21150aadb33SDmitri Tikhonov#endif 212