Lines Matching refs:net
85 MYSQLND_METHOD(mysqlnd_net, network_read_ex)(MYSQLND_NET * const net, zend_uchar * const buffer, co… in MYSQLND_METHOD()
89 php_stream * net_stream = net->data->m.get_stream(net); in MYSQLND_METHOD()
97 net_stream->chunk_size = MIN(to_read, net->data->options.net_read_buffer_size); in MYSQLND_METHOD()
116 MYSQLND_METHOD(mysqlnd_net, network_write_ex)(MYSQLND_NET * const net, const zend_uchar * const buf… in MYSQLND_METHOD()
122 ret = php_stream_write(net->data->m.get_stream(net), (char *)buffer, count); in MYSQLND_METHOD()
130 MYSQLND_METHOD(mysqlnd_net, open_pipe)(MYSQLND_NET * const net, const char * const scheme, const si… in MYSQLND_METHOD()
166 MYSQLND_METHOD(mysqlnd_net, open_tcp_or_unix)(MYSQLND_NET * const net, const char * const scheme, c… in MYSQLND_METHOD()
182 net->data->stream = NULL; in MYSQLND_METHOD()
185 hashed_details_len = mnd_sprintf(&hashed_details, 0, "%p", net); in MYSQLND_METHOD()
189 if (net->data->options.timeout_connect) { in MYSQLND_METHOD()
190 tv.tv_sec = net->data->options.timeout_connect; in MYSQLND_METHOD()
196 hashed_details, (net->data->options.timeout_connect) ? &tv : NULL, in MYSQLND_METHOD()
258 MYSQLND_METHOD(mysqlnd_net, post_connect_set_opt)(MYSQLND_NET * const net, in MYSQLND_METHOD()
262 php_stream * net_stream = net->data->m.get_stream(net); in MYSQLND_METHOD()
265 if (net->data->options.timeout_read) { in MYSQLND_METHOD()
267 DBG_INF_FMT("setting %u as PHP_STREAM_OPTION_READ_TIMEOUT", net->data->options.timeout_read); in MYSQLND_METHOD()
268 tv.tv_sec = net->data->options.timeout_read; in MYSQLND_METHOD()
288 MYSQLND_METHOD(mysqlnd_net, get_open_stream)(MYSQLND_NET * const net, const char * const scheme, co… in MYSQLND_METHOD()
294 ret = net->data->m.open_pipe; in MYSQLND_METHOD()
299 ret = net->data->m.open_tcp_or_unix; in MYSQLND_METHOD()
313 MYSQLND_METHOD(mysqlnd_net, connect_ex)(MYSQLND_NET * const net, const char * const scheme, const s… in MYSQLND_METHOD()
321 net->packet_no = net->compressed_envelope_packet_no = 0; in MYSQLND_METHOD()
323 net->data->m.close_stream(net, conn_stats, error_info); in MYSQLND_METHOD()
325 open_stream = net->data->m.get_open_stream(net, scheme, scheme_len, error_info); in MYSQLND_METHOD()
327 …php_stream * net_stream = open_stream(net, scheme, scheme_len, persistent, conn_stats, error_info); in MYSQLND_METHOD()
329 (void) net->data->m.set_stream(net, net_stream); in MYSQLND_METHOD()
330 net->data->m.post_connect_set_opt(net, scheme, scheme_len, conn_stats, error_info); in MYSQLND_METHOD()
362 MYSQLND_METHOD(mysqlnd_net, send_ex)(MYSQLND_NET * const net, zend_uchar * const buffer, const size… in MYSQLND_METHOD()
374 DBG_INF_FMT("count=" MYSQLND_SZ_T_SPEC " compression=%u", count, net->data->compressed); in MYSQLND_METHOD()
376 if (net->data->compressed == TRUE) { in MYSQLND_METHOD()
386 DBG_INF_FMT("compressed_envelope_packet_no=%u", net->compressed_envelope_packet_no); in MYSQLND_METHOD()
387 DBG_INF_FMT("packet_no=%u", net->packet_no); in MYSQLND_METHOD()
389 if (net->data->compressed == TRUE) { in MYSQLND_METHOD()
397 int1store(uncompressed_payload + 3, net->packet_no); in MYSQLND_METHOD()
398 …if (PASS == net->data->m.encode((compress_buf + COMPRESSED_HEADER_SIZE + MYSQLND_HEADER_SIZE), &tm… in MYSQLND_METHOD()
411 int1store(compress_buf + 3, net->packet_no); in MYSQLND_METHOD()
413 …bytes_sent = net->data->m.network_write_ex(net, compress_buf, payload_size + MYSQLND_HEADER_SIZE +… in MYSQLND_METHOD()
415 net->compressed_envelope_packet_no++; in MYSQLND_METHOD()
420 int error = net->data->m.decode(decompressed_data, decompressed_size, in MYSQLND_METHOD()
444 int1store(p + 3, net->packet_no); in MYSQLND_METHOD()
445 …bytes_sent = net->data->m.network_write_ex(net, p, to_be_sent + MYSQLND_HEADER_SIZE, conn_stats, e… in MYSQLND_METHOD()
447 net->compressed_envelope_packet_no++; in MYSQLND_METHOD()
449 net->packet_no++; in MYSQLND_METHOD()
463 DBG_INF_FMT("packet_size="MYSQLND_SZ_T_SPEC" packet_no=%u", left, net->packet_no); in MYSQLND_METHOD()
552 …(MYSQLND_NET * net, size_t net_payload_size, MYSQLND_STATS * conn_stats, MYSQLND_ERROR_INFO * erro… in MYSQLND_METHOD()
561 …if (FAIL == net->data->m.network_read_ex(net, comp_header, COMPRESSED_HEADER_SIZE, conn_stats, err… in MYSQLND_METHOD()
571 …if (FAIL == net->data->m.network_read_ex(net, compressed_data, net_payload_size, conn_stats, error… in MYSQLND_METHOD()
575 net->uncompressed_data = mysqlnd_create_read_buffer(decompressed_size); in MYSQLND_METHOD()
576 …retval = net->data->m.decode(net->uncompressed_data->data, decompressed_size, compressed_data, net… in MYSQLND_METHOD()
582 net->uncompressed_data = mysqlnd_create_read_buffer(net_payload_size); in MYSQLND_METHOD()
583 …if (FAIL == net->data->m.network_read_ex(net, net->uncompressed_data->data, net_payload_size, conn… in MYSQLND_METHOD()
651 MYSQLND_METHOD(mysqlnd_net, receive_ex)(MYSQLND_NET * const net, zend_uchar * const buffer, const s… in MYSQLND_METHOD()
659 if (net->data->compressed) { in MYSQLND_METHOD()
660 if (net->uncompressed_data) { in MYSQLND_METHOD()
661 …size_t to_read_from_buffer = MIN(net->uncompressed_data->bytes_left(net->uncompressed_data), to_re… in MYSQLND_METHOD()
664 net->uncompressed_data->read(net->uncompressed_data, to_read_from_buffer, (zend_uchar *) p); in MYSQLND_METHOD()
669 if (TRUE == net->uncompressed_data->is_empty(net->uncompressed_data)) { in MYSQLND_METHOD()
671 net->uncompressed_data->free_buffer(&net->uncompressed_data); in MYSQLND_METHOD()
679 …if (FAIL == net->data->m.network_read_ex(net, net_header, MYSQLND_HEADER_SIZE, conn_stats, error_i… in MYSQLND_METHOD()
684 if (net->compressed_envelope_packet_no != packet_no) { in MYSQLND_METHOD()
686 net->compressed_envelope_packet_no, packet_no, net_payload_size); in MYSQLND_METHOD()
689 net->compressed_envelope_packet_no, packet_no, net_payload_size); in MYSQLND_METHOD()
692 net->compressed_envelope_packet_no++; in MYSQLND_METHOD()
697 …net->data->m.read_compressed_packet_from_stream_and_fill_read_buffer(net, net_payload_size, conn_s… in MYSQLND_METHOD()
705 DBG_RETURN(net->data->m.receive_ex(net, p, to_read, conn_stats, error_info)); in MYSQLND_METHOD()
710 DBG_RETURN(net->data->m.network_read_ex(net, p, to_read, conn_stats, error_info)); in MYSQLND_METHOD()
717 MYSQLND_METHOD(mysqlnd_net, set_client_option)(MYSQLND_NET * const net, enum mysqlnd_option option,… in MYSQLND_METHOD()
727 net->cmd_buffer.length = *(unsigned int*) value; in MYSQLND_METHOD()
728 DBG_INF_FMT("new_length="MYSQLND_SZ_T_SPEC, net->cmd_buffer.length); in MYSQLND_METHOD()
729 if (!net->cmd_buffer.buffer) { in MYSQLND_METHOD()
730 net->cmd_buffer.buffer = mnd_pemalloc(net->cmd_buffer.length, net->persistent); in MYSQLND_METHOD()
732 …net->cmd_buffer.buffer = mnd_perealloc(net->cmd_buffer.buffer, net->cmd_buffer.length, net->persis… in MYSQLND_METHOD()
737 net->data->options.net_read_buffer_size = *(unsigned int*) value; in MYSQLND_METHOD()
738 DBG_INF_FMT("new_length="MYSQLND_SZ_T_SPEC, net->data->options.net_read_buffer_size); in MYSQLND_METHOD()
742 net->data->options.timeout_connect = *(unsigned int*) value; in MYSQLND_METHOD()
746 zend_bool pers = net->persistent; in MYSQLND_METHOD()
747 if (net->data->options.ssl_key) { in MYSQLND_METHOD()
748 mnd_pefree(net->data->options.ssl_key, pers); in MYSQLND_METHOD()
750 net->data->options.ssl_key = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
755 zend_bool pers = net->persistent; in MYSQLND_METHOD()
756 if (net->data->options.ssl_cert) { in MYSQLND_METHOD()
757 mnd_pefree(net->data->options.ssl_cert, pers); in MYSQLND_METHOD()
759 net->data->options.ssl_cert = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
764 zend_bool pers = net->persistent; in MYSQLND_METHOD()
765 if (net->data->options.ssl_ca) { in MYSQLND_METHOD()
766 mnd_pefree(net->data->options.ssl_ca, pers); in MYSQLND_METHOD()
768 net->data->options.ssl_ca = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
773 zend_bool pers = net->persistent; in MYSQLND_METHOD()
774 if (net->data->options.ssl_capath) { in MYSQLND_METHOD()
775 mnd_pefree(net->data->options.ssl_capath, pers); in MYSQLND_METHOD()
777 net->data->options.ssl_capath = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
782 zend_bool pers = net->persistent; in MYSQLND_METHOD()
783 if (net->data->options.ssl_cipher) { in MYSQLND_METHOD()
784 mnd_pefree(net->data->options.ssl_cipher, pers); in MYSQLND_METHOD()
786 net->data->options.ssl_cipher = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
791 zend_bool pers = net->persistent; in MYSQLND_METHOD()
792 if (net->data->options.ssl_passphrase) { in MYSQLND_METHOD()
793 mnd_pefree(net->data->options.ssl_passphrase, pers); in MYSQLND_METHOD()
795 net->data->options.ssl_passphrase = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
817 net->data->options.ssl_verify_peer = val; in MYSQLND_METHOD()
821 net->data->options.timeout_read = *(unsigned int*) value; in MYSQLND_METHOD()
825 net->data->options.timeout_write = *(unsigned int*) value; in MYSQLND_METHOD()
829 net->data->options.flags |= MYSQLND_NET_FLAG_USE_COMPRESSION; in MYSQLND_METHOD()
833 zend_bool pers = net->persistent; in MYSQLND_METHOD()
834 if (net->data->options.sha256_server_public_key) { in MYSQLND_METHOD()
835 mnd_pefree(net->data->options.sha256_server_public_key, pers); in MYSQLND_METHOD()
837 net->data->options.sha256_server_public_key = value? mnd_pestrdup(value, pers) : NULL; in MYSQLND_METHOD()
849 MYSQLND_METHOD(mysqlnd_net, consume_uneaten_data)(MYSQLND_NET * const net, enum php_mysqlnd_server_… in MYSQLND_METHOD()
862 php_stream * net_stream = net->data->get_stream(net); in MYSQLND_METHOD()
881 bytes_consumed, mysqlnd_command_to_text[net->last_command]); in MYSQLND_METHOD()
884 bytes_consumed, mysqlnd_command_to_text[net->last_command]); in MYSQLND_METHOD()
887 net->last_command = cmd; in MYSQLND_METHOD()
901 MYSQLND_METHOD(mysqlnd_net, enable_ssl)(MYSQLND_NET * const net) in MYSQLND_METHOD()
905 php_stream * net_stream = net->data->m.get_stream(net); in MYSQLND_METHOD()
913 if (net->data->options.ssl_key) { in MYSQLND_METHOD()
915 ZVAL_STRING(&key_zval, net->data->options.ssl_key); in MYSQLND_METHOD()
920 if (net->data->options.ssl_cert) { in MYSQLND_METHOD()
922 ZVAL_STRING(&cert_zval, net->data->options.ssl_cert); in MYSQLND_METHOD()
924 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); in MYSQLND_METHOD()
936 if (net->data->options.ssl_capath) { in MYSQLND_METHOD()
938 ZVAL_STRING(&capath_zval, net->data->options.ssl_capath); in MYSQLND_METHOD()
943 if (net->data->options.ssl_passphrase) { in MYSQLND_METHOD()
945 ZVAL_STRING(&passphrase_zval, net->data->options.ssl_passphrase); in MYSQLND_METHOD()
950 if (net->data->options.ssl_cipher) { in MYSQLND_METHOD()
952 ZVAL_STRING(&cipher_zval, net->data->options.ssl_cipher); in MYSQLND_METHOD()
961 if (net->data->options.ssl_verify_peer == MYSQLND_SSL_PEER_DEFAULT) { in MYSQLND_METHOD()
962 …net->data->options.ssl_verify_peer = any_flag? MYSQLND_SSL_PEER_DEFAULT_ACTION:MYSQLND_SSL_PEER_DO… in MYSQLND_METHOD()
965 verify = net->data->options.ssl_verify_peer == MYSQLND_SSL_PEER_VERIFY? TRUE:FALSE; in MYSQLND_METHOD()
971 if (net->data->options.ssl_verify_peer == MYSQLND_SSL_PEER_DONT_VERIFY) { in MYSQLND_METHOD()
984 net->data->ssl = TRUE; in MYSQLND_METHOD()
994 if (net->data->options.timeout_read) { in MYSQLND_METHOD()
996 DBG_INF_FMT("setting %u as PHP_STREAM_OPTION_READ_TIMEOUT", net->data->options.timeout_read); in MYSQLND_METHOD()
997 tv.tv_sec = net->data->options.timeout_read; in MYSQLND_METHOD()
1014 MYSQLND_METHOD(mysqlnd_net, disable_ssl)(MYSQLND_NET * const net) in MYSQLND_METHOD()
1024 MYSQLND_METHOD(mysqlnd_net, free_contents)(MYSQLND_NET * net) in MYSQLND_METHOD()
1026 zend_bool pers = net->persistent; in MYSQLND_METHOD()
1030 if (net->uncompressed_data) { in MYSQLND_METHOD()
1031 net->uncompressed_data->free_buffer(&net->uncompressed_data); in MYSQLND_METHOD()
1034 if (net->data->options.ssl_key) { in MYSQLND_METHOD()
1035 mnd_pefree(net->data->options.ssl_key, pers); in MYSQLND_METHOD()
1036 net->data->options.ssl_key = NULL; in MYSQLND_METHOD()
1038 if (net->data->options.ssl_cert) { in MYSQLND_METHOD()
1039 mnd_pefree(net->data->options.ssl_cert, pers); in MYSQLND_METHOD()
1040 net->data->options.ssl_cert = NULL; in MYSQLND_METHOD()
1042 if (net->data->options.ssl_ca) { in MYSQLND_METHOD()
1043 mnd_pefree(net->data->options.ssl_ca, pers); in MYSQLND_METHOD()
1044 net->data->options.ssl_ca = NULL; in MYSQLND_METHOD()
1046 if (net->data->options.ssl_capath) { in MYSQLND_METHOD()
1047 mnd_pefree(net->data->options.ssl_capath, pers); in MYSQLND_METHOD()
1048 net->data->options.ssl_capath = NULL; in MYSQLND_METHOD()
1050 if (net->data->options.ssl_cipher) { in MYSQLND_METHOD()
1051 mnd_pefree(net->data->options.ssl_cipher, pers); in MYSQLND_METHOD()
1052 net->data->options.ssl_cipher = NULL; in MYSQLND_METHOD()
1054 if (net->data->options.sha256_server_public_key) { in MYSQLND_METHOD()
1055 mnd_pefree(net->data->options.sha256_server_public_key, pers); in MYSQLND_METHOD()
1056 net->data->options.sha256_server_public_key = NULL; in MYSQLND_METHOD()
1066 MYSQLND_METHOD(mysqlnd_net, close_stream)(MYSQLND_NET * const net, MYSQLND_STATS * const stats, MYS… in MYSQLND_METHOD()
1070 if (net && (net_stream = net->data->m.get_stream(net))) { in MYSQLND_METHOD()
1071 zend_bool pers = net->persistent; in MYSQLND_METHOD()
1086 (void) net->data->m.set_stream(net, NULL); in MYSQLND_METHOD()
1096 MYSQLND_METHOD(mysqlnd_net, init)(MYSQLND_NET * const net, MYSQLND_STATS * const stats, MYSQLND_ERR… in MYSQLND_METHOD()
1102 net->data->m.set_client_option(net, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, (char *) &buf_size); in MYSQLND_METHOD()
1105 net->data->m.set_client_option(net, MYSQLND_OPT_NET_READ_BUFFER_SIZE, (char *)&buf_size); in MYSQLND_METHOD()
1108 net->data->m.set_client_option(net, MYSQL_OPT_READ_TIMEOUT, (char *)&buf_size); in MYSQLND_METHOD()
1117 MYSQLND_METHOD(mysqlnd_net, dtor)(MYSQLND_NET * const net, MYSQLND_STATS * const stats, MYSQLND_ERR… in MYSQLND_METHOD()
1120 if (net) { in MYSQLND_METHOD()
1121 net->data->m.free_contents(net); in MYSQLND_METHOD()
1122 net->data->m.close_stream(net, stats, error_info); in MYSQLND_METHOD()
1124 if (net->cmd_buffer.buffer) { in MYSQLND_METHOD()
1126 mnd_pefree(net->cmd_buffer.buffer, net->persistent); in MYSQLND_METHOD()
1127 net->cmd_buffer.buffer = NULL; in MYSQLND_METHOD()
1130 mnd_pefree(net->data, net->data->persistent); in MYSQLND_METHOD()
1131 mnd_pefree(net, net->persistent); in MYSQLND_METHOD()
1140 MYSQLND_METHOD(mysqlnd_net, get_stream)(const MYSQLND_NET * const net) in MYSQLND_METHOD()
1143 DBG_INF_FMT("%p", net? net->data->stream:NULL); in MYSQLND_METHOD()
1144 DBG_RETURN(net? net->data->stream:NULL); in MYSQLND_METHOD()
1151 MYSQLND_METHOD(mysqlnd_net, set_stream)(MYSQLND_NET * const net, php_stream * net_stream) in MYSQLND_METHOD()
1155 if (net) { in MYSQLND_METHOD()
1156 net->data->stream = net_stream; in MYSQLND_METHOD()
1157 ret = net->data->stream; in MYSQLND_METHOD()
1203 MYSQLND_NET * net; in mysqlnd_net_init() local
1205 …net = MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_object_factory).get_io_channel(persistent, stats, er… in mysqlnd_net_init()
1206 DBG_RETURN(net); in mysqlnd_net_init()
1213 mysqlnd_net_free(MYSQLND_NET * const net, MYSQLND_STATS * stats, MYSQLND_ERROR_INFO * error_info) in mysqlnd_net_free() argument
1216 if (net) { in mysqlnd_net_free()
1217 net->data->m.dtor(net, stats, error_info); in mysqlnd_net_free()