Lines Matching refs:net
87 MYSQLND_METHOD(mysqlnd_net, network_read_ex)(MYSQLND_NET * const net, zend_uchar * const buffer, co… in MYSQLND_METHOD()
91 php_stream * net_stream = net->data->m.get_stream(net TSRMLS_CC); in MYSQLND_METHOD()
99 net_stream->chunk_size = MIN(to_read, net->data->options.net_read_buffer_size); in MYSQLND_METHOD()
118 MYSQLND_METHOD(mysqlnd_net, network_write_ex)(MYSQLND_NET * const net, const zend_uchar * const buf… in MYSQLND_METHOD()
124 ret = php_stream_write(net->data->m.get_stream(net TSRMLS_CC), (char *)buffer, count); in MYSQLND_METHOD()
131 MYSQLND_METHOD(mysqlnd_net, open_pipe)(MYSQLND_NET * const net, const char * const scheme, const si… in MYSQLND_METHOD()
169 MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const char * const scheme, c… in MYSQLND_METHOD()
188 net->data->stream = NULL; in MYSQLND_METHOD()
191 hashed_details_len = mnd_sprintf(&hashed_details, 0, "%p", net); in MYSQLND_METHOD()
195 if (net->data->options.timeout_connect) { in MYSQLND_METHOD()
196 tv.tv_sec = net->data->options.timeout_connect; in MYSQLND_METHOD()
202 hashed_details, (net->data->options.timeout_connect) ? &tv : NULL, in MYSQLND_METHOD()
260 MYSQLND_METHOD(mysqlnd_net, post_connect_set_opt)(MYSQLND_NET * const net, in MYSQLND_METHOD()
264 php_stream * net_stream = net->data->m.get_stream(net TSRMLS_CC); in MYSQLND_METHOD()
267 if (net->data->options.timeout_read) { in MYSQLND_METHOD()
269 DBG_INF_FMT("setting %u as PHP_STREAM_OPTION_READ_TIMEOUT", net->data->options.timeout_read); in MYSQLND_METHOD()
270 tv.tv_sec = net->data->options.timeout_read; in MYSQLND_METHOD()
290 MYSQLND_METHOD(mysqlnd_net, get_open_stream)(MYSQLND_NET * const net, const char * const scheme, co… in MYSQLND_METHOD()
296 ret = net->data->m.open_pipe; in MYSQLND_METHOD()
301 ret = net->data->m.open_tcp_or_unix; in MYSQLND_METHOD()
315 MYSQLND_METHOD(mysqlnd_net, connect_ex)(MYSQLND_NET * const net, const char * const scheme, const s… in MYSQLND_METHOD()
323 net->packet_no = net->compressed_envelope_packet_no = 0; in MYSQLND_METHOD()
325 net->data->m.close_stream(net, conn_stats, error_info TSRMLS_CC); in MYSQLND_METHOD()
327 open_stream = net->data->m.get_open_stream(net, scheme, scheme_len, error_info TSRMLS_CC); in MYSQLND_METHOD()
329 …php_stream * net_stream = open_stream(net, scheme, scheme_len, persistent, conn_stats, error_info … in MYSQLND_METHOD()
331 (void) net->data->m.set_stream(net, net_stream TSRMLS_CC); in MYSQLND_METHOD()
332 net->data->m.post_connect_set_opt(net, scheme, scheme_len, conn_stats, error_info TSRMLS_CC); in MYSQLND_METHOD()
364 MYSQLND_METHOD(mysqlnd_net, send_ex)(MYSQLND_NET * const net, zend_uchar * const buffer, const size… in MYSQLND_METHOD()
376 DBG_INF_FMT("count=" MYSQLND_SZ_T_SPEC " compression=%u", count, net->data->compressed); in MYSQLND_METHOD()
378 if (net->data->compressed == TRUE) { in MYSQLND_METHOD()
388 DBG_INF_FMT("compressed_envelope_packet_no=%u", net->compressed_envelope_packet_no); in MYSQLND_METHOD()
389 DBG_INF_FMT("packet_no=%u", net->packet_no); in MYSQLND_METHOD()
391 if (net->data->compressed == TRUE) { in MYSQLND_METHOD()
399 int1store(uncompressed_payload + 3, net->packet_no); in MYSQLND_METHOD()
400 …if (PASS == net->data->m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), &tm… in MYSQLND_METHOD()
413 int1store(compress_buf + 3, net->packet_no); in MYSQLND_METHOD()
415 …bytes_sent = net->data->m.network_write_ex(net, compress_buf, payload_size + MYSQLND_HEADER_SIZE +… in MYSQLND_METHOD()
417 net->compressed_envelope_packet_no++; in MYSQLND_METHOD()
422 int error = net->data->m.decode(decompressed_data, decompressed_size, in MYSQLND_METHOD()
446 int1store(p + 3, net->packet_no); in MYSQLND_METHOD()
447 …bytes_sent = net->data->m.network_write_ex(net, p, to_be_sent + MYSQLND_HEADER_SIZE, conn_stats, e… in MYSQLND_METHOD()
449 net->compressed_envelope_packet_no++; in MYSQLND_METHOD()
451 net->packet_no++; in MYSQLND_METHOD()
465 DBG_INF_FMT("packet_size="MYSQLND_SZ_T_SPEC" packet_no=%u", left, net->packet_no); in MYSQLND_METHOD()
554 …(MYSQLND_NET * net, size_t net_payload_size, MYSQLND_STATS * conn_stats, MYSQLND_ERROR_INFO * erro… in MYSQLND_METHOD()
563 …if (FAIL == net->data->m.network_read_ex(net, comp_header, COMPRESSED_HEADER_SIZE, conn_stats, err… in MYSQLND_METHOD()
573 …if (FAIL == net->data->m.network_read_ex(net, compressed_data, net_payload_size, conn_stats, error… in MYSQLND_METHOD()
577 net->uncompressed_data = mysqlnd_create_read_buffer(decompressed_size TSRMLS_CC); in MYSQLND_METHOD()
578 …retval = net->data->m.decode(net->uncompressed_data->data, decompressed_size, compressed_data, net… in MYSQLND_METHOD()
584 net->uncompressed_data = mysqlnd_create_read_buffer(net_payload_size TSRMLS_CC); in MYSQLND_METHOD()
585 …if (FAIL == net->data->m.network_read_ex(net, net->uncompressed_data->data, net_payload_size, conn… in MYSQLND_METHOD()
653 MYSQLND_METHOD(mysqlnd_net, receive_ex)(MYSQLND_NET * const net, zend_uchar * const buffer, const s… in MYSQLND_METHOD()
661 if (net->data->compressed) { in MYSQLND_METHOD()
662 if (net->uncompressed_data) { in MYSQLND_METHOD()
663 …size_t to_read_from_buffer = MIN(net->uncompressed_data->bytes_left(net->uncompressed_data), to_re… in MYSQLND_METHOD()
666 net->uncompressed_data->read(net->uncompressed_data, to_read_from_buffer, (zend_uchar *) p); in MYSQLND_METHOD()
671 if (TRUE == net->uncompressed_data->is_empty(net->uncompressed_data)) { in MYSQLND_METHOD()
673 net->uncompressed_data->free_buffer(&net->uncompressed_data TSRMLS_CC); in MYSQLND_METHOD()
681 …if (FAIL == net->data->m.network_read_ex(net, net_header, MYSQLND_HEADER_SIZE, conn_stats, error_i… in MYSQLND_METHOD()
686 if (net->compressed_envelope_packet_no != packet_no) { in MYSQLND_METHOD()
688 net->compressed_envelope_packet_no, packet_no, net_payload_size); in MYSQLND_METHOD()
691 net->compressed_envelope_packet_no, packet_no, net_payload_size); in MYSQLND_METHOD()
694 net->compressed_envelope_packet_no++; in MYSQLND_METHOD()
699 …net->data->m.read_compressed_packet_from_stream_and_fill_read_buffer(net, net_payload_size, conn_s… in MYSQLND_METHOD()
707 DBG_RETURN(net->data->m.receive_ex(net, p, to_read, conn_stats, error_info TSRMLS_CC)); in MYSQLND_METHOD()
712 DBG_RETURN(net->data->m.network_read_ex(net, p, to_read, conn_stats, error_info TSRMLS_CC)); in MYSQLND_METHOD()
719 MYSQLND_METHOD(mysqlnd_net, set_client_option)(MYSQLND_NET * const net, enum mysqlnd_option option,… in MYSQLND_METHOD()
729 net->cmd_buffer.length = *(unsigned int*) value; in MYSQLND_METHOD()
730 DBG_INF_FMT("new_length="MYSQLND_SZ_T_SPEC, net->cmd_buffer.length); in MYSQLND_METHOD()
731 if (!net->cmd_buffer.buffer) { in MYSQLND_METHOD()
732 net->cmd_buffer.buffer = mnd_pemalloc(net->cmd_buffer.length, net->persistent); in MYSQLND_METHOD()
734 …net->cmd_buffer.buffer = mnd_perealloc(net->cmd_buffer.buffer, net->cmd_buffer.length, net->persis… in MYSQLND_METHOD()
739 net->data->options.net_read_buffer_size = *(unsigned int*) value; in MYSQLND_METHOD()
740 DBG_INF_FMT("new_length="MYSQLND_SZ_T_SPEC, net->data->options.net_read_buffer_size); in MYSQLND_METHOD()
744 net->data->options.timeout_connect = *(unsigned int*) value; in MYSQLND_METHOD()
748 zend_bool pers = net->persistent; in MYSQLND_METHOD()
749 if (net->data->options.ssl_key) { in MYSQLND_METHOD()
750 mnd_pefree(net->data->options.ssl_key, pers); in MYSQLND_METHOD()
752 net->data->options.ssl_key = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
757 zend_bool pers = net->persistent; in MYSQLND_METHOD()
758 if (net->data->options.ssl_cert) { in MYSQLND_METHOD()
759 mnd_pefree(net->data->options.ssl_cert, pers); in MYSQLND_METHOD()
761 net->data->options.ssl_cert = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
766 zend_bool pers = net->persistent; in MYSQLND_METHOD()
767 if (net->data->options.ssl_ca) { in MYSQLND_METHOD()
768 mnd_pefree(net->data->options.ssl_ca, pers); in MYSQLND_METHOD()
770 net->data->options.ssl_ca = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
775 zend_bool pers = net->persistent; in MYSQLND_METHOD()
776 if (net->data->options.ssl_capath) { in MYSQLND_METHOD()
777 mnd_pefree(net->data->options.ssl_capath, pers); in MYSQLND_METHOD()
779 net->data->options.ssl_capath = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
784 zend_bool pers = net->persistent; in MYSQLND_METHOD()
785 if (net->data->options.ssl_cipher) { in MYSQLND_METHOD()
786 mnd_pefree(net->data->options.ssl_cipher, pers); in MYSQLND_METHOD()
788 net->data->options.ssl_cipher = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
793 zend_bool pers = net->persistent; in MYSQLND_METHOD()
794 if (net->data->options.ssl_passphrase) { in MYSQLND_METHOD()
795 mnd_pefree(net->data->options.ssl_passphrase, pers); in MYSQLND_METHOD()
797 net->data->options.ssl_passphrase = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
819 net->data->options.ssl_verify_peer = val; in MYSQLND_METHOD()
823 net->data->options.timeout_read = *(unsigned int*) value; in MYSQLND_METHOD()
827 net->data->options.timeout_write = *(unsigned int*) value; in MYSQLND_METHOD()
831 net->data->options.flags |= MYSQLND_NET_FLAG_USE_COMPRESSION; in MYSQLND_METHOD()
835 zend_bool pers = net->persistent; in MYSQLND_METHOD()
836 if (net->data->options.sha256_server_public_key) { in MYSQLND_METHOD()
837 mnd_pefree(net->data->options.sha256_server_public_key, pers); in MYSQLND_METHOD()
839 net->data->options.sha256_server_public_key = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
851 MYSQLND_METHOD(mysqlnd_net, consume_uneaten_data)(MYSQLND_NET * const net, enum php_mysqlnd_server_… in MYSQLND_METHOD()
864 php_stream * net_stream = net->data->get_stream(net TSRMLS_CC); in MYSQLND_METHOD()
883 bytes_consumed, mysqlnd_command_to_text[net->last_command]); in MYSQLND_METHOD()
886 bytes_consumed, mysqlnd_command_to_text[net->last_command]); in MYSQLND_METHOD()
889 net->last_command = cmd; in MYSQLND_METHOD()
903 MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net TSRMLS_DC) in MYSQLND_METHOD()
907 php_stream * net_stream = net->data->m.get_stream(net TSRMLS_CC); in MYSQLND_METHOD()
915 if (net->data->options.ssl_key) { in MYSQLND_METHOD()
917 ZVAL_STRING(&key_zval, net->data->options.ssl_key, 0); in MYSQLND_METHOD()
921 if (net->data->options.ssl_cert) { in MYSQLND_METHOD()
923 ZVAL_STRING(&cert_zval, net->data->options.ssl_cert, 0); in MYSQLND_METHOD()
925 if (!net->data->options.ssl_key) { in MYSQLND_METHOD()
930 if (net->data->options.ssl_ca) { in MYSQLND_METHOD()
932 ZVAL_STRING(&cafile_zval, net->data->options.ssl_ca, 0); in MYSQLND_METHOD()
936 if (net->data->options.ssl_capath) { in MYSQLND_METHOD()
938 ZVAL_STRING(&capath_zval, net->data->options.ssl_capath, 0); in MYSQLND_METHOD()
942 if (net->data->options.ssl_passphrase) { in MYSQLND_METHOD()
944 ZVAL_STRING(&passphrase_zval, net->data->options.ssl_passphrase, 0); in MYSQLND_METHOD()
948 if (net->data->options.ssl_cipher) { in MYSQLND_METHOD()
950 ZVAL_STRING(&cipher_zval, net->data->options.ssl_cipher, 0); in MYSQLND_METHOD()
958 if (net->data->options.ssl_verify_peer == MYSQLND_SSL_PEER_DEFAULT) { in MYSQLND_METHOD()
959 …net->data->options.ssl_verify_peer = any_flag? MYSQLND_SSL_PEER_DEFAULT_ACTION:MYSQLND_SSL_PEER_DO… in MYSQLND_METHOD()
962 verify = net->data->options.ssl_verify_peer == MYSQLND_SSL_PEER_VERIFY? TRUE:FALSE; in MYSQLND_METHOD()
968 if (net->data->options.ssl_verify_peer == MYSQLND_SSL_PEER_DONT_VERIFY) { in MYSQLND_METHOD()
982 net->data->ssl = TRUE; in MYSQLND_METHOD()
992 if (net->data->options.timeout_read) { in MYSQLND_METHOD()
994 DBG_INF_FMT("setting %u as PHP_STREAM_OPTION_READ_TIMEOUT", net->data->options.timeout_read); in MYSQLND_METHOD()
995 tv.tv_sec = net->data->options.timeout_read; in MYSQLND_METHOD()
1012 MYSQLND_METHOD(mysqlnd_net, disable_ssl)(MYSQLND_NET * const net TSRMLS_DC) in MYSQLND_METHOD()
1022 MYSQLND_METHOD(mysqlnd_net, free_contents)(MYSQLND_NET * net TSRMLS_DC) in MYSQLND_METHOD()
1024 zend_bool pers = net->persistent; in MYSQLND_METHOD()
1028 if (net->uncompressed_data) { in MYSQLND_METHOD()
1029 net->uncompressed_data->free_buffer(&net->uncompressed_data TSRMLS_CC); in MYSQLND_METHOD()
1032 if (net->data->options.ssl_key) { in MYSQLND_METHOD()
1033 mnd_pefree(net->data->options.ssl_key, pers); in MYSQLND_METHOD()
1034 net->data->options.ssl_key = NULL; in MYSQLND_METHOD()
1036 if (net->data->options.ssl_cert) { in MYSQLND_METHOD()
1037 mnd_pefree(net->data->options.ssl_cert, pers); in MYSQLND_METHOD()
1038 net->data->options.ssl_cert = NULL; in MYSQLND_METHOD()
1040 if (net->data->options.ssl_ca) { in MYSQLND_METHOD()
1041 mnd_pefree(net->data->options.ssl_ca, pers); in MYSQLND_METHOD()
1042 net->data->options.ssl_ca = NULL; in MYSQLND_METHOD()
1044 if (net->data->options.ssl_capath) { in MYSQLND_METHOD()
1045 mnd_pefree(net->data->options.ssl_capath, pers); in MYSQLND_METHOD()
1046 net->data->options.ssl_capath = NULL; in MYSQLND_METHOD()
1048 if (net->data->options.ssl_cipher) { in MYSQLND_METHOD()
1049 mnd_pefree(net->data->options.ssl_cipher, pers); in MYSQLND_METHOD()
1050 net->data->options.ssl_cipher = NULL; in MYSQLND_METHOD()
1052 if (net->data->options.sha256_server_public_key) { in MYSQLND_METHOD()
1053 mnd_pefree(net->data->options.sha256_server_public_key, pers); in MYSQLND_METHOD()
1054 net->data->options.sha256_server_public_key = NULL; in MYSQLND_METHOD()
1064 MYSQLND_METHOD(mysqlnd_net, close_stream)(MYSQLND_NET * const net, MYSQLND_STATS * const stats, MYS… in MYSQLND_METHOD()
1068 if (net && (net_stream = net->data->m.get_stream(net TSRMLS_CC))) { in MYSQLND_METHOD()
1069 zend_bool pers = net->persistent; in MYSQLND_METHOD()
1084 (void) net->data->m.set_stream(net, NULL TSRMLS_CC); in MYSQLND_METHOD()
1094 MYSQLND_METHOD(mysqlnd_net, init)(MYSQLND_NET * const net, MYSQLND_STATS * const stats, MYSQLND_ERR… in MYSQLND_METHOD()
1100 net->data->m.set_client_option(net, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, (char *) &buf_size TSRMLS_CC); in MYSQLND_METHOD()
1103 net->data->m.set_client_option(net, MYSQLND_OPT_NET_READ_BUFFER_SIZE, (char *)&buf_size TSRMLS_CC); in MYSQLND_METHOD()
1106 net->data->m.set_client_option(net, MYSQL_OPT_READ_TIMEOUT, (char *)&buf_size TSRMLS_CC); in MYSQLND_METHOD()
1115 MYSQLND_METHOD(mysqlnd_net, dtor)(MYSQLND_NET * const net, MYSQLND_STATS * const stats, MYSQLND_ERR… in MYSQLND_METHOD()
1118 if (net) { in MYSQLND_METHOD()
1119 net->data->m.free_contents(net TSRMLS_CC); in MYSQLND_METHOD()
1120 net->data->m.close_stream(net, stats, error_info TSRMLS_CC); in MYSQLND_METHOD()
1122 if (net->cmd_buffer.buffer) { in MYSQLND_METHOD()
1124 mnd_pefree(net->cmd_buffer.buffer, net->persistent); in MYSQLND_METHOD()
1125 net->cmd_buffer.buffer = NULL; in MYSQLND_METHOD()
1128 mnd_pefree(net->data, net->data->persistent); in MYSQLND_METHOD()
1129 mnd_pefree(net, net->persistent); in MYSQLND_METHOD()
1138 MYSQLND_METHOD(mysqlnd_net, get_stream)(const MYSQLND_NET * const net TSRMLS_DC) in MYSQLND_METHOD()
1141 DBG_INF_FMT("%p", net? net->data->stream:NULL); in MYSQLND_METHOD()
1142 DBG_RETURN(net? net->data->stream:NULL); in MYSQLND_METHOD()
1149 MYSQLND_METHOD(mysqlnd_net, set_stream)(MYSQLND_NET * const net, php_stream * net_stream TSRMLS_DC) in MYSQLND_METHOD()
1153 if (net) { in MYSQLND_METHOD()
1154 net->data->stream = net_stream; in MYSQLND_METHOD()
1155 ret = net->data->stream; in MYSQLND_METHOD()
1201 MYSQLND_NET * net; in mysqlnd_net_init() local
1203 …net = MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_object_factory).get_io_channel(persistent, stats, er… in mysqlnd_net_init()
1204 DBG_RETURN(net); in mysqlnd_net_init()
1211 mysqlnd_net_free(MYSQLND_NET * const net, MYSQLND_STATS * stats, MYSQLND_ERROR_INFO * error_info TS… in mysqlnd_net_free() argument
1214 if (net) { in mysqlnd_net_free()
1215 net->data->m.dtor(net, stats, error_info TSRMLS_CC); in mysqlnd_net_free()