void tlsio_schannel_dowork(CONCRETE_IO_HANDLE tls_io) { if (tls_io != NULL) { TLS_IO_INSTANCE* tls_io_instance = (TLS_IO_INSTANCE*)tls_io; xio_dowork(tls_io_instance->socket_io); } }
static int on_io_recv(WOLFSSL *ssl, char *buf, int sz, void *context) { int result; TLS_IO_INSTANCE* tls_io_instance = (TLS_IO_INSTANCE*)context; unsigned char* new_socket_io_read_bytes; while (tls_io_instance->socket_io_read_byte_count == 0) { xio_dowork(tls_io_instance->socket_io); if (tls_io_instance->tlsio_state != TLSIO_STATE_IN_HANDSHAKE) { break; } } result = tls_io_instance->socket_io_read_byte_count; if (result > sz) { result = sz; } if (result > 0) { (void)memcpy(buf, tls_io_instance->socket_io_read_bytes, result); (void)memmove(tls_io_instance->socket_io_read_bytes, tls_io_instance->socket_io_read_bytes + result, tls_io_instance->socket_io_read_byte_count - result); tls_io_instance->socket_io_read_byte_count -= result; if (tls_io_instance->socket_io_read_byte_count > 0) { new_socket_io_read_bytes = (unsigned char*)realloc(tls_io_instance->socket_io_read_bytes, tls_io_instance->socket_io_read_byte_count); if (new_socket_io_read_bytes != NULL) { tls_io_instance->socket_io_read_bytes = new_socket_io_read_bytes; } } else { free(tls_io_instance->socket_io_read_bytes); tls_io_instance->socket_io_read_bytes = NULL; } } if ((result == 0) && (tls_io_instance->tlsio_state == TLSIO_STATE_OPEN)) { result = WOLFSSL_CBIO_ERR_WANT_READ; } else if ((result == 0) && tls_io_instance->tlsio_state == TLSIO_STATE_CLOSING) { result = WOLFSSL_CBIO_ERR_CONN_CLOSE; } return result; }
void headerdetectio_dowork(CONCRETE_IO_HANDLE header_detect_io) { if (header_detect_io != NULL) { HEADER_DETECT_IO_INSTANCE* header_detect_io_instance = (HEADER_DETECT_IO_INSTANCE*)header_detect_io; if ((header_detect_io_instance->io_state != IO_STATE_NOT_OPEN) && (header_detect_io_instance->io_state != IO_STATE_ERROR)) { xio_dowork(header_detect_io_instance->underlying_io); } } }
void tlsio_wolfssl_dowork(CONCRETE_IO_HANDLE tls_io) { if (tls_io != NULL) { TLS_IO_INSTANCE* tls_io_instance = (TLS_IO_INSTANCE*)tls_io; if ((tls_io_instance->tlsio_state != TLSIO_STATE_NOT_OPEN) && (tls_io_instance->tlsio_state != TLSIO_STATE_ERROR)) { decode_ssl_received_bytes(tls_io_instance); xio_dowork(tls_io_instance->socket_io); } } }
void saslclientio_dowork(CONCRETE_IO_HANDLE sasl_client_io) { /* Codes_SRS_SASLCLIENTIO_01_026: [If the sasl_client_io argument is NULL, saslclientio_dowork shall do nothing.] */ if (sasl_client_io != NULL) { SASL_CLIENT_IO_INSTANCE* sasl_client_io_instance = (SASL_CLIENT_IO_INSTANCE*)sasl_client_io; /* Codes_SRS_SASLCLIENTIO_01_025: [saslclientio_dowork shall call the xio_dowork on the underlying_io passed in saslclientio_create.] */ if (sasl_client_io_instance->io_state != IO_STATE_NOT_OPEN) { /* Codes_SRS_SASLCLIENTIO_01_025: [saslclientio_dowork shall call the xio_dowork on the underlying_io passed in saslclientio_create.] */ xio_dowork(sasl_client_io_instance->underlying_io); } } }