MySQL  8.0.18
Source Code Documentation
common.h File Reference
#include <mysql/plugin_auth_common.h>
#include <sspi.h>
#include <windows.h>
#include "my_dbug.h"

Go to the source code of this file.

Classes

struct  error_log_level
 Debugging and error reporting infrastructure. More...
 
class  Blob
 Class representing a region of memory (e.g., a string or binary buffer). More...
 
class  Connection
 Connection class. More...
 
class  Sid
 Sid class. More...
 
class  UPN
 UPN class. More...
 

Macros

#define MAX_SERVICE_NAME_LENGTH   1024
 Maximum length of the target service name. More...
 
#define ERROR_LOG(Level, Msg)   error_log_print<error_log_level::Level> Msg
 
#define DBUG_PRINT_DO(Keyword, Msg)
 
#define DBUG_PRINT(Keyword, Msg)   DBUG_PRINT_DO(Keyword, Msg)
 
#define DBUG_ENTER(X)
 
#define DBUG_RETURN(X)   return (X)
 
#define DBUG_ASSERT(X)   assert(X)
 
#define DBUG_DUMP(A, B, C)
 

Typedefs

typedef char Error_message_buf[1024]
 
typedef unsigned char byte
 Blob class. More...
 

Functions

unsigned int get_log_level (void)
 
void set_log_level (unsigned int)
 
void error_log_vprint (error_log_level::type level, const char *fmt, va_list args)
 
template<error_log_level::type Level>
void error_log_print (const char *fmt,...)
 
const char * get_last_error_message (Error_message_buf)
 Error handling. More...
 
void debug_msg (const char *fmt,...)
 
char * wchar_to_utf8 (const wchar_t *, size_t *)
 Convert a wide-char string to utf8 representation. More...
 
wchar_t * utf8_to_wchar (const char *, size_t *)
 Convert an utf8 string to a wide-char string. More...
 

Variables

int opt_auth_win_log_level
 

Macro Definition Documentation

◆ DBUG_ASSERT

#define DBUG_ASSERT (   X)    assert(X)

◆ DBUG_DUMP

#define DBUG_DUMP (   A,
  B,
 
)
Value:
do { \
} while (0)

◆ DBUG_ENTER

#define DBUG_ENTER (   X)
Value:
do { \
} while (0)

◆ DBUG_PRINT

#define DBUG_PRINT (   Keyword,
  Msg 
)    DBUG_PRINT_DO(Keyword, Msg)

◆ DBUG_PRINT_DO

#define DBUG_PRINT_DO (   Keyword,
  Msg 
)
Value:
do { \
if (4 > get_log_level()) break; \
fprintf(stderr, "winauth: %s: ", Keyword); \
debug_msg Msg; \
} while (0)
while(-- *argc > 0 &&*(pos= *(++*argv))=='-')
Definition: do_ctype.cc:83
unsigned int get_log_level(void)
Definition: log_client.cc:60
void debug_msg(const char *fmt,...)
Definition: common.h:108

◆ DBUG_RETURN

#define DBUG_RETURN (   X)    return (X)

◆ ERROR_LOG

#define ERROR_LOG (   Level,
  Msg 
)    error_log_print<error_log_level::Level> Msg

◆ MAX_SERVICE_NAME_LENGTH

#define MAX_SERVICE_NAME_LENGTH   1024

Maximum length of the target service name.

Typedef Documentation

◆ byte

typedef unsigned char byte

Blob class.

◆ Error_message_buf

typedef char Error_message_buf[1024]

Function Documentation

◆ debug_msg()

void debug_msg ( const char *  fmt,
  ... 
)
inline

◆ error_log_print()

template<error_log_level::type Level>
void error_log_print ( const char *  fmt,
  ... 
)

◆ error_log_vprint()

void error_log_vprint ( error_log_level::type  level,
const char *  fmt,
va_list  args 
)

◆ get_last_error_message()

const char* get_last_error_message ( Error_message_buf  buf)

Error handling.

Returns error message corresponding to the last Windows error given by GetLastError().

Note
Error message is overwritten by next call to get_last_error_message().

◆ get_log_level()

unsigned int get_log_level ( void  )

◆ set_log_level()

void set_log_level ( unsigned  int)

◆ utf8_to_wchar()

wchar_t* utf8_to_wchar ( const char *  string,
size_t *  len 
)

Convert an utf8 string to a wide-char string.

Parameters
[in]stringnull-terminated utf8 string to be converted
[in,out]lenlength of the string to be converted or 0; on return length (in chars) of the converted string

If len is 0 then the length of the string will be computed by this function.

Returns
Pointer to a buffer containing wide-char representation or NULL in case of error.
Note
The returned buffer must be freed with free() call.

◆ wchar_to_utf8()

char* wchar_to_utf8 ( const wchar_t *  string,
size_t *  len 
)

Convert a wide-char string to utf8 representation.

Parameters
[in]stringnull-terminated wide-char string to be converted
[in,out]lenlength of the string to be converted or 0; on return length (in bytes, excluding terminating null character) of the converted string

If len is 0 then the length of the string will be computed by this function.

Returns
Pointer to a buffer containing utf8 representation or NULL in case of error.
Note
The returned buffer must be freed with free() call.

Variable Documentation

◆ opt_auth_win_log_level

int opt_auth_win_log_level