Tizen Native API
5.0
|
The HTTP Transaction API provides functions for managing HTTP transactions.
#include <http.h>
It allows managing HTTP transactions. Using the HTTP transaction, you can implement features that allow the users of your application to:
Functions | |
int | http_transaction_submit (http_transaction_h http_transaction) |
Submits the HTTP request. | |
int | http_transaction_destroy (http_transaction_h http_transaction) |
Closes the HTTP transaction handle. | |
int | http_transaction_set_received_header_cb (http_transaction_h http_transaction, http_transaction_header_cb header_cb, void *user_data) |
Registers callback called when receives header. | |
int | http_transaction_set_received_body_cb (http_transaction_h http_transaction, http_transaction_body_cb body_cb, void *user_data) |
Registers callback called when receives body. | |
int | http_transaction_set_uploaded_cb (http_transaction_h http_transaction, http_transaction_write_cb write_cb, void *user_data) |
Registers callback called when writes data. | |
int | http_transaction_set_completed_cb (http_transaction_h http_transaction, http_transaction_completed_cb completed_cb, void *user_data) |
Registers callback called when transaction is completed. | |
int | http_transaction_set_aborted_cb (http_transaction_h http_transaction, http_transaction_aborted_cb aborted_cb, void *user_data) |
Registers callback called when transaction is aborted. | |
int | http_transaction_set_progress_cb (http_transaction_h http_transaction, http_transaction_progress_cb progress_cb, void *user_data) |
Registers the progress callbacks. | |
int | http_transaction_set_timeout (http_transaction_h http_transaction, int timeout) |
Sets the timeout in seconds that is the timeout for waiting the transaction. | |
int | http_transaction_get_timeout (http_transaction_h http_transaction, int *timeout) |
Gets the timeout in seconds for the transaction. | |
int | http_transaction_resume (http_transaction_h http_transaction) |
Resumes the transaction. | |
int | http_transaction_pause (http_transaction_h http_transaction, http_pause_type_e pause_type) |
Pauses the transaction. | |
int | http_transaction_cancel (http_transaction_h http_transaction) |
Cancels the transaction. | |
int | http_transaction_set_ready_to_write (http_transaction_h http_transaction, bool read_to_write) |
Sets ready to write event for a transaction. | |
int | http_transaction_set_interface_name (http_transaction_h http_transaction, const char *interface_name) |
Sets the interface name. | |
int | http_transaction_get_interface_name (http_transaction_h http_transaction, char **interface_name) |
Gets the interface name. | |
int | http_transaction_set_server_certificate_verification (http_transaction_h http_transaction, bool verify) |
Sets the flag to verify a server certificate. | |
int | http_transaction_get_server_certificate_verification (http_transaction_h http_transaction, bool *verify) |
Gets the flag to verify a server certificate. | |
int | http_transaction_set_tcp_fastopen (http_transaction_h http_transaction, bool enable) |
Sets the flag to allow TCP Fast Open. | |
int | http_transaction_get_tcp_fastopen (http_transaction_h http_transaction, bool *enable) |
Gets the flag to allow TCP Fast Open. |
int http_transaction_cancel | ( | http_transaction_h | http_transaction | ) |
Cancels the transaction.
This function cancels the transaction.
The aborted callback is invoked after using it.
[in] | http_transaction | The HTTP transaction handle |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_OPERATION_FAILED | Operation failed |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_destroy | ( | http_transaction_h | http_transaction | ) |
Closes the HTTP transaction handle.
[in] | http_transaction | The HTTP transaction handle |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_get_interface_name | ( | http_transaction_h | http_transaction, |
char ** | interface_name | ||
) |
Gets the interface name.
[in] | http_transaction | The HTTP transaction handle |
[out] | interface_name | The interface name |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_get_server_certificate_verification | ( | http_transaction_h | http_transaction, |
bool * | verify | ||
) |
Gets the flag to verify a server certificate.
[in] | http_transaction | The HTTP transaction handle |
[out] | verify | The flag to verify a server certificate; true means verifies; false means it doesn't. |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_get_tcp_fastopen | ( | http_transaction_h | http_transaction, |
bool * | enable | ||
) |
Gets the flag to allow TCP Fast Open.
[in] | http_transaction | The HTTP transaction handle |
[out] | enable | The flag to enable TCP Fast Open |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_get_timeout | ( | http_transaction_h | http_transaction, |
int * | timeout | ||
) |
Gets the timeout in seconds for the transaction.
[in] | http_transaction | The HTTP transaction handle |
[out] | timeout | The timeout in seconds |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_pause | ( | http_transaction_h | http_transaction, |
http_pause_type_e | pause_type | ||
) |
Pauses the transaction.
[in] | http_transaction | The HTTP transaction handle |
[in] | pause_type | The pause type of the connection |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_OPERATION_FAILED | Operation failed |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_resume | ( | http_transaction_h | http_transaction | ) |
Resumes the transaction.
[in] | http_transaction | The HTTP transaction handle |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_OPERATION_FAILED | Operation failed |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_aborted_cb | ( | http_transaction_h | http_transaction, |
http_transaction_aborted_cb | aborted_cb, | ||
void * | user_data | ||
) |
Registers callback called when transaction is aborted.
[in] | http_transaction | The HTTP transaction handle |
[in] | aborted_cb | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_completed_cb | ( | http_transaction_h | http_transaction, |
http_transaction_completed_cb | completed_cb, | ||
void * | user_data | ||
) |
Registers callback called when transaction is completed.
[in] | http_transaction | The HTTP transaction handle |
[in] | completed_cb | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_interface_name | ( | http_transaction_h | http_transaction, |
const char * | interface_name | ||
) |
Sets the interface name.
[in] | http_transaction | The HTTP transaction handle |
[in] | interface_name | The interface name to use as outgoing network interface |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_progress_cb | ( | http_transaction_h | http_transaction, |
http_transaction_progress_cb | progress_cb, | ||
void * | user_data | ||
) |
Registers the progress callbacks.
Registers callback that is called when data is uploaded/downloaded.
[in] | http_transaction | The HTTP transaction handle |
[in] | progress_cb | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_ready_to_write | ( | http_transaction_h | http_transaction, |
bool | read_to_write | ||
) |
Sets ready to write event for a transaction.
[in] | http_transaction | The HTTP transaction handle |
[out] | read_to_write | Enable/disable ready to write |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_received_body_cb | ( | http_transaction_h | http_transaction, |
http_transaction_body_cb | body_cb, | ||
void * | user_data | ||
) |
Registers callback called when receives body.
[in] | http_transaction | The HTTP transaction handle |
[in] | body_cb | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_received_header_cb | ( | http_transaction_h | http_transaction, |
http_transaction_header_cb | header_cb, | ||
void * | user_data | ||
) |
Registers callback called when receives header.
[in] | http_transaction | The HTTP transaction handle |
[in] | header_cb | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_server_certificate_verification | ( | http_transaction_h | http_transaction, |
bool | verify | ||
) |
Sets the flag to verify a server certificate.
The verify determines whether verifies the peer's certificate.
[in] | http_transaction | The HTTP transaction handle |
[in] | verify | The flag to verify a server certificate; true means verifies; false means it doesn't. |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_tcp_fastopen | ( | http_transaction_h | http_transaction, |
bool | enable | ||
) |
Sets the flag to allow TCP Fast Open.
[in] | http_transaction | The HTTP transaction handle |
[in] | enable | The flag to enable TCP Fast Open |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_timeout | ( | http_transaction_h | http_transaction, |
int | timeout | ||
) |
Sets the timeout in seconds that is the timeout for waiting the transaction.
Sets the timeout in seconds that is the timeout for waiting the transaction.
A timeout value of zero means an infinite timeout.
[in] | http_transaction | The HTTP transaction handle |
[in] | timeout | The timeout in seconds |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_set_uploaded_cb | ( | http_transaction_h | http_transaction, |
http_transaction_write_cb | write_cb, | ||
void * | user_data | ||
) |
Registers callback called when writes data.
[in] | http_transaction | The HTTP transaction handle |
[in] | write_cb | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
int http_transaction_submit | ( | http_transaction_h | http_transaction | ) |
Submits the HTTP request.
[in] | http_transaction | The HTTP transaction handle |
0
on success, otherwise negative error value HTTP_ERROR_NONE | Successful |
HTTP_ERROR_INVALID_PARAMETER | Invalid parameter |
HTTP_ERROR_INVALID_OPERATION | Invalid operation |
HTTP_ERROR_NOT_SUPPORTED | Not Supported |
HTTP_ERROR_PERMISSION_DENIED | Permission denied |