24#ifndef MYSQL_TRACE_INCLUDED
25#define MYSQL_TRACE_INCLUDED
44#if !defined(CLIENT_PROTOCOL_TRACING) || defined(MYSQL_SERVER)
46#define MYSQL_TRACE(E, M, ARGS)
47#define MYSQL_TRACE_STAGE(M, S)
67struct st_mysql_trace_info {
69 void *trace_plugin_data;
73#define TRACE_DATA(M) (MYSQL_EXTENSION_PTR(M)->trace_data)
99#define MYSQL_TRACE(E, M, ARGS) \
101 if (NULL == TRACE_DATA(M)) break; \
103 struct st_trace_event_args event_args = TRACE_ARGS_##E ARGS; \
104 mysql_trace_trace(M, TRACE_EVENT_##E, event_args); \
121#define MYSQL_TRACE_STAGE(M, S) \
124 TRACE_DATA(M)->stage = PROTOCOL_STAGE_##S; \
125 else if (trace_plugin && \
126 (PROTOCOL_STAGE_CONNECTING == PROTOCOL_STAGE_##S)) \
127 mysql_trace_start(M); \
136#define TRACE_ARGS_SEND_SSL_REQUEST(Size, Packet) \
137 { NULL, 0, NULL, 0, Packet, Size }
138#define TRACE_ARGS_SEND_AUTH_RESPONSE(Size, Packet) \
139 { NULL, 0, NULL, 0, Packet, Size }
140#define TRACE_ARGS_SEND_AUTH_DATA(Size, Packet) \
141 { NULL, 0, NULL, 0, Packet, Size }
142#define TRACE_ARGS_AUTH_PLUGIN(PluginName) \
143 { PluginName, 0, NULL, 0, NULL, 0 }
144#define TRACE_ARGS_SEND_COMMAND(Command, HdrSize, ArgSize, Header, Args) \
145 { NULL, Command, Header, HdrSize, Args, ArgSize }
146#define TRACE_ARGS_SEND_FILE(Size, Packet) \
147 { NULL, 0, NULL, 0, Packet, Size }
149#define TRACE_ARGS_PACKET_SENT(Size) \
150 { NULL, 0, NULL, 0, NULL, Size }
151#define TRACE_ARGS_PACKET_RECEIVED(Size, Packet) \
152 { NULL, 0, NULL, 0, Packet, Size }
153#define TRACE_ARGS_INIT_PACKET_RECEIVED(Size, Packet) \
154 { NULL, 0, NULL, 0, Packet, Size }
156#define TRACE_ARGS_ERROR() \
157 { NULL, 0, NULL, 0, NULL, 0 }
158#define TRACE_ARGS_READ_PACKET() \
159 { NULL, 0, NULL, 0, NULL, 0 }
160#define TRACE_ARGS_CONNECTING() \
161 { NULL, 0, NULL, 0, NULL, 0 }
162#define TRACE_ARGS_CONNECTED() \
163 { NULL, 0, NULL, 0, NULL, 0 }
164#define TRACE_ARGS_DISCONNECTED() \
165 { NULL, 0, NULL, 0, NULL, 0 }
166#define TRACE_ARGS_AUTHENTICATED() \
167 { NULL, 0, NULL, 0, NULL, 0 }
168#define TRACE_ARGS_SSL_CONNECT() \
169 { NULL, 0, NULL, 0, NULL, 0 }
170#define TRACE_ARGS_SSL_CONNECTED() \
171 { NULL, 0, NULL, 0, NULL, 0 }
void mysql_trace_trace(MYSQL *m, enum trace_event ev, struct st_trace_event_args args)
Report a protocol trace event to trace plugin.
Definition: mysql_trace.cc:139
void mysql_trace_start(MYSQL *m)
Initialize tracing in a given connection.
Definition: mysql_trace.cc:86
Declarations for client-side plugins of type MYSQL_CLIENT_TRACE_PLUGIN.
trace_event
Definition: plugin_trace.h:230
protocol_stage
Definition: plugin_trace.h:226
Definition: plugin_trace.h:298
Some trace events have additional arguments.
Definition: plugin_trace.h:213