Fixed comments to be compatible with doxygen

This commit is contained in:
vraatikka
2013-12-13 19:11:10 +02:00
parent d700754baa
commit 97bc1ed042
13 changed files with 168 additions and 174 deletions

View File

@ -37,7 +37,7 @@
* *
* @param variable Pointer the the variable to add to * @param variable Pointer the the variable to add to
* @param value Value to be added * @param value Value to be added
* @return The value of *variable before the add occured * @return Pointer to the value of variable before the add occured
*/ */
int int
atomic_add(int *variable, int value) atomic_add(int *variable, int value)

View File

@ -154,11 +154,11 @@ dcb_add_to_zombieslist(DCB *dcb)
CHK_DCB(dcb); CHK_DCB(dcb);
/** /*<
* Protect zombies list access. * Protect zombies list access.
*/ */
spinlock_acquire(&zombiespin); spinlock_acquire(&zombiespin);
/** /*<
* If dcb is already added to zombies list, return. * If dcb is already added to zombies list, return.
*/ */
if (dcb->state != DCB_STATE_NOPOLLING) { if (dcb->state != DCB_STATE_NOPOLLING) {
@ -168,7 +168,7 @@ dcb_add_to_zombieslist(DCB *dcb)
return; return;
} }
#if 1 #if 1
/** /*<
* Add closing dcb to the top of the list. * Add closing dcb to the top of the list.
*/ */
dcb->memdata.next = zombies; dcb->memdata.next = zombies;
@ -204,7 +204,7 @@ dcb_add_to_zombieslist(DCB *dcb)
} }
} }
#endif #endif
/** /*<
* Set state which indicates that it has been added to zombies * Set state which indicates that it has been added to zombies
* list. * list.
*/ */
@ -231,11 +231,11 @@ dcb_final_free(DCB *dcb)
ss_info_dassert(dcb->state == DCB_STATE_DISCONNECTED, ss_info_dassert(dcb->state == DCB_STATE_DISCONNECTED,
"dcb not in DCB_STATE_DISCONNECTED state."); "dcb not in DCB_STATE_DISCONNECTED state.");
/** First remove this DCB from the chain */ /*< First remove this DCB from the chain */
spinlock_acquire(&dcbspin); spinlock_acquire(&dcbspin);
if (allDCBs == dcb) if (allDCBs == dcb)
{ {
/** /*<
* Deal with the special case of removing the DCB at the head of * Deal with the special case of removing the DCB at the head of
* the chain. * the chain.
*/ */
@ -243,7 +243,7 @@ dcb_final_free(DCB *dcb)
} }
else else
{ {
/** /*<
* We find the DCB that point to the one we are removing and then * We find the DCB that point to the one we are removing and then
* set the next pointer of that DCB to the next pointer of the * set the next pointer of that DCB to the next pointer of the
* DCB we are removing. * DCB we are removing.
@ -257,13 +257,13 @@ dcb_final_free(DCB *dcb)
spinlock_release(&dcbspin); spinlock_release(&dcbspin);
if (dcb->session) { if (dcb->session) {
/** /*<
* Terminate client session. * Terminate client session.
*/ */
{ {
SESSION *local_session = dcb->session; SESSION *local_session = dcb->session;
CHK_SESSION(local_session); CHK_SESSION(local_session);
/** /*<
* Remove reference from session if dcb is client. * Remove reference from session if dcb is client.
*/ */
if (local_session->client == dcb) { if (local_session->client == dcb) {
@ -304,7 +304,7 @@ DCB* dcb_list = NULL;
DCB* dcb = NULL; DCB* dcb = NULL;
bool succp = false; bool succp = false;
/* /*<
* Perform a dirty read to see if there is anything in the queue. * Perform a dirty read to see if there is anything in the queue.
* This avoids threads hitting the queue spinlock when the queue * This avoids threads hitting the queue spinlock when the queue
* is empty. This will really help when the only entry is being * is empty. This will really help when the only entry is being
@ -322,7 +322,7 @@ bool succp = false;
bitmask_clear(&ptr->memdata.bitmask, threadid); bitmask_clear(&ptr->memdata.bitmask, threadid);
if (bitmask_isallclear(&ptr->memdata.bitmask)) if (bitmask_isallclear(&ptr->memdata.bitmask))
{ {
/* /*<
* Remove the DCB from the zombie queue * Remove the DCB from the zombie queue
* and call the final free routine for the * and call the final free routine for the
* DCB * DCB
@ -348,7 +348,7 @@ bool succp = false;
STRDCBSTATE(ptr->state)))); STRDCBSTATE(ptr->state))));
ss_info_dassert(ptr->state == DCB_STATE_ZOMBIE, ss_info_dassert(ptr->state == DCB_STATE_ZOMBIE,
"dcb not in DCB_STATE_ZOMBIE state."); "dcb not in DCB_STATE_ZOMBIE state.");
/** /*<
* Move dcb to linked list of victim dcbs. * Move dcb to linked list of victim dcbs.
*/ */
if (dcb_list == NULL) { if (dcb_list == NULL) {
@ -370,11 +370,11 @@ bool succp = false;
spinlock_release(&zombiespin); spinlock_release(&zombiespin);
dcb = dcb_list; dcb = dcb_list;
/** Close, and set DISCONNECTED victims */ /*< Close, and set DISCONNECTED victims */
while (dcb != NULL) { while (dcb != NULL) {
DCB* dcb_next = NULL; DCB* dcb_next = NULL;
int rc = 0; int rc = 0;
/** /*<
* Close file descriptor and move to clean-up phase. * Close file descriptor and move to clean-up phase.
*/ */
rc = close(dcb->fd); rc = close(dcb->fd);
@ -453,7 +453,7 @@ int rc;
} }
memcpy(&(dcb->func), funcs, sizeof(GWPROTOCOL)); memcpy(&(dcb->func), funcs, sizeof(GWPROTOCOL));
/** /*<
* Link dcb to session. Unlink is called in dcb_final_free * Link dcb to session. Unlink is called in dcb_final_free
*/ */
if (!session_link_dcb(session, dcb)) if (!session_link_dcb(session, dcb))
@ -494,20 +494,20 @@ int rc;
session->client, session->client,
session->client->fd))); session->client->fd)));
} }
ss_dassert(dcb->fd == -1); /**< must be uninitialized at this point */ ss_dassert(dcb->fd == -1); /*< must be uninitialized at this point */
/** /*<
* Successfully connected to backend. Assign file descriptor to dcb * Successfully connected to backend. Assign file descriptor to dcb
*/ */
dcb->fd = fd; dcb->fd = fd;
/** /*<
* backend_dcb is connected to backend server, and once backend_dcb * backend_dcb is connected to backend server, and once backend_dcb
* is added to poll set, authentication takes place as part of * is added to poll set, authentication takes place as part of
* EPOLLOUT event that will be received once the connection * EPOLLOUT event that will be received once the connection
* is established. * is established.
*/ */
/** /*<
* Add the dcb in the poll set * Add the dcb in the poll set
*/ */
rc = poll_add_dcb(dcb); rc = poll_add_dcb(dcb);
@ -517,7 +517,7 @@ int rc;
dcb_final_free(dcb); dcb_final_free(dcb);
return NULL; return NULL;
} }
/* /*<
* The dcb will be addded into poll set by dcb->func.connect * The dcb will be addded into poll set by dcb->func.connect
*/ */
atomic_add(&server->stats.n_connections, 1); atomic_add(&server->stats.n_connections, 1);
@ -568,7 +568,7 @@ int eno = 0;
n = -1; n = -1;
goto return_n; goto return_n;
} }
/** Nothing to read - leave */ /*< Nothing to read - leave */
if (b == 0) { if (b == 0) {
n = 0; n = 0;
goto return_n; goto return_n;
@ -577,9 +577,9 @@ int eno = 0;
if ((buffer = gwbuf_alloc(bufsize)) == NULL) if ((buffer = gwbuf_alloc(bufsize)) == NULL)
{ {
/** /*<
* This is a fatal error which should cause shutdown. * This is a fatal error which should cause shutdown.
* vraa : todo shutdown if memory allocation fails. * Todo shutdown if memory allocation fails.
*/ */
LOGIF(LE, (skygw_log_write_flush( LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR, LOGFILE_ERROR,
@ -615,7 +615,7 @@ int eno = 0;
} }
else else
{ {
/** /*<
* If read would block it means that other thread * If read would block it means that other thread
* has probably read the data. * has probably read the data.
*/ */
@ -634,9 +634,9 @@ int eno = 0;
dcb, dcb,
STRDCBSTATE(dcb->state), STRDCBSTATE(dcb->state),
dcb->fd))); dcb->fd)));
/** Append read data to the gwbuf */ /*< Append read data to the gwbuf */
*head = gwbuf_append(*head, buffer); *head = gwbuf_append(*head, buffer);
} /**< while (true) */ } /*< while (true) */
return_n: return_n:
return n; return n;
} }
@ -773,7 +773,7 @@ dcb_write(DCB *dcb, GWBUF *queue)
STRDCBSTATE(dcb->state), STRDCBSTATE(dcb->state),
dcb->fd))); dcb->fd)));
} }
/** /*<
* What wasn't successfully written is stored to write queue * What wasn't successfully written is stored to write queue
* for suspended write. * for suspended write.
*/ */
@ -886,11 +886,8 @@ int saved_errno = 0;
* *
* Parameters: * Parameters:
* @param dcb The DCB to close * @param dcb The DCB to close
* @return none
* *
* *
* @details (write detailed description here)
*
*/ */
void void
dcb_close(DCB *dcb) dcb_close(DCB *dcb)
@ -898,7 +895,7 @@ dcb_close(DCB *dcb)
int rc; int rc;
CHK_DCB(dcb); CHK_DCB(dcb);
/** /*<
* dcb_close may be called for freshly created dcb, in which case * dcb_close may be called for freshly created dcb, in which case
* it only needs to be freed. * it only needs to be freed.
*/ */
@ -912,7 +909,7 @@ dcb_close(DCB *dcb)
dcb->state == DCB_STATE_NOPOLLING || dcb->state == DCB_STATE_NOPOLLING ||
dcb->state == DCB_STATE_ZOMBIE); dcb->state == DCB_STATE_ZOMBIE);
/** /*<
* Stop dcb's listening and modify state accordingly. * Stop dcb's listening and modify state accordingly.
*/ */
rc = poll_remove_dcb(dcb); rc = poll_remove_dcb(dcb);
@ -1178,9 +1175,9 @@ static bool dcb_set_state_nomutex(
case DCB_STATE_ALLOC: case DCB_STATE_ALLOC:
switch (new_state) { switch (new_state) {
case DCB_STATE_POLLING: /**< for client requests */ case DCB_STATE_POLLING: /*< for client requests */
case DCB_STATE_LISTENING: /**< for connect listeners */ case DCB_STATE_LISTENING: /*< for connect listeners */
case DCB_STATE_DISCONNECTED: /**< for failed connections */ case DCB_STATE_DISCONNECTED: /*< for failed connections */
dcb->state = new_state; dcb->state = new_state;
succp = true; succp = true;
break; break;
@ -1218,7 +1215,7 @@ static bool dcb_set_state_nomutex(
switch (new_state) { switch (new_state) {
case DCB_STATE_ZOMBIE: case DCB_STATE_ZOMBIE:
dcb->state = new_state; dcb->state = new_state;
case DCB_STATE_POLLING: /**< ok to try but state can't change */ case DCB_STATE_POLLING: /*< ok to try but state can't change */
succp = true; succp = true;
break; break;
default: default:
@ -1231,7 +1228,7 @@ static bool dcb_set_state_nomutex(
switch (new_state) { switch (new_state) {
case DCB_STATE_DISCONNECTED: case DCB_STATE_DISCONNECTED:
dcb->state = new_state; dcb->state = new_state;
case DCB_STATE_POLLING: /**< ok to try but state can't change */ case DCB_STATE_POLLING: /*< ok to try but state can't change */
succp = true; succp = true;
break; break;
default: default:
@ -1265,7 +1262,7 @@ static bool dcb_set_state_nomutex(
dcb))); dcb)));
ss_dassert(false); ss_dassert(false);
break; break;
} /* switch (dcb->state) */ } /*< switch (dcb->state) */
if (succp) { if (succp) {
LOGIF(LD, (skygw_log_write( LOGIF(LD, (skygw_log_write(
@ -1289,7 +1286,7 @@ int gw_write(
#if defined(SS_DEBUG) #if defined(SS_DEBUG)
if (dcb_fake_write_errno[fd] != 0) { if (dcb_fake_write_errno[fd] != 0) {
ss_dassert(dcb_fake_write_ev[fd] != 0); ss_dassert(dcb_fake_write_ev[fd] != 0);
w = write(fd, buf, nbytes/2); /**< leave peer to read missing bytes */ w = write(fd, buf, nbytes/2); /*< leave peer to read missing bytes */
if (w > 0) { if (w > 0) {
w = -1; w = -1;

View File

@ -357,7 +357,7 @@ static bool resolve_maxscale_conf_fname(
if (cnf_file_arg != NULL) if (cnf_file_arg != NULL)
{ {
char* home_etc_dir; char* home_etc_dir;
/** /*<
* 1. argument is valid full pathname * 1. argument is valid full pathname
* '- /home/jdoe/MaxScale/myconf.cnf' * '- /home/jdoe/MaxScale/myconf.cnf'
*/ */
@ -367,7 +367,7 @@ static bool resolve_maxscale_conf_fname(
succp = true; succp = true;
goto return_succp; goto return_succp;
} }
/** /*<
* 2. argument is file name only and file is located in home * 2. argument is file name only and file is located in home
* directory. * directory.
* '-f MaxScale.cnf' * '-f MaxScale.cnf'
@ -398,7 +398,7 @@ static bool resolve_maxscale_conf_fname(
goto return_succp; goto return_succp;
} }
} }
/** /*<
* 3. argument is valid relative pathname * 3. argument is valid relative pathname
* '-f ../myconf.cnf' * '-f ../myconf.cnf'
*/ */
@ -428,7 +428,7 @@ static bool resolve_maxscale_conf_fname(
goto return_succp; goto return_succp;
} }
} }
else /**<! default config file name is used */ else /*< default config file name is used */
{ {
*cnf_full_path = get_expanded_pathname(NULL, home_dir, default_cnf_fname); *cnf_full_path = get_expanded_pathname(NULL, home_dir, default_cnf_fname);
@ -469,7 +469,7 @@ static bool resolve_maxscale_homedir(
log_context = strdup("Command-line argument"); log_context = strdup("Command-line argument");
goto check_home_dir; goto check_home_dir;
} }
/** /*<
* 1. if home dir wasn't specified by a command-line argument, * 1. if home dir wasn't specified by a command-line argument,
* read env. variable MAXSCALE_HOME. * read env. variable MAXSCALE_HOME.
*/ */
@ -494,7 +494,7 @@ static bool resolve_maxscale_homedir(
"variable is not set."))); "variable is not set.")));
} }
free(tmp); free(tmp);
/** /*<
* 2. if home dir wasn't specified in MAXSCALE_HOME, * 2. if home dir wasn't specified in MAXSCALE_HOME,
* try access /etc/MaxScale/ * try access /etc/MaxScale/
*/ */
@ -507,7 +507,7 @@ static bool resolve_maxscale_homedir(
goto check_home_dir; goto check_home_dir;
} }
free(tmp); free(tmp);
/** /*<
* 3. if /etc/MaxScale/MaxScale.cnf didn't exist or wasn't accessible, home * 3. if /etc/MaxScale/MaxScale.cnf didn't exist or wasn't accessible, home
* isn't specified. Thus, try to access $PWD/MaxScale.cnf . * isn't specified. Thus, try to access $PWD/MaxScale.cnf .
*/ */
@ -605,16 +605,13 @@ return_succp:
* @param fprstr String to be printed to stderr * @param fprstr String to be printed to stderr
* *
* @param eno Errno, if it is set, zero, otherwise * @param eno Errno, if it is set, zero, otherwise
*
* @return void
*
*/ */
static void print_log_n_stderr( static void print_log_n_stderr(
bool do_log, /**<! is printing to log enabled */ bool do_log, /*< is printing to log enabled */
bool do_stderr,/**<! is printing to stderr enabled */ bool do_stderr,/*< is printing to stderr enabled */
char* logstr, /**<! string to be printed to log */ char* logstr, /*< string to be printed to log */
char* fprstr, /**<! string to be printed to stderr */ char* fprstr, /*< string to be printed to stderr */
int eno) /**<! errno, if it is set, zero, otherwise */ int eno) /*< errno, if it is set, zero, otherwise */
{ {
char* log_err = "Error :"; char* log_err = "Error :";
char* fpr_err = "*\n* Error :"; char* fpr_err = "*\n* Error :";
@ -735,7 +732,7 @@ static char* get_expanded_pathname(
expanded_path = (char*)malloc(PATH_MAX); expanded_path = (char*)malloc(PATH_MAX);
/** /*<
* Expand possible relative pathname to absolute path * Expand possible relative pathname to absolute path
*/ */
if (realpath(relative_path, expanded_path) == NULL) if (realpath(relative_path, expanded_path) == NULL)
@ -764,7 +761,7 @@ static char* get_expanded_pathname(
if (fname != NULL) if (fname != NULL)
{ {
/** /*<
* Concatenate an absolute filename and test its existence and * Concatenate an absolute filename and test its existence and
* readability. * readability.
*/ */
@ -793,7 +790,7 @@ static char* get_expanded_pathname(
} }
else else
{ {
/** /*<
* If only directory was provided, check that it is * If only directory was provided, check that it is
* readable. * readable.
*/ */
@ -1162,10 +1159,10 @@ int main(int argc, char **argv)
argv[0] = "MaxScale"; argv[0] = "MaxScale";
argv[1] = "-j"; argv[1] = "-j";
argv[2] = buf; argv[2] = buf;
argv[3] = "-s"; /*<! store to shared memory */ argv[3] = "-s"; /*< store to shared memory */
argv[4] = "LOGFILE_DEBUG,LOGFILE_TRACE"; /*<! ..these logs to shm */ argv[4] = "LOGFILE_DEBUG,LOGFILE_TRACE"; /*< ..these logs to shm */
argv[5] = "-l"; /*<! write to syslog */ argv[5] = "-l"; /*< write to syslog */
argv[6] = "LOGFILE_MESSAGE,LOGFILE_ERROR"; /*<! ..these logs to syslog */ argv[6] = "LOGFILE_MESSAGE,LOGFILE_ERROR"; /*< ..these logs to syslog */
argv[7] = NULL; argv[7] = NULL;
skygw_logmanager_init(7, argv); skygw_logmanager_init(7, argv);
} }

View File

@ -21,6 +21,7 @@
* @file gw_utils.c - A set if utility functions useful within the context * @file gw_utils.c - A set if utility functions useful within the context
* of the gateway. * of the gateway.
* *
* @verbatim
* Revision History * Revision History
* *
* Date Who Description * Date Who Description
@ -32,6 +33,7 @@
* from gw_read_gwbuff() * from gw_read_gwbuff()
* 25-09-2013 Massimiliano Pinto setipaddress uses getaddrinfo * 25-09-2013 Massimiliano Pinto setipaddress uses getaddrinfo
* *
*@endverbatim
*/ */
#include <gw.h> #include <gw.h>

View File

@ -20,7 +20,7 @@
#include <gwbitmask.h> #include <gwbitmask.h>
/** /**
* @file gwbitmask.c - Implementation of bitmask opertions for the gateway * @file gwbitmask.c Implementation of bitmask opertions for the gateway
* *
* We provide basic bitmask manipulation routines, the size of * We provide basic bitmask manipulation routines, the size of
* the bitmask will grow dynamically based on the highest bit * the bitmask will grow dynamically based on the highest bit

View File

@ -74,7 +74,7 @@ MODULES *mod;
if ((mod = find_module(module)) == NULL) if ((mod = find_module(module)) == NULL)
{ {
/** /*<
* The module is not already loaded * The module is not already loaded
* *
* Search of the shared object. * Search of the shared object.
@ -251,7 +251,7 @@ MODULES *ptr;
ptr = ptr->next; ptr = ptr->next;
} }
/* /*<
* The module is now not in the linked list and all * The module is now not in the linked list and all
* memory related to it can be freed * memory related to it can be freed
*/ */

View File

@ -44,21 +44,21 @@ extern int lm_enabled_logfiles_bitmask;
* @endverbatim * @endverbatim
*/ */
static int epoll_fd = -1; /**< The epoll file descriptor */ static int epoll_fd = -1; /*< The epoll file descriptor */
static int shutdown = 0; /**< Flag the shutdown of the poll subsystem */ static int shutdown = 0; /*< Flag the shutdown of the poll subsystem */
static GWBITMASK poll_mask; static GWBITMASK poll_mask;
static simple_mutex_t epoll_wait_mutex; /**< serializes calls to epoll_wait */ static simple_mutex_t epoll_wait_mutex; /*< serializes calls to epoll_wait */
/** /**
* The polling statistics * The polling statistics
*/ */
static struct { static struct {
int n_read; /**< Number of read events */ int n_read; /*< Number of read events */
int n_write; /**< Number of write events */ int n_write; /*< Number of write events */
int n_error; /**< Number of error events */ int n_error; /*< Number of error events */
int n_hup; /**< Number of hangup events */ int n_hup; /*< Number of hangup events */
int n_accept; /**< Number of accept events */ int n_accept; /*< Number of accept events */
int n_polls; /**< Number of poll cycles */ int n_polls; /*< Number of poll cycles */
} pollStats; } pollStats;
@ -102,7 +102,7 @@ poll_add_dcb(DCB *dcb)
ev.events = EPOLLIN | EPOLLOUT | EPOLLET; ev.events = EPOLLIN | EPOLLOUT | EPOLLET;
ev.data.ptr = dcb; ev.data.ptr = dcb;
/** /*<
* Choose new state according to the role of dcb. * Choose new state according to the role of dcb.
*/ */
if (dcb->dcb_role == DCB_ROLE_REQUEST_HANDLER) { if (dcb->dcb_role == DCB_ROLE_REQUEST_HANDLER) {
@ -111,7 +111,7 @@ poll_add_dcb(DCB *dcb)
ss_dassert(dcb->dcb_role == DCB_ROLE_SERVICE_LISTENER); ss_dassert(dcb->dcb_role == DCB_ROLE_SERVICE_LISTENER);
new_state = DCB_STATE_LISTENING; new_state = DCB_STATE_LISTENING;
} }
/** /*<
* If dcb is in unexpected state, state change fails indicating that dcb * If dcb is in unexpected state, state change fails indicating that dcb
* is not polling anymore. * is not polling anymore.
*/ */
@ -139,7 +139,7 @@ poll_add_dcb(DCB *dcb)
dcb, dcb,
STRDCBSTATE(dcb->state)))); STRDCBSTATE(dcb->state))));
} }
ss_dassert(rc == 0); /**< trap in debug */ ss_dassert(rc == 0); /*< trap in debug */
} else { } else {
LOGIF(LE, (skygw_log_write_flush( LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR, LOGFILE_ERROR,
@ -171,7 +171,7 @@ poll_remove_dcb(DCB *dcb)
CHK_DCB(dcb); CHK_DCB(dcb);
/** It is possible that dcb has already been removed from the set */ /*< It is possible that dcb has already been removed from the set */
if (dcb->state != DCB_STATE_POLLING) { if (dcb->state != DCB_STATE_POLLING) {
if (dcb->state == DCB_STATE_NOPOLLING || if (dcb->state == DCB_STATE_NOPOLLING ||
dcb->state == DCB_STATE_ZOMBIE) dcb->state == DCB_STATE_ZOMBIE)
@ -181,7 +181,7 @@ poll_remove_dcb(DCB *dcb)
goto return_rc; goto return_rc;
} }
/** /*<
* Set state to NOPOLLING and remove dcb from poll set. * Set state to NOPOLLING and remove dcb from poll set.
*/ */
if (dcb_set_state(dcb, new_state, &old_state)) { if (dcb_set_state(dcb, new_state, &old_state)) {
@ -196,9 +196,9 @@ poll_remove_dcb(DCB *dcb)
eno, eno,
strerror(eno)))); strerror(eno))));
} }
ss_dassert(rc == 0); /**< trap in debug */ ss_dassert(rc == 0); /*< trap in debug */
} }
/** /*<
* This call was redundant, but the end result is correct. * This call was redundant, but the end result is correct.
*/ */
else if (old_state == new_state) else if (old_state == new_state)
@ -207,14 +207,14 @@ poll_remove_dcb(DCB *dcb)
goto return_rc; goto return_rc;
} }
/** Set bit for each maxscale thread */ /*< Set bit for each maxscale thread */
bitmask_copy(&dcb->memdata.bitmask, poll_bitmask()); bitmask_copy(&dcb->memdata.bitmask, poll_bitmask());
rc = 0; rc = 0;
return_rc: return_rc:
return rc; return rc;
} }
#define BLOCKINGPOLL 0 /* Set BLOCKING POLL to 1 if using a single thread and to make #define BLOCKINGPOLL 0 /*< Set BLOCKING POLL to 1 if using a single thread and to make
* debugging easier. * debugging easier.
*/ */
@ -248,7 +248,7 @@ poll_waitevents(void *arg)
int i, nfds; int i, nfds;
int thread_id = (int)arg; int thread_id = (int)arg;
bool no_op = false; bool no_op = false;
static bool process_zombies_only = false; /**< flag for all threads */ static bool process_zombies_only = false; /*< flag for all threads */
DCB *zombies = NULL; DCB *zombies = NULL;
/* Add this thread to the bitmask of running polling threads */ /* Add this thread to the bitmask of running polling threads */
@ -297,7 +297,7 @@ poll_waitevents(void *arg)
events, events,
MAX_EVENTS, MAX_EVENTS,
EPOLL_TIMEOUT); EPOLL_TIMEOUT);
/** /*<
* When there are zombies to be cleaned up but * When there are zombies to be cleaned up but
* no client requests, allow all threads to call * no client requests, allow all threads to call
* dcb_process_zombies without having to wait * dcb_process_zombies without having to wait
@ -480,7 +480,7 @@ poll_waitevents(void *arg)
&dcb->dcb_read_lock); &dcb->dcb_read_lock);
#endif #endif
} }
} /**< for */ } /*< for */
no_op = FALSE; no_op = FALSE;
} }
process_zombies: process_zombies:
@ -492,14 +492,14 @@ poll_waitevents(void *arg)
if (shutdown) if (shutdown)
{ {
/** /*<
* Remove the thread from the bitmask of running * Remove the thread from the bitmask of running
* polling threads. * polling threads.
*/ */
bitmask_clear(&poll_mask, thread_id); bitmask_clear(&poll_mask, thread_id);
return; return;
} }
} /**< while(1) */ } /*< while(1) */
} }
/** /**

View File

@ -83,7 +83,7 @@ session_alloc(SERVICE *service, DCB *client_dcb)
session->ses_chk_tail = CHK_NUM_SESSION; session->ses_chk_tail = CHK_NUM_SESSION;
#endif #endif
spinlock_init(&session->ses_lock); spinlock_init(&session->ses_lock);
/** /*<
* Prevent backend threads from accessing before session is completely * Prevent backend threads from accessing before session is completely
* initialized. * initialized.
*/ */
@ -93,7 +93,7 @@ session_alloc(SERVICE *service, DCB *client_dcb)
memset(&session->stats, 0, sizeof(SESSION_STATS)); memset(&session->stats, 0, sizeof(SESSION_STATS));
session->stats.connect = time(0); session->stats.connect = time(0);
session->state = SESSION_STATE_ALLOC; session->state = SESSION_STATE_ALLOC;
/** /*<
* Associate the session to the client DCB and set the reference count on * Associate the session to the client DCB and set the reference count on
* the session to indicate that there is a single reference to the * the session to indicate that there is a single reference to the
* session. There is no need to protect this or use atomic add as the * session. There is no need to protect this or use atomic add as the
@ -103,13 +103,13 @@ session_alloc(SERVICE *service, DCB *client_dcb)
session->data = client_dcb->data; session->data = client_dcb->data;
client_dcb->session = session; client_dcb->session = session;
session->refcount = 1; session->refcount = 1;
/** /*<
* This indicates that session is ready to be shared with backend * This indicates that session is ready to be shared with backend
* DCBs. * DCBs.
*/ */
session->state = SESSION_STATE_READY; session->state = SESSION_STATE_READY;
/** Release session lock */ /*< Release session lock */
spinlock_release(&session->ses_lock); spinlock_release(&session->ses_lock);
/* /*
@ -129,7 +129,7 @@ session_alloc(SERVICE *service, DCB *client_dcb)
session); session);
if (session->router_session == NULL) { if (session->router_session == NULL) {
/** /*<
* Decrease refcount, set dcb's session pointer NULL * Decrease refcount, set dcb's session pointer NULL
* and set session pointer to NULL. * and set session pointer to NULL.
*/ */
@ -191,7 +191,7 @@ int session_unlink_dcb(
spinlock_acquire(&session->ses_lock); spinlock_acquire(&session->ses_lock);
ss_dassert(session->refcount > 0); ss_dassert(session->refcount > 0);
/** /*<
* Remove dcb from session's router_client_session. * Remove dcb from session's router_client_session.
*/ */
nlink = atomic_add(&session->refcount, -1); nlink = atomic_add(&session->refcount, -1);
@ -225,7 +225,7 @@ bool session_free(
CHK_SESSION(session); CHK_SESSION(session);
/** /*<
* Remove one reference. If there are no references left, * Remove one reference. If there are no references left,
* free session. * free session.
*/ */

View File

@ -213,8 +213,6 @@ void gw_sha1_2_str(const uint8_t *in, int in_len, const uint8_t *in2, int in2_le
* @return errno * @return errno
* *
* *
* @details (write detailed description here)
*
*/ */
int gw_getsockerrno( int gw_getsockerrno(
int fd) int fd)

View File

@ -48,8 +48,8 @@
* but still maintain separate data pointers. * but still maintain separate data pointers.
*/ */
typedef struct { typedef struct {
unsigned char *data; /**< Physical memory that was allocated */ unsigned char *data; /*< Physical memory that was allocated */
int refcount; /**< Reference count on the buffer */ int refcount; /*< Reference count on the buffer */
} SHARED_BUF; } SHARED_BUF;
/** /**
@ -61,29 +61,29 @@ typedef struct {
* be copied within the gateway. * be copied within the gateway.
*/ */
typedef struct gwbuf { typedef struct gwbuf {
struct gwbuf *next; /**< Next buffer in a linked chain of buffers */ struct gwbuf *next; /*< Next buffer in a linked chain of buffers */
void *start; /**< Start of the valid data */ void *start; /*< Start of the valid data */
void *end; /**< First byte after the valid data */ void *end; /*< First byte after the valid data */
SHARED_BUF *sbuf; /**< The shared buffer with the real data */ SHARED_BUF *sbuf; /*< The shared buffer with the real data */
int command;/**< The command type for the queue */ int command;/*< The command type for the queue */
} GWBUF; } GWBUF;
/* /*<
* Macros to access the data in the buffers * Macros to access the data in the buffers
*/ */
/**< First valid, uncomsumed byte in the buffer */ /*< First valid, uncomsumed byte in the buffer */
#define GWBUF_DATA(b) ((b)->start) #define GWBUF_DATA(b) ((b)->start)
/**< Number of bytes in the individual buffer */ /*< Number of bytes in the individual buffer */
#define GWBUF_LENGTH(b) ((b)->end - (b)->start) #define GWBUF_LENGTH(b) ((b)->end - (b)->start)
/**< True if all bytes in the buffer have been consumed */ /*< True if all bytes in the buffer have been consumed */
#define GWBUF_EMPTY(b) ((b)->start == (b)->end) #define GWBUF_EMPTY(b) ((b)->start == (b)->end)
/**< Consume a number of bytes in the buffer */ /*< Consume a number of bytes in the buffer */
#define GWBUF_CONSUME(b, bytes) (b)->start += bytes #define GWBUF_CONSUME(b, bytes) (b)->start += bytes
/* /*<
* Function prototypes for the API to maniplate the buffers * Function prototypes for the API to maniplate the buffers
*/ */
extern GWBUF *gwbuf_alloc(unsigned int size); extern GWBUF *gwbuf_alloc(unsigned int size);

View File

@ -93,10 +93,10 @@ typedef struct gw_protocol {
* The statitics gathered on a descriptor control block * The statitics gathered on a descriptor control block
*/ */
typedef struct dcbstats { typedef struct dcbstats {
int n_reads; /**< Number of reads on this descriptor */ int n_reads; /*< Number of reads on this descriptor */
int n_writes; /**< Number of writes on this descriptor */ int n_writes; /*< Number of writes on this descriptor */
int n_accepts; /**< Number of accepts on this descriptor */ int n_accepts; /*< Number of accepts on this descriptor */
int n_buffered; /**< Number of buffered writes */ int n_buffered; /*< Number of buffered writes */
} DCBSTATS; } DCBSTATS;
/** /**
@ -118,25 +118,25 @@ typedef struct dcbstats {
* is completely cleared the DCB can finally be freed and removed from the zombie list. * is completely cleared the DCB can finally be freed and removed from the zombie list.
*/ */
typedef struct { typedef struct {
GWBITMASK bitmask; /**< The bitmask of threads */ GWBITMASK bitmask; /*< The bitmask of threads */
struct dcb *next; /**< Next pointer for the zombie list */ struct dcb *next; /*< Next pointer for the zombie list */
} DCBMM; } DCBMM;
/* DCB states */ /* DCB states */
typedef enum { typedef enum {
DCB_STATE_UNDEFINED, /**< State variable with no state */ DCB_STATE_UNDEFINED, /*< State variable with no state */
DCB_STATE_ALLOC, /**< Memory allocated but not populated */ DCB_STATE_ALLOC, /*< Memory allocated but not populated */
DCB_STATE_POLLING, /**< Waiting in the poll loop */ DCB_STATE_POLLING, /*< Waiting in the poll loop */
DCB_STATE_LISTENING, /**< The DCB is for a listening socket */ DCB_STATE_LISTENING, /*< The DCB is for a listening socket */
DCB_STATE_DISCONNECTED, /**< The socket is now closed */ DCB_STATE_DISCONNECTED, /*< The socket is now closed */
DCB_STATE_FREED, /**< Memory freed */ DCB_STATE_FREED, /*< Memory freed */
DCB_STATE_NOPOLLING, /**< Removed from poll mask */ DCB_STATE_NOPOLLING, /*< Removed from poll mask */
DCB_STATE_ZOMBIE /**< DCB is no longer active, waiting to free it */ DCB_STATE_ZOMBIE /*< DCB is no longer active, waiting to free it */
} dcb_state_t; } dcb_state_t;
typedef enum { typedef enum {
DCB_ROLE_SERVICE_LISTENER, DCB_ROLE_SERVICE_LISTENER, /*< Receives initial connect requests from clients */
DCB_ROLE_REQUEST_HANDLER DCB_ROLE_REQUEST_HANDLER /*< Serves dedicated client */
} dcb_role_t; } dcb_role_t;
/** /**

View File

@ -147,7 +147,7 @@ static int gw_read_backend_event(DCB *dcb) {
CHK_DCB(dcb); CHK_DCB(dcb);
CHK_SESSION(dcb->session); CHK_SESSION(dcb->session);
/** return only with complete session */ /*< return only with complete session */
current_session = gw_get_shared_session_auth_info(dcb); current_session = gw_get_shared_session_auth_info(dcb);
ss_dassert(current_session != NULL); ss_dassert(current_session != NULL);
@ -172,7 +172,7 @@ static int gw_read_backend_event(DCB *dcb) {
* 3. and return * 3. and return
*/ */
/** /*<
* If starting to auhenticate with backend server, lock dcb * If starting to auhenticate with backend server, lock dcb
* to prevent overlapping processing of auth messages. * to prevent overlapping processing of auth messages.
*/ */
@ -234,7 +234,7 @@ static int gw_read_backend_event(DCB *dcb) {
router_instance = session->service->router_instance; router_instance = session->service->router_instance;
if (backend_protocol->state == MYSQL_AUTH_RECV) { if (backend_protocol->state == MYSQL_AUTH_RECV) {
/** /*<
* Read backed auth reply * Read backed auth reply
*/ */
receive_rc = receive_rc =
@ -283,7 +283,7 @@ static int gw_read_backend_event(DCB *dcb) {
} }
if (backend_protocol->state == MYSQL_AUTH_FAILED) { if (backend_protocol->state == MYSQL_AUTH_FAILED) {
/** /*<
* vraa : errorHandle * vraa : errorHandle
* check the delayq before the reply * check the delayq before the reply
*/ */
@ -301,7 +301,7 @@ static int gw_read_backend_event(DCB *dcb) {
} }
rsession = session->router_session; rsession = session->router_session;
ss_dassert(rsession != NULL); ss_dassert(rsession != NULL);
/** /*<
* vraa : errorHandle * vraa : errorHandle
* rsession should never be NULL here. * rsession should never be NULL here.
**/ **/
@ -357,8 +357,8 @@ static int gw_read_backend_event(DCB *dcb) {
rc = dcb_read(dcb, &writebuf); rc = dcb_read(dcb, &writebuf);
if (rc < 0) { if (rc < 0) {
/** vraa : errorHandle */ /*< vraa : errorHandle */
/** /*<
* Backend generated EPOLLIN event and if backend has * Backend generated EPOLLIN event and if backend has
* failed, connection must be closed to avoid backend * failed, connection must be closed to avoid backend
* dcb from getting hanged. * dcb from getting hanged.
@ -384,7 +384,7 @@ static int gw_read_backend_event(DCB *dcb) {
* and pass now the gwbuf to the router * and pass now the gwbuf to the router
*/ */
/** /*<
* If dcb->session->client is freed already it may be NULL. * If dcb->session->client is freed already it may be NULL.
*/ */
if (dcb->session->client != NULL) { if (dcb->session->client != NULL) {
@ -425,12 +425,12 @@ static int gw_write_backend_event(DCB *dcb) {
int rc = 0; int rc = 0;
MySQLProtocol *backend_protocol = dcb->protocol; MySQLProtocol *backend_protocol = dcb->protocol;
/** /*<
* Don't write to backend if backend_dcb is not in poll set anymore. * Don't write to backend if backend_dcb is not in poll set anymore.
*/ */
if (dcb->state != DCB_STATE_POLLING) { if (dcb->state != DCB_STATE_POLLING) {
if (dcb->writeq != NULL) { if (dcb->writeq != NULL) {
/** vraa : errorHandle */ /*< vraa : errorHandle */
mysql_send_custom_error( mysql_send_custom_error(
dcb->session->client, dcb->session->client,
1, 1,
@ -500,13 +500,13 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
MySQLProtocol *backend_protocol = dcb->protocol; MySQLProtocol *backend_protocol = dcb->protocol;
int rc; int rc;
/** /*<
* Don't write to backend if backend_dcb is not in poll set anymore. * Don't write to backend if backend_dcb is not in poll set anymore.
*/ */
spinlock_acquire(&dcb->authlock); spinlock_acquire(&dcb->authlock);
if (dcb->state != DCB_STATE_POLLING) { if (dcb->state != DCB_STATE_POLLING) {
/** vraa : errorHandle */ /*< vraa : errorHandle */
/** Free buffer memory */ /*< Free buffer memory */
gwbuf_consume(queue, GWBUF_LENGTH(queue)); gwbuf_consume(queue, GWBUF_LENGTH(queue));
LOGIF(LD, (skygw_log_write( LOGIF(LD, (skygw_log_write(
@ -522,7 +522,7 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
return 0; return 0;
} }
/** /*<
* Now put the incoming data to the delay queue unless backend is * Now put the incoming data to the delay queue unless backend is
* connected with auth ok * connected with auth ok
*/ */
@ -541,7 +541,7 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
return 1; return 1;
} }
/** /*<
* Now we set the last command received, from the current queue * Now we set the last command received, from the current queue
*/ */
memcpy(&dcb->command, &queue->command, sizeof(dcb->command)); memcpy(&dcb->command, &queue->command, sizeof(dcb->command));
@ -570,8 +570,8 @@ static int gw_error_backend_event(DCB *dcb) {
router_instance = session->service->router_instance; router_instance = session->service->router_instance;
if (dcb->state != DCB_STATE_POLLING) { if (dcb->state != DCB_STATE_POLLING) {
/** vraa : errorHandle */ /*< vraa : errorHandle */
/** /*<
* if client is not available it needs to be handled in send * if client is not available it needs to be handled in send
* function. Session != NULL, that is known. * function. Session != NULL, that is known.
*/ */
@ -583,7 +583,7 @@ static int gw_error_backend_event(DCB *dcb) {
rc = 0; rc = 0;
} else { } else {
/** vraa : errorHandle */ /*< vraa : errorHandle */
mysql_send_custom_error( mysql_send_custom_error(
dcb->session->client, dcb->session->client,
1, 1,
@ -599,7 +599,7 @@ static int gw_error_backend_event(DCB *dcb) {
rc))); rc)));
rsession = session->router_session; rsession = session->router_session;
ss_dassert(rsession != NULL); ss_dassert(rsession != NULL);
/** /*<
* vraa : errorHandle * vraa : errorHandle
* rsession should never be NULL here. * rsession should never be NULL here.
*/ */
@ -654,12 +654,12 @@ static int gw_create_backend_connection(
goto return_fd; goto return_fd;
} }
/** if succeed, fd > 0, -1 otherwise */ /*< if succeed, fd > 0, -1 otherwise */
rv = gw_do_connect_to_backend(server->name, server->port, &fd); rv = gw_do_connect_to_backend(server->name, server->port, &fd);
/** Assign protocol with backend_dcb */ /*< Assign protocol with backend_dcb */
backend_dcb->protocol = protocol; backend_dcb->protocol = protocol;
/** Set protocol state */ /*< Set protocol state */
switch (rv) { switch (rv) {
case 0: case 0:
ss_dassert(fd > 0); ss_dassert(fd > 0);
@ -705,7 +705,7 @@ static int gw_create_backend_connection(
protocol->fd, protocol->fd,
session->client->fd))); session->client->fd)));
break; break;
} /**< switch */ } /*< switch */
return_fd: return_fd:
return fd; return fd;
@ -721,7 +721,7 @@ return_fd:
static int static int
gw_backend_hangup(DCB *dcb) gw_backend_hangup(DCB *dcb)
{ {
/** vraa : errorHandle */ /*< vraa : errorHandle */
return 1; return 1;
} }
@ -734,7 +734,7 @@ gw_backend_hangup(DCB *dcb)
static int static int
gw_backend_close(DCB *dcb) gw_backend_close(DCB *dcb)
{ {
/** vraa : errorHandle */ /*< vraa : errorHandle */
dcb_close(dcb); dcb_close(dcb);
return 1; return 1;
} }
@ -781,7 +781,7 @@ static int backend_write_delayqueue(DCB *dcb)
localq = dcb->delayq; localq = dcb->delayq;
dcb->delayq = NULL; dcb->delayq = NULL;
/** /*<
* Now we set the last command received, from the delayed queue * Now we set the last command received, from the delayed queue
*/ */
@ -791,7 +791,7 @@ static int backend_write_delayqueue(DCB *dcb)
rc = dcb_write(dcb, localq); rc = dcb_write(dcb, localq);
if (rc == 0) { if (rc == 0) {
/** vraa : errorHandle */ /*< vraa : errorHandle */
LOGIF(LE, (skygw_log_write_flush( LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR, LOGFILE_ERROR,
"%lu [backend_write_delayqueue] Some error occurred in " "%lu [backend_write_delayqueue] Some error occurred in "
@ -861,7 +861,7 @@ static int gw_change_user(DCB *backend, SERVER *server, SESSION *in_session, GWB
free(auth_token); free(auth_token);
if (auth_ret != 0) { if (auth_ret != 0) {
/** vraa : errorHandle */ /*< vraa : errorHandle */
fprintf(stderr, "<<< CLIENT AUTH FAILED for user [%s], user session will not change!\n", username); fprintf(stderr, "<<< CLIENT AUTH FAILED for user [%s], user session will not change!\n", username);
// send the error packet // send the error packet
@ -874,14 +874,14 @@ static int gw_change_user(DCB *backend, SERVER *server, SESSION *in_session, GWB
//fprintf(stderr, "<<<< Backend session data is [%s],[%s],[%s]\n", current_session->user, current_session->client_sha1, current_session->db); //fprintf(stderr, "<<<< Backend session data is [%s],[%s],[%s]\n", current_session->user, current_session->client_sha1, current_session->db);
rv = gw_send_change_user_to_backend(database, username, client_sha1, backend_protocol); rv = gw_send_change_user_to_backend(database, username, client_sha1, backend_protocol);
/** /*<
* The current queue was not handled by func.write() in gw_send_change_user_to_backend() * The current queue was not handled by func.write() in gw_send_change_user_to_backend()
* We wrote a new gwbuf * We wrote a new gwbuf
* Set backend command here! * Set backend command here!
*/ */
memcpy(&backend->command, &queue->command, sizeof(backend->command)); memcpy(&backend->command, &queue->command, sizeof(backend->command));
/** /*<
* Now copy new data into user session * Now copy new data into user session
*/ */
strcpy(current_session->user, username); strcpy(current_session->user, username);

View File

@ -80,7 +80,7 @@ MySQLProtocol* mysql_protocol_init(
p->protocol_chk_top = CHK_NUM_PROTOCOL; p->protocol_chk_top = CHK_NUM_PROTOCOL;
p->protocol_chk_tail = CHK_NUM_PROTOCOL; p->protocol_chk_tail = CHK_NUM_PROTOCOL;
#endif #endif
/** Assign fd with protocol */ /*< Assign fd with protocol */
p->fd = fd; p->fd = fd;
p->owner_dcb = dcb; p->owner_dcb = dcb;
CHK_PROTOCOL(p); CHK_PROTOCOL(p);
@ -311,7 +311,7 @@ int gw_receive_backend_auth(
n = dcb_read(dcb, &head); n = dcb_read(dcb, &head);
/** /*<
* Read didn't fail and there is enough data for mysql packet. * Read didn't fail and there is enough data for mysql packet.
*/ */
if (n != -1 && if (n != -1 &&
@ -319,7 +319,7 @@ int gw_receive_backend_auth(
GWBUF_LENGTH(head) >= 5) GWBUF_LENGTH(head) >= 5)
{ {
ptr = GWBUF_DATA(head); ptr = GWBUF_DATA(head);
/** /*<
* 5th byte is 0x0 if successful. * 5th byte is 0x0 if successful.
*/ */
if (ptr[4] == '\x00') { if (ptr[4] == '\x00') {
@ -346,14 +346,14 @@ int gw_receive_backend_auth(
free(tmpbuf); free(tmpbuf);
rc = -1; rc = -1;
} }
/** /*<
* Remove data from buffer. * Remove data from buffer.
*/ */
head = gwbuf_consume(head, gwbuf_length(head)); head = gwbuf_consume(head, gwbuf_length(head));
} }
else if (n == 0) else if (n == 0)
{ {
/** /*<
* This is considered as success because call didn't fail, * This is considered as success because call didn't fail,
* although no bytes was read. * although no bytes was read.
*/ */
@ -654,7 +654,7 @@ int gw_do_connect_to_backend(
port, port,
eno, eno,
strerror(eno)))); strerror(eno))));
/** Close newly created socket. */ /*< Close newly created socket. */
rc = close(so); rc = close(so);
if (rc != 0) { if (rc != 0) {
@ -1021,7 +1021,7 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le
return 1; return 1;
} }
/** /*<
* get the user's password from repository in SHA1(SHA1(real_password)); * get the user's password from repository in SHA1(SHA1(real_password));
* please note 'real_password' is unknown! * please note 'real_password' is unknown!
*/ */
@ -1034,7 +1034,7 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le
} }
if (token && token_len) { if (token && token_len) {
/** /*<
* convert in hex format: this is the content of mysql.user table. * convert in hex format: this is the content of mysql.user table.
* The field password is without the '*' prefix and it is 40 bytes long * The field password is without the '*' prefix and it is 40 bytes long
*/ */
@ -1051,7 +1051,7 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le
} }
} }
/** /*<
* Auth check in 3 steps * Auth check in 3 steps
* *
* Note: token = XOR (SHA1(real_password), SHA1(CONCAT(scramble, SHA1(SHA1(real_password))))) * Note: token = XOR (SHA1(real_password), SHA1(CONCAT(scramble, SHA1(SHA1(real_password)))))
@ -1066,7 +1066,7 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le
gw_sha1_2_str(scramble, scramble_len, password, SHA_DIGEST_LENGTH, step1); gw_sha1_2_str(scramble, scramble_len, password, SHA_DIGEST_LENGTH, step1);
/** /*<
* step2: STEP2 = XOR(token, STEP1) * step2: STEP2 = XOR(token, STEP1)
* *
* token is trasmitted form client and it's based on the handshake scramble and SHA1(real_passowrd) * token is trasmitted form client and it's based on the handshake scramble and SHA1(real_passowrd)
@ -1076,14 +1076,14 @@ int gw_check_mysql_scramble_data(DCB *dcb, uint8_t *token, unsigned int token_le
gw_str_xor(step2, token, step1, token_len); gw_str_xor(step2, token, step1, token_len);
/** /*<
* copy the stage1_hash back to the caller * copy the stage1_hash back to the caller
* stage1_hash will be used for backend authentication * stage1_hash will be used for backend authentication
*/ */
memcpy(stage1_hash, step2, SHA_DIGEST_LENGTH); memcpy(stage1_hash, step2, SHA_DIGEST_LENGTH);
/** /*<
* step 3: prepare the check_hash * step 3: prepare the check_hash
* *
* compute the SHA1(STEP2) that is SHA1(SHA1(the_password_to_check)), and is SHA_DIGEST_LENGTH long * compute the SHA1(STEP2) that is SHA1(SHA1(the_password_to_check)), and is SHA_DIGEST_LENGTH long
@ -1135,7 +1135,7 @@ int gw_find_mysql_user_password_sha1(char *username, uint8_t *gateway_password,
return 1; return 1;
} }
/** /*<
* Convert now the hex data (40 bytes) to binary (20 bytes). * Convert now the hex data (40 bytes) to binary (20 bytes).
* The gateway_password represents the SHA1(SHA1(real_password)). * The gateway_password represents the SHA1(SHA1(real_password)).
* Please not real_password is unknown and SHA1(real_password) is unknown as well * Please not real_password is unknown and SHA1(real_password) is unknown as well