php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
mysqlnd_wireprotocol.c File Reference
#include "php.h"
#include "mysqlnd.h"
#include "mysqlnd_connection.h"
#include "mysqlnd_ps.h"
#include "mysqlnd_priv.h"
#include "mysqlnd_wireprotocol.h"
#include "mysqlnd_statistics.h"
#include "mysqlnd_debug.h"

Go to the source code of this file.

Macros

#define BAIL_IF_NO_MORE_DATA
 
#define ERROR_MARKER   0xFF
 
#define EODATA_MARKER   0xFE
 
#define MARIADB_RPL_VERSION_HACK   "5.5.5-"
 
#define AUTH_WRITE_BUFFER_LEN   (MYSQLND_HEADER_SIZE + MYSQLND_MAX_ALLOWED_USER_LEN + SCRAMBLE_LENGTH + MYSQLND_MAX_ALLOWED_DB_LEN + 1 + 4096)
 
#define READ_RSET_FIELD(field_name)
 
#define PREPARE_RESPONSE_SIZE_41   9
 
#define PREPARE_RESPONSE_SIZE_50   12
 

Functions

zend_ulong php_mysqlnd_net_field_length (const zend_uchar **packet)
 
uint64_t php_mysqlnd_net_field_length_ll (const zend_uchar **packet)
 
zend_ucharphp_mysqlnd_net_store_length (zend_uchar *packet, const uint64_t length)
 
size_t php_mysqlnd_net_store_length_size (uint64_t length)
 
size_t php_mysqlnd_cmd_write (MYSQLND_CONN_DATA *conn, void *_packet)
 
enum_func_status php_mysqlnd_rowp_read_binary_protocol (MYSQLND_ROW_BUFFER *row_buffer, zval *fields, const unsigned int field_count, const MYSQLND_FIELD *const fields_metadata, const bool as_int_or_float, MYSQLND_STATS *const stats)
 
enum_func_status php_mysqlnd_rowp_read_text_protocol (MYSQLND_ROW_BUFFER *row_buffer, zval *fields, unsigned int field_count, const MYSQLND_FIELD *fields_metadata, bool as_int_or_float, MYSQLND_STATS *stats)
 
PHPAPI MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORYmysqlnd_protocol_payload_decoder_factory_init (MYSQLND_CONN_DATA *conn, const bool persistent)
 
PHPAPI void mysqlnd_protocol_payload_decoder_factory_free (MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY *const factory)
 

Variables

const char *const mysqlnd_empty_string = ""
 
const char mysqlnd_read_header_name [] = "mysqlnd_read_header"
 
const char mysqlnd_read_body_name [] = "mysqlnd_read_body"
 
const char *const mysqlnd_command_to_text [COM_END]
 
 MYSQLND_CLASS_METHODS_END
 

Macro Definition Documentation

◆ AUTH_WRITE_BUFFER_LEN

Definition at line 523 of file mysqlnd_wireprotocol.c.

◆ BAIL_IF_NO_MORE_DATA

#define BAIL_IF_NO_MORE_DATA
Value:
if (UNEXPECTED((size_t)(p - begin) > packet->header.size)) { \
php_error_docref(NULL, E_WARNING, "Premature end of data (mysqlnd_wireprotocol.c:%u)", __LINE__); \
goto premature_end; \
} \
int begin
Definition eaw_table.h:20
#define NULL
Definition gdcache.h:45
p
Definition session.c:1105
#define E_WARNING
Definition zend_errors.h:24
#define UNEXPECTED(condition)

Definition at line 27 of file mysqlnd_wireprotocol.c.

◆ EODATA_MARKER

#define EODATA_MARKER   0xFE

Definition at line 42 of file mysqlnd_wireprotocol.c.

◆ ERROR_MARKER

#define ERROR_MARKER   0xFF

Definition at line 41 of file mysqlnd_wireprotocol.c.

◆ MARIADB_RPL_VERSION_HACK

#define MARIADB_RPL_VERSION_HACK   "5.5.5-"

Definition at line 44 of file mysqlnd_wireprotocol.c.

◆ PREPARE_RESPONSE_SIZE_41

#define PREPARE_RESPONSE_SIZE_41   9

Definition at line 1821 of file mysqlnd_wireprotocol.c.

◆ PREPARE_RESPONSE_SIZE_50

#define PREPARE_RESPONSE_SIZE_50   12

Definition at line 1822 of file mysqlnd_wireprotocol.c.

◆ READ_RSET_FIELD

#define READ_RSET_FIELD ( field_name)
Value:
do { \
goto faulty_or_fake; \
} else if (len != 0) { \
meta->field_name = (const char *)p; \
meta->field_name ## _length = len; \
p += len; \
total_len += len + 1; \
} else { \
meta->field_name = mysqlnd_empty_string; \
meta->field_name ## _length = 0; \
} \
} while (0)
size_t len
Definition apprentice.c:174
zend_ulong php_mysqlnd_net_field_length(const zend_uchar **packet)
const char *const mysqlnd_empty_string
#define MYSQLND_NULL_LENGTH

Definition at line 1173 of file mysqlnd_wireprotocol.c.

Function Documentation

◆ mysqlnd_protocol_payload_decoder_factory_free()

PHPAPI void mysqlnd_protocol_payload_decoder_factory_free ( MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY *const factory)

Definition at line 2692 of file mysqlnd_wireprotocol.c.

◆ mysqlnd_protocol_payload_decoder_factory_init()

PHPAPI MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * mysqlnd_protocol_payload_decoder_factory_init ( MYSQLND_CONN_DATA * conn,
const bool persistent )

Definition at line 2680 of file mysqlnd_wireprotocol.c.

◆ php_mysqlnd_cmd_write()

size_t php_mysqlnd_cmd_write ( MYSQLND_CONN_DATA * conn,
void * _packet )

Definition at line 992 of file mysqlnd_wireprotocol.c.

◆ php_mysqlnd_net_field_length()

zend_ulong php_mysqlnd_net_field_length ( const zend_uchar ** packet)

Definition at line 94 of file mysqlnd_wireprotocol.c.

◆ php_mysqlnd_net_field_length_ll()

uint64_t php_mysqlnd_net_field_length_ll ( const zend_uchar ** packet)

Definition at line 124 of file mysqlnd_wireprotocol.c.

◆ php_mysqlnd_net_store_length()

zend_uchar * php_mysqlnd_net_store_length ( zend_uchar * packet,
const uint64_t length )

Definition at line 153 of file mysqlnd_wireprotocol.c.

◆ php_mysqlnd_net_store_length_size()

size_t php_mysqlnd_net_store_length_size ( uint64_t length)

Definition at line 180 of file mysqlnd_wireprotocol.c.

◆ php_mysqlnd_rowp_read_binary_protocol()

enum_func_status php_mysqlnd_rowp_read_binary_protocol ( MYSQLND_ROW_BUFFER * row_buffer,
zval * fields,
const unsigned int field_count,
const MYSQLND_FIELD *const fields_metadata,
const bool as_int_or_float,
MYSQLND_STATS *const stats )

Definition at line 1454 of file mysqlnd_wireprotocol.c.

◆ php_mysqlnd_rowp_read_text_protocol()

enum_func_status php_mysqlnd_rowp_read_text_protocol ( MYSQLND_ROW_BUFFER * row_buffer,
zval * fields,
unsigned int field_count,
const MYSQLND_FIELD * fields_metadata,
bool as_int_or_float,
MYSQLND_STATS * stats )

Definition at line 1562 of file mysqlnd_wireprotocol.c.

Variable Documentation

◆ MYSQLND_CLASS_METHODS_END

MYSQLND_CLASS_METHODS_END

Definition at line 2675 of file mysqlnd_wireprotocol.c.

◆ mysqlnd_command_to_text

const char* const mysqlnd_command_to_text[COM_END]
Initial value:
=
{
"SLEEP", "QUIT", "INIT_DB", "QUERY", "FIELD_LIST",
"CREATE_DB", "DROP_DB", "REFRESH", "SHUTDOWN", "STATISTICS",
"PROCESS_INFO", "CONNECT", "PROCESS_KILL", "DEBUG", "PING",
"TIME", "DELAYED_INSERT", "CHANGE_USER", "BINLOG_DUMP",
"TABLE_DUMP", "CONNECT_OUT", "REGISTER_SLAVE",
"STMT_PREPARE", "STMT_EXECUTE", "STMT_SEND_LONG_DATA", "STMT_CLOSE",
"STMT_RESET", "SET_OPTION", "STMT_FETCH", "DAEMON", "BINLOG_DUMP_GTID",
"RESET_CONNECTION"
}

Definition at line 47 of file mysqlnd_wireprotocol.c.

◆ mysqlnd_empty_string

const char* const mysqlnd_empty_string = ""

Definition at line 35 of file mysqlnd_wireprotocol.c.

◆ mysqlnd_read_body_name

const char mysqlnd_read_body_name[] = "mysqlnd_read_body"

Definition at line 39 of file mysqlnd_wireprotocol.c.

◆ mysqlnd_read_header_name

const char mysqlnd_read_header_name[] = "mysqlnd_read_header"

Definition at line 38 of file mysqlnd_wireprotocol.c.