cp_httpclient_result(3)

cp_socket(3) cp_httpclient cp_socket(3)

NAME

cp_httpclient_result, cp_httpclient_result_destroy, cp_httpclient_result_get_client, cp_httpclient_result_id, cp_httpclient_result_status, cp_httpclient_result_get_response - http call result wrapper

SYNOPSIS

#include <cprops/httpclient.h>

void cp_httpclient_result_destroy(cp_httpclient_result *res);
cp_httpclient * cp_httpclient_result_get_client(cp_httpclient_result *res);
void *cp_httpclient_result_id(cp_httpclient_result *res);
cp_http_result_status cp_httpclient_result_status(cp_httpclient_result *res);
cp_http_response * cp_httpclient_result_get_response(cp_httpclient_result *res);

DESCRIPTION

The cp_httpclient api represents HTTP request results as cp_httpclient_result objects. cp_httpclient_fetch(3) returns a cp_httpclient_result object directly, and the asynchronous fetch functions return results to user defined callback functions which accept a cp_httpresult object as their parameter.

cp_httpclient_result_destroy deallocates a cp_httpclient_result object. It should only be called on results returned by cp_httpclient_fetch - the asynchronous interfaces deallocate result objects automatically.

cp_httpclient_result_get_client returns the cp_httpclient object the request was performed on.

cp_httpclient_result_id returns the user assigned id object given as a parameter to an asynchronous fetch function. For cp_httpclient_fetch this is always NULL.

cp_httpclient_result_status returns a cp_http_result_status code describing the response status. cp_http_result_status is an enumerated type defined as


typedef enum
{
CP_HTTP_RESULT_SUCCESS,
CP_HTTP_RESULT_CONNECTION_FAILED,
CP_HTTP_RESULT_CONNECTION_RESET,
CP_HTTP_RESULT_TIMED_OUT,
CP_HTTP_RESULT_WRITE_ERROR,
CP_HTTP_RESULT_READ_ERROR
} cp_http_result_status;

cp_httpclient_result_get_response returns a cp_http_response(3) object representing the server response. This may be NULL on communication failures.

RETURN VALUE

cp_httpclient_result_get_client returns the cp_httpclient object the request was performed on.
cp_httpclient_result_id returns the user assigned id for this request if any.
cp_httpclient_result_status returns a cp_http_result_status code describing the response status.
cp_httpclient_result_get_response returns a cp_http_response object representing the server response on success or NULL on communication errors or memory allocation failure.

SEE ALSO

cp_http_response(3)

MAY 2006 libcprops