123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- #ifndef PLUGIN_TRACE_INCLUDED
- #define PLUGIN_TRACE_INCLUDED
- #include <mysql/client_plugin.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define PROTOCOL_STAGE_LIST(X) \
- protocol_stage_ ## X(CONNECTING) \
- protocol_stage_ ## X(WAIT_FOR_INIT_PACKET) \
- protocol_stage_ ## X(AUTHENTICATE) \
- protocol_stage_ ## X(SSL_NEGOTIATION) \
- protocol_stage_ ## X(READY_FOR_COMMAND) \
- protocol_stage_ ## X(WAIT_FOR_PACKET) \
- protocol_stage_ ## X(WAIT_FOR_RESULT) \
- protocol_stage_ ## X(WAIT_FOR_FIELD_DEF) \
- protocol_stage_ ## X(WAIT_FOR_ROW) \
- protocol_stage_ ## X(FILE_REQUEST) \
- protocol_stage_ ## X(WAIT_FOR_PS_DESCRIPTION) \
- protocol_stage_ ## X(WAIT_FOR_PARAM_DEF) \
- protocol_stage_ ## X(DISCONNECTED)
- #define TRACE_EVENT_LIST(X) \
- trace_event_ ## X(ERROR) \
- trace_event_ ## X(CONNECTING) \
- trace_event_ ## X(CONNECTED) \
- trace_event_ ## X(DISCONNECTED) \
- trace_event_ ## X(SEND_SSL_REQUEST) \
- trace_event_ ## X(SSL_CONNECT) \
- trace_event_ ## X(SSL_CONNECTED) \
- trace_event_ ## X(INIT_PACKET_RECEIVED) \
- trace_event_ ## X(AUTH_PLUGIN) \
- trace_event_ ## X(SEND_AUTH_RESPONSE) \
- trace_event_ ## X(SEND_AUTH_DATA) \
- trace_event_ ## X(AUTHENTICATED) \
- trace_event_ ## X(SEND_COMMAND) \
- trace_event_ ## X(SEND_FILE) \
- trace_event_ ## X(READ_PACKET) \
- trace_event_ ## X(PACKET_RECEIVED) \
- trace_event_ ## X(PACKET_SENT)
- struct st_trace_event_args
- {
- const char *plugin_name;
- int cmd;
- const unsigned char *hdr;
- size_t hdr_len;
- const unsigned char *pkt;
- size_t pkt_len;
- };
- #define protocol_stage_enum(X) PROTOCOL_STAGE_ ## X,
- enum protocol_stage {
- PROTOCOL_STAGE_LIST(enum)
- PROTOCOL_STAGE_LAST
- };
- #define trace_event_enum(X) TRACE_EVENT_ ## X,
- enum trace_event {
- TRACE_EVENT_LIST(enum)
- TRACE_EVENT_LAST
- };
- struct st_mysql_client_plugin_TRACE;
- struct st_mysql;
- typedef
- void* (tracing_start_callback)(struct st_mysql_client_plugin_TRACE *self,
- struct st_mysql *connection_handle,
- enum protocol_stage stage);
- typedef
- void (tracing_stop_callback)(struct st_mysql_client_plugin_TRACE *self,
- struct st_mysql *connection_handle,
- void *plugin_data);
- typedef
- int (trace_event_handler)(struct st_mysql_client_plugin_TRACE *self,
- void *plugin_data,
- struct st_mysql *connection_handle,
- enum protocol_stage stage,
- enum trace_event event,
- struct st_trace_event_args args);
- struct st_mysql_client_plugin_TRACE
- {
- MYSQL_CLIENT_PLUGIN_HEADER
- tracing_start_callback *tracing_start;
- tracing_stop_callback *tracing_stop;
- trace_event_handler *trace_event;
- };
- extern
- struct st_mysql_client_plugin_TRACE *trace_plugin;
- #ifndef DBUG_OFF
- const char* protocol_stage_name(enum protocol_stage stage);
- const char* trace_event_name(enum trace_event ev);
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|