lsquic_ev_log.h revision c51ce338
1/* Copyright (c) 2017 LiteSpeed Technologies Inc. See LICENSE. */ 2/* 3 * lsquic_ev_log.h -- Event logger 4 */ 5 6#ifndef LSQUIC_EV_LOG_H 7#define LSQUIC_EV_LOG_H 1 8 9#include "lsquic_int_types.h" 10 11struct ack_info; 12struct http_prio_frame; 13struct lsquic_http_headers; 14struct lsquic_packet_in; 15struct lsquic_packet_out; 16struct parse_funcs; 17struct stream_frame; 18struct uncompressed_headers; 19 20 21/* Log a generic event not tied to any particular connection */ 22#define EV_LOG_GENERIC_EVENT(args...) do { \ 23 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 24 lsquic_logger_log1(LSQ_LOG_DEBUG, LSQLM_EVENT, args); \ 25} while (0) 26 27/* Log a generic event associated with connection `cid' */ 28#define EV_LOG_CONN_EVENT(cid, args...) do { \ 29 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 30 lsquic_logger_log2(LSQ_LOG_DEBUG, LSQLM_EVENT, cid, args); \ 31} while (0) 32 33void 34lsquic_ev_log_packet_in (lsquic_cid_t, const struct lsquic_packet_in *); 35 36#define EV_LOG_PACKET_IN(args...) do { \ 37 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 38 lsquic_ev_log_packet_in(args); \ 39} while (0) 40 41void 42lsquic_ev_log_ack_frame_in (lsquic_cid_t, const struct ack_info *); 43 44#define EV_LOG_ACK_FRAME_IN(args...) do { \ 45 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 46 lsquic_ev_log_ack_frame_in(args); \ 47} while (0) 48 49void 50lsquic_ev_log_stream_frame_in (lsquic_cid_t, const struct stream_frame *); 51 52#define EV_LOG_STREAM_FRAME_IN(args...) do { \ 53 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 54 lsquic_ev_log_stream_frame_in(args); \ 55} while (0) 56 57void 58lsquic_ev_log_window_update_frame_in (lsquic_cid_t, uint32_t stream_id, 59 uint64_t offset); 60 61#define EV_LOG_WINDOW_UPDATE_FRAME_IN(args...) do { \ 62 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 63 lsquic_ev_log_window_update_frame_in(args); \ 64} while (0) 65 66void 67lsquic_ev_log_blocked_frame_in (lsquic_cid_t, uint32_t stream_id); 68 69#define EV_LOG_BLOCKED_FRAME_IN(args...) do { \ 70 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 71 lsquic_ev_log_blocked_frame_in(args); \ 72} while (0) 73 74void 75lsquic_ev_log_stop_waiting_frame_in (lsquic_cid_t, lsquic_packno_t); 76 77#define EV_LOG_STOP_WAITING_FRAME_IN(args...) do { \ 78 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 79 lsquic_ev_log_stop_waiting_frame_in(args); \ 80} while (0) 81 82void 83lsquic_ev_log_connection_close_frame_in (lsquic_cid_t, uint32_t error_code, 84 int reason_len, const char *reason); 85 86#define EV_LOG_CONNECTION_CLOSE_FRAME_IN(args...) do { \ 87 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 88 lsquic_ev_log_connection_close_frame_in(args); \ 89} while (0) 90 91void 92lsquic_ev_log_goaway_frame_in (lsquic_cid_t, uint32_t error_code, 93 uint32_t stream_id, int reason_len, const char *reason); 94 95#define EV_LOG_GOAWAY_FRAME_IN(args...) do { \ 96 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 97 lsquic_ev_log_goaway_frame_in(args); \ 98} while (0) 99 100void 101lsquic_ev_log_rst_stream_frame_in (lsquic_cid_t, uint32_t stream_id, 102 uint64_t offset, uint32_t error_code); 103 104#define EV_LOG_RST_STREAM_FRAME_IN(args...) do { \ 105 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 106 lsquic_ev_log_rst_stream_frame_in(args); \ 107} while (0) 108 109void 110lsquic_ev_log_padding_frame_in (lsquic_cid_t, size_t len); 111 112#define EV_LOG_PADDING_FRAME_IN(args...) do { \ 113 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 114 lsquic_ev_log_padding_frame_in(args); \ 115} while (0) 116 117void 118lsquic_ev_log_ping_frame_in (lsquic_cid_t); 119 120#define EV_LOG_PING_FRAME_IN(args...) do { \ 121 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 122 lsquic_ev_log_ping_frame_in(args); \ 123} while (0) 124 125void 126lsquic_ev_log_packet_created (lsquic_cid_t, const struct lsquic_packet_out *); 127 128#define EV_LOG_PACKET_CREATED(args...) do { \ 129 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 130 lsquic_ev_log_packet_created(args); \ 131} while (0) 132 133void 134lsquic_ev_log_packet_sent (lsquic_cid_t, const struct lsquic_packet_out *); 135 136#define EV_LOG_PACKET_SENT(args...) do { \ 137 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 138 lsquic_ev_log_packet_sent(args); \ 139} while (0) 140 141void 142lsquic_ev_log_packet_not_sent (lsquic_cid_t, const struct lsquic_packet_out *); 143 144#define EV_LOG_PACKET_NOT_SENT(args...) do { \ 145 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 146 lsquic_ev_log_packet_not_sent(args); \ 147} while (0) 148 149void 150lsquic_ev_log_http_headers_in (lsquic_cid_t, int is_server, 151 const struct uncompressed_headers *); 152 153#define EV_LOG_HTTP_HEADERS_IN(args...) do { \ 154 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 155 lsquic_ev_log_http_headers_in(args); \ 156} while (0) 157 158void 159lsquic_ev_log_action_stream_frame (lsquic_cid_t, const struct parse_funcs *pf, 160 const unsigned char *, size_t len, const char *action); 161 162#define EV_LOG_GENERATED_STREAM_FRAME(args...) do { \ 163 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 164 lsquic_ev_log_action_stream_frame(args, "generated"); \ 165} while (0) 166 167#define EV_LOG_UPDATED_STREAM_FRAME(args...) do { \ 168 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 169 lsquic_ev_log_action_stream_frame(args, "updated"); \ 170} while (0) 171 172void 173lsquic_ev_log_generated_ack_frame (lsquic_cid_t, const struct parse_funcs *, 174 const unsigned char *, size_t len); 175 176#define EV_LOG_GENERATED_ACK_FRAME(args...) do { \ 177 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 178 lsquic_ev_log_generated_ack_frame(args); \ 179} while (0) 180 181void 182lsquic_ev_log_generated_stop_waiting_frame (lsquic_cid_t, lsquic_packno_t); 183 184#define EV_LOG_GENERATED_STOP_WAITING_FRAME(args...) do { \ 185 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 186 lsquic_ev_log_generated_stop_waiting_frame(args); \ 187} while (0) 188 189void 190lsquic_ev_log_generated_http_headers (lsquic_cid_t, uint32_t stream_id, 191 int is_server, const struct http_prio_frame *, 192 const struct lsquic_http_headers *); 193 194 195#define EV_LOG_GENERATED_HTTP_HEADERS(args...) do { \ 196 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 197 lsquic_ev_log_generated_http_headers(args); \ 198} while (0) 199 200void 201lsquic_ev_log_generated_http_push_promise (lsquic_cid_t, uint32_t stream_id, 202 uint32_t promised_stream_id, 203 const struct lsquic_http_headers *headers, 204 const struct lsquic_http_headers *extra_headers); 205 206#define EV_LOG_GENERATED_HTTP_PUSH_PROMISE(args...) do { \ 207 if (LSQ_LOG_ENABLED_EXT(LSQ_LOG_DEBUG, LSQLM_EVENT)) \ 208 lsquic_ev_log_generated_http_push_promise(args); \ 209} while (0) 210 211#endif 212