axutil_stream_t *AXIS2_CALL
axutil_stream_create_cgi(
    const axutil_env_t * env,
	unsigned int content_length)
{
    cgi_stream_impl_t *stream_impl = NULL;
    AXIS2_ENV_CHECK(env, NULL);
	AXIS2_PARAM_CHECK(env->error, content_length, NULL);

    stream_impl =
        (cgi_stream_impl_t *) AXIS2_MALLOC(env->allocator,
                                           sizeof(cgi_stream_impl_t));

    if (!stream_impl)
    {
        return NULL;
    }
    stream_impl->cur_pos = 0;
	stream_impl->content_length = content_length;
    stream_impl->stream_type = AXIS2_STREAM_MANAGED;

    axutil_stream_set_read(&(stream_impl->stream), env, cgi_stream_read);
    axutil_stream_set_write(&(stream_impl->stream), env, cgi_stream_write);
    axutil_stream_set_skip(&(stream_impl->stream), env, cgi_stream_skip);

    return &(stream_impl->stream);
}
Beispiel #2
0
/*
 * Internal function. Not exposed to outside
 */
AXIS2_EXTERN axutil_stream_t *AXIS2_CALL
axutil_stream_create_libcurl(
    const axutil_env_t * env,
    axis2_char_t * buffer,
    unsigned int size)
{
    libcurl_stream_impl_t *stream_impl = NULL;

    AXIS2_PARAM_CHECK(env->error, buffer, NULL);

    stream_impl =
    (libcurl_stream_impl_t *) AXIS2_MALLOC(env->allocator,
        sizeof(libcurl_stream_impl_t));

    if (!stream_impl)
    {
        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        return NULL;
    }

    stream_impl->buffer = buffer;
    stream_impl->size = size;
    stream_impl->read_len = 0;
    stream_impl->stream_type = AXIS2_STREAM_MANAGED;

    axutil_stream_set_read(&(stream_impl->stream), env, libcurl_stream_read);
    axutil_stream_set_write(&(stream_impl->stream), env, libcurl_stream_write);
    axutil_stream_set_skip(&(stream_impl->stream), env, libcurl_stream_skip);

    return &(stream_impl->stream);
}
Beispiel #3
0
AXIS2_EXTERN axutil_stream_t *AXIS2_CALL
axutil_stream_create_ssl(
    const axutil_env_t * env,
    axis2_socket_t sockt,
    axis2_char_t * server_cert,
    axis2_char_t * key_file,
    axis2_char_t * ssl_pp)
{
    ssl_stream_impl_t *stream_impl = NULL;

    stream_impl =
    (ssl_stream_impl_t *) AXIS2_MALLOC(env->allocator,
        sizeof(ssl_stream_impl_t));

    if (!stream_impl)
    {
        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        return NULL;
    }
    memset ((void *)stream_impl, 0, sizeof (ssl_stream_impl_t));
    stream_impl->socket = sockt;
    stream_impl->ctx = NULL;
    stream_impl->ssl = NULL;

    stream_impl->ctx = axis2_ssl_utils_initialize_ctx(env, server_cert,
        key_file, ssl_pp);
    if (!stream_impl->ctx)
    {
        axis2_ssl_stream_free((axutil_stream_t *) stream_impl, env);
        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_SSL_ENGINE, AXIS2_FAILURE);
        return NULL;
    }
    stream_impl->ssl = axis2_ssl_utils_initialize_ssl(env, stream_impl->ctx,
        stream_impl->socket);
    if (!stream_impl->ssl)
    {
        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_SSL_ENGINE, AXIS2_FAILURE);
        return NULL;
    }
    stream_impl->stream_type = AXIS2_STREAM_MANAGED;

    axutil_stream_set_read(&(stream_impl->stream), env, axis2_ssl_stream_read);
    axutil_stream_set_write(&(stream_impl->stream), env,
        axis2_ssl_stream_write);
    axutil_stream_set_skip(&(stream_impl->stream), env, axis2_ssl_stream_skip);

    return &(stream_impl->stream);
}