MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
extension_ascii_protocol_descriptor Struct Reference

#include <extension.h>

Collaboration diagram for extension_ascii_protocol_descriptor:

Public Attributes

const char *(* get_name )(const void *cmd_cookie)
bool(* accept )(const void *cmd_cookie, void *cookie, int argc, token_t *argv, size_t *ndata, char **ptr)
ENGINE_ERROR_CODE(* execute )(const void *cmd_cookie, const void *cookie, int argc, token_t *argv, ENGINE_ERROR_CODE(*response_handler)(const void *cookie, int nbytes, const char *dta))
void(* abort )(const void *cmd_cookie, const void *cookie)
const void * cookie
struct
extension_ascii_protocol_descriptor
next

Detailed Description

ASCII protocol extensions must provide the following descriptor to extend the capabilities of the ascii protocol. The memcached core will probe each command in the order they are registered, so you should register the most likely command to be used first (or you could register only one descriptor and do a better dispatch routine inside your own implementation of accept / execute).

Definition at line 126 of file extension.h.

Member Data Documentation

void(* extension_ascii_protocol_descriptor::abort)(const void *cmd_cookie, const void *cookie)

abort the command.

Parameters
cmd_cookiecookie registered with the command
cookieidentifying the client connection

Definition at line 187 of file extension.h.

bool(* extension_ascii_protocol_descriptor::accept)(const void *cmd_cookie, void *cookie, int argc, token_t *argv, size_t *ndata, char **ptr)

Called by the server to determine if the command in argc, argv should be process by this handler.

If the command accepts out-of-band data (like add / append / prepend / replace / set), the command must set the datapointer and ndata to the number of bytes it want to read (remember to account for the trailing "\r\n" ;-))

If you need extra data, you should copy all of the argc/argv info you may need to execute the command, because those parameters will be 0 and NULL when execute is invoked...

Parameters
cmd_cookiecookie registered with the command
cookieidentifying the client connection
argcthe number of arguments
argvthe argument vector
ndatathe number of bytes in out-of-band data (OUT)
ptrwhere the core shall write the data (OUT)
noreplyis this a noreply command or not...
Returns
true if the command should be handled by this command handler

Definition at line 157 of file extension.h.

const void* extension_ascii_protocol_descriptor::cookie

cookie for the command. This is the cookie passed to accept and execute, so that you can register the same functions for multiple commands (but tell them apart during invokations).

Definition at line 194 of file extension.h.

ENGINE_ERROR_CODE(* extension_ascii_protocol_descriptor::execute)(const void *cmd_cookie, const void *cookie, int argc, token_t *argv, ENGINE_ERROR_CODE(*response_handler)(const void *cookie,int nbytes,const char *dta))

execute the command.

Parameters
cmd_cookiecookie registered with the command
cookieidentifying the client connection
argcthe number of arguments
argvthe argument vector
response_handlercallback to add data to the return buffer
Returns
Error code for the operation

Definition at line 174 of file extension.h.

const char*(* extension_ascii_protocol_descriptor::get_name)(const void *cmd_cookie)

Get the name of the descriptor. The memory area returned by this function has to be valid until the descriptor is unregistered.

Parameters
cmd_cookiecookie registered with the command

Definition at line 133 of file extension.h.

struct extension_ascii_protocol_descriptor* extension_ascii_protocol_descriptor::next

Deamon descriptors are stored in a linked list in the memcached core by using this pointer. Please do not modify this pointer by yourself until you have unregistered the descriptor. The only time it is safe for an extension to walk this list is during initialization of the modules.

Definition at line 203 of file extension.h.


The documentation for this struct was generated from the following file: