summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_wireprotocol.h
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2010-01-07 19:44:59 +0000
committerAndrey Hristov <andrey@php.net>2010-01-07 19:44:59 +0000
commit73b23fca37d6d27d703511d9a7eedad84e786f23 (patch)
tree2f47b8e985d32d184670ef663021cbeea12402ba /ext/mysqlnd/mysqlnd_wireprotocol.h
parent1ee6c8277faa3f48ab8e82888a34e0e2d0a8ea1f (diff)
downloadphp-git-73b23fca37d6d27d703511d9a7eedad84e786f23.tar.gz
Change of way the packet objects are created/initialised
If the protocol gets changed, ever, we can decide at runtime easily which protocol to use by instantiating the right protocol object. But this is restricted to the structure of the packets, not the flow.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_wireprotocol.h')
-rw-r--r--ext/mysqlnd/mysqlnd_wireprotocol.h21
1 files changed, 5 insertions, 16 deletions
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h
index 66622e5cc4..7229db59e2 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.h
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.h
@@ -36,13 +36,6 @@ extern char * mysqlnd_read_body_name;
/* Packet handling */
-#define PACKET_INIT(packet, enum_type, c_type, pers) \
- { \
- packet = (c_type) pecalloc(1, packet_methods[(enum_type)].struct_size, (pers)); \
- ((c_type) (packet))->header.m = &packet_methods[(enum_type)]; \
- ((c_type) (packet))->header.persistent = (pers); \
- DBG_INF_FMT("PACKET_INIT(%p, %d, %d)", packet, (int) enum_type, (int) pers); \
- }
#define PACKET_WRITE(packet, conn) ((packet)->header.m->write_to_net((packet), (conn) TSRMLS_CC))
#define PACKET_READ(packet, conn) ((packet)->header.m->read_from_net((packet), (conn) TSRMLS_CC))
#define PACKET_FREE(packet) \
@@ -51,15 +44,6 @@ extern char * mysqlnd_read_body_name;
((packet)->header.m->free_mem((packet), FALSE TSRMLS_CC)); \
} while (0);
-#define PACKET_INIT_ALLOCA(packet, enum_type) \
- { \
- memset(&(packet), 0, packet_methods[enum_type].struct_size); \
- (packet).header.m = &packet_methods[enum_type]; \
- }
-#define PACKET_WRITE_ALLOCA(packet, conn) PACKET_WRITE(&(packet), (conn))
-#define PACKET_READ_ALLOCA(packet, conn) PACKET_READ(&(packet), (conn))
-#define PACKET_FREE_ALLOCA(packet) (packet.header.m->free_mem(&(packet), TRUE TSRMLS_CC))
-
extern const char * const mysqlnd_command_to_text[COM_END];
/* Low-level extraction functionality */
@@ -285,6 +269,11 @@ void php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * row_buffer,
zend_bool as_unicode, zend_bool as_int_or_float,
MYSQLND_STATS * stats TSRMLS_DC);
+
+MYSQLND_PROTOCOL * mysqlnd_protocol_init(zend_bool persistent TSRMLS_DC);
+void mysqlnd_protocol_free(MYSQLND_PROTOCOL * net TSRMLS_DC);
+
+
#endif /* MYSQLND_WIREPROTOCOL_H */
/*