MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Protocol Extension API

Typedefs

typedef void(* cb_responder )(responder_ctx *responder_data, protocol_binary_response_header *hdr, char *data, size_t data_len)
typedef int connection_id
typedef enum plugin_cb_result(* plugin_cb )(void *userdata, connection_id conn_id, cb_responder responder, responder_ctx *responder_data, protocol_binary_response_header *hdr, char *data, size_t data_len)
typedef void(* plugin_conn_observer )(void *userdata, enum plugin_cb_state state, connection_id conn_id)

Enumerations

enum  plugin_cb_result { cb_done, cb_defer, cb_hangup }
enum  plugin_cb_state { cb_connected, cb_disconnected }

Functions

void plugin_register_callback (uint8_t cmd_id, plugin_cb callback, void *userdata)
void plugin_get_callback (int8_t cmd_id, plugin_cb *current_callback, void **current_userdata)
void plugin_register_conn_observer (void *userdata, plugin_conn_observer obs)
void plugin_unregister_conn_observer (plugin_conn_observer obs)

Detailed Description

Typedef Documentation

typedef void(* cb_responder)(responder_ctx *responder_data, protocol_binary_response_header *hdr, char *data, size_t data_len)

Response transmission function.

Parameters
responder_datacontext data for the responder
hdrresponse header
dataresponse data
data_lenlength of the response data

Definition at line 21 of file protocol_plugin.h.

typedef int connection_id

Unique connection identifier.

Definition at line 29 of file protocol_plugin.h.

typedef enum plugin_cb_result(* plugin_cb)(void *userdata, connection_id conn_id, cb_responder responder, responder_ctx *responder_data, protocol_binary_response_header *hdr, char *data, size_t data_len)

Callback fired when a message is completely received.

Parameters
userdatauser data included during registration
connection_idconnection identifier
responderresponder for transmitting a result
responder_dataresponder's context data
hdrthe request header
datathe request data
thelength of the request data
Returns
execution status indicator

Definition at line 53 of file protocol_plugin.h.

typedef void(* plugin_conn_observer)(void *userdata, enum plugin_cb_state state, connection_id conn_id)

Callback fired when a connection changes state.

Parameters
userdataprivate user data
statethe state being observed
conn_idthe ID of the connection that changed the state

Definition at line 76 of file protocol_plugin.h.

Enumeration Type Documentation

Plugin callback responses.

Enumerator:
cb_done 

Indicate this command has completed.

cb_defer 

Indicate this command requires further processing.

cb_hangup 

Disconnect this connection.

Definition at line 34 of file protocol_plugin.h.

Type of state change being observed.

Enumerator:
cb_connected 

Indicating a connection has been established.

cb_disconnected 

Indicating a connection has been lost.

Definition at line 64 of file protocol_plugin.h.

Function Documentation

void plugin_get_callback ( int8_t  cmd_id,
plugin_cb current_callback,
void **  current_userdata 
)

Retrieve the current callback info for the given command.

Parameters
cmd_idthe command whose callback info we'd like to retrieve
current_callbackthe current callback function (may be NULL)
current_userdatathe current callback's user data (may be NULL)
void plugin_register_callback ( uint8_t  cmd_id,
plugin_cb  callback,
void *  userdata 
)

Register a callback for the given command.

Parameters
cmd_idthe ID of the command to handle
callbackthe callback to handle this command
userdatauser data to be supplied to the callback
void plugin_register_conn_observer ( void *  userdata,
plugin_conn_observer  obs 
)

Register a connection observer.

Parameters
userdataobservation parameters
obsthe observer
void plugin_unregister_conn_observer ( plugin_conn_observer  obs)

Unregister a connection observer.

Parameters
obsthe observer