Tizen Native API
3.0
|
The HTTP API provides functions for communication with server according to the HTTP protocol.
Required Header
#include <http.h>
Overview
The HTTP API provides functions for communication with server according to the HTTP protocol. Using the HTTP APIs, you can implement features that allow the users of your application to:
- Manage HTTP session
- Manage HTTP transaction
- Send/Receive HTTP request/response
Related Features
This API is related with the following features:
- http://tizen.org/feature/network.internet
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature List.
Functions | |
int | http_init (void) |
Initializes the HTTP module. | |
int | http_deinit (void) |
Deinitializes the HTTP module. | |
Typedefs | |
typedef void * | http_session_h |
The HTTP Session handle. | |
typedef void * | http_transaction_h |
The HTTP Transaction handle. | |
typedef void(* | http_transaction_header_cb )(http_transaction_h http_transaction, char *header, size_t header_len, void *user_data) |
Called when the HTTP header is received. | |
typedef void(* | http_transaction_body_cb )(http_transaction_h http_transaction, char *body, size_t size, size_t count, void *user_data) |
Called when the HTTP response is received. | |
typedef void(* | http_transaction_write_cb )(http_transaction_h http_transaction, int recommended_chunk_size, void *user_data) |
Called when the HTTP ready to write event is received. | |
typedef void(* | http_transaction_completed_cb )(http_transaction_h http_transaction, void *user_data) |
Called when the HTTP transaction is completed. | |
typedef void(* | http_transaction_aborted_cb )(http_transaction_h http_transaction, http_error_code_e error, void *user_data) |
Called when the HTTP transaction is aborted. | |
typedef void(* | http_transaction_progress_cb )(http_transaction_h http_transaction, double download_total, double download_now, double upload_total, double upload_now, void *user_data) |
Called to notify when the content body of the response message is being downloaded or uploaded. |
Typedef Documentation
typedef void* http_session_h |
The HTTP Session handle.
- Since :
- 3.0
typedef void(* http_transaction_aborted_cb)(http_transaction_h http_transaction, http_error_code_e error, void *user_data) |
Called when the HTTP transaction is aborted.
Following error codes can be delivered.
HTTP_ERROR_OPERATION_FAILED,
HTTP_ERROR_COULDNT_RESOLVE_HOST,
HTTP_ERROR_COULDNT_CONNECT,
HTTP_ERROR_OPERATION_TIMEDOUT,
HTTP_ERROR_SSL_CONNECT_ERROR.
- Since :
- 3.0
- Parameters:
-
[in] http_transaction The HTTP transaction handle [in] error The error code about aborted reason [in] user_data The user data
- See also:
- http_transaction_set_aborted_cb()
typedef void(* http_transaction_body_cb)(http_transaction_h http_transaction, char *body, size_t size, size_t count, void *user_data) |
Called when the HTTP response is received.
- Since :
- 3.0
- Parameters:
-
[in] http_transaction The HTTP transaction handle [in] body Response information of HTTP Transaction [in] size Size in bytes of each element to be written [in] count Number of elements, each one with a size of size bytes [in] user_data The user data
typedef void(* http_transaction_completed_cb)(http_transaction_h http_transaction, void *user_data) |
Called when the HTTP transaction is completed.
- Since :
- 3.0
- Parameters:
-
[in] http_transaction The HTTP transaction handle [in] user_data The user data
- See also:
- http_transaction_set_completed_cb()
typedef void* http_transaction_h |
The HTTP Transaction handle.
- Since :
- 3.0
typedef void(* http_transaction_header_cb)(http_transaction_h http_transaction, char *header, size_t header_len, void *user_data) |
Called when the HTTP header is received.
- Since :
- 3.0
- Parameters:
-
[in] http_transaction The HTTP transaction handle [in] header The header information of HTTP Transaction [in] header_len The length of the HTTP Transaction header [in] user_data The user data
typedef void(* http_transaction_progress_cb)(http_transaction_h http_transaction, double download_total, double download_now, double upload_total, double upload_now, void *user_data) |
Called to notify when the content body of the response message is being downloaded or uploaded.
- Since :
- 3.0
- Parameters:
-
[in] http_transaction The HTTP transaction handle [in] download_total The total length of the data (in bytes) to download [in] download_now The current length of the downloaded data (in bytes) [in] upload_total The total length of the data (in bytes) to upload [in] upload_now The current length of the uploaded data (in bytes) [in] user_data The user data
- See also:
- http_transaction_set_progress_cb()
typedef void(* http_transaction_write_cb)(http_transaction_h http_transaction, int recommended_chunk_size, void *user_data) |
Called when the HTTP ready to write event is received.
- Since :
- 3.0
- Parameters:
-
[in] http_transaction The HTTP transaction handle [in] recommended_chunk_size Recommended chunk length(bytes) of the HTTP transaction [in] user_data The user data
- See also:
- http_transaction_set_uploaded_cb()
Enumeration Type Documentation
enum http_auth_scheme_e |
Enumeration for the HTTP authentication schemes.
- Since :
- 3.0
- Enumerator:
enum http_error_code_e |
Enumeration for the HTTP error code.
- Since :
- 3.0
- Enumerator:
enum http_method_e |
Enumeration for the HTTP method.
- Since :
- 3.0
- Enumerator:
enum http_pause_type_e |
enum http_status_code_e |
Enumeration for the HTTP status code.
- Since :
- 3.0
- Enumerator:
enum http_version_e |
Function Documentation
int http_deinit | ( | void | ) |
Deinitializes the HTTP module.
- Since :
- 3.0
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_OPERATION_FAILED Operation failed HTTP_ERROR_NOT_SUPPORTED Not Supported
- See also:
- http_init()
int http_init | ( | void | ) |
Initializes the HTTP module.
- Since :
- 3.0
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_OPERATION_FAILED Operation failed HTTP_ERROR_NOT_SUPPORTED Not Supported
- See also:
- http_deinit()