Fixed doxygen comments
[platform/core/api/http.git] / include / http.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __TIZEN_NETWORK_HTTP_H__
18 #define __TIZEN_NETWORK_HTTP_H__
19
20 #include <tizen.h>
21 #include <stdlib.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #ifndef TIZEN_ERROR_HTTP
28 #define TIZEN_ERROR_HTTP -0x03000000
29 #endif
30
31 /**
32  * @file http.h
33  */
34
35 /**
36  * @addtogroup CAPI_NETWORK_HTTP_MODULE
37  * @{
38  */
39
40 /**
41  * @brief The HTTP Session handle.
42  * @since_tizen 3.0
43  */
44 typedef void * http_session_h;
45
46 /**
47   * @brief The HTTP Transaction handle.
48   * @since_tizen 3.0
49   */
50 typedef void * http_transaction_h;
51
52 /**
53  * @}
54  */
55
56 /**
57   * @addtogroup CAPI_NETWORK_HTTP_SESSION_MODULE
58   * @{
59   */
60
61 /**
62  * @brief Enumeration for the http session.
63  * @since_tizen 3.0
64  */
65 typedef enum {
66         HTTP_SESSION_MODE_NORMAL,           /**< The Normal Mode */
67         HTTP_SESSION_MODE_PIPELINING,       /**< The Pipelining mode */
68 } http_session_mode_e;
69
70 /**
71   * @}
72   */
73
74 /**
75 * @addtogroup CAPI_NETWORK_HTTP_MODULE
76 * @{
77 */
78
79 /**
80  * @brief Enumeration for the http method.
81  * @since_tizen 3.0
82  */
83 typedef enum {
84         HTTP_METHOD_GET = 0x40,         /**< The HTTP GET Method */
85         HTTP_METHOD_OPTIONS = 0x41,     /**< The HTTP OPTIONS Method */
86         HTTP_METHOD_HEAD = 0x42,        /**< The HTTP HEAD Method */
87         HTTP_METHOD_DELETE = 0x43,      /**< The HTTP DELETE Method */
88         HTTP_METHOD_TRACE = 0x44,       /**< The HTTP TRACE Method */
89         HTTP_METHOD_POST = 0x60,        /**< The HTTP POST Method */
90         HTTP_METHOD_PUT = 0x61,         /**< The HTTP PUT Method */
91         HTTP_METHOD_CONNECT = 0x70,     /**< The HTTP CONNECT Method */
92 } http_method_e;
93
94 /**
95  * @brief Enumeration for the http version.
96  * @since_tizen 3.0
97  */
98 typedef enum {
99         HTTP_VERSION_1_0,   /**< HTTP version 1.0 */
100         HTTP_VERSION_1_1    /**< HTTP version 1.1 */
101 } http_version_e;
102
103 /**
104  * @brief Enumeration for transfer pause state
105  * @since_tizen 3.0
106  */
107 typedef enum {
108         HTTP_PAUSE_RECV = 1 << 0,   /**< Pause receiving data */
109         HTTP_PAUSE_SEND = 1 << 2,    /**< Pause sending data */
110         HTTP_PAUSE_ALL =  HTTP_PAUSE_RECV |  HTTP_PAUSE_SEND  /**< Pause both directions */
111 } http_pause_type_e;
112
113 /**
114  * @brief Enumeration for the http error code.
115  * @since_tizen 3.0
116  */
117 typedef enum {
118     HTTP_ERROR_NONE = TIZEN_ERROR_NONE,                                                         /**< Successful */
119         HTTP_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,           /**< Out of memory */
120         HTTP_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,   /**< Permission denied */
121     HTTP_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,       /**< Invalid parameter */
122     HTTP_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,       /**< Invalid operation */
123         HTTP_ERROR_OPERATION_FAILED = TIZEN_ERROR_HTTP|0x01,            /**< Operation failed */
124         HTTP_ERROR_COULDNT_RESOLVE_HOST = TIZEN_ERROR_HTTP|0x06,        /**< Couldn't resolve host */
125         HTTP_ERROR_COULDNT_CONNECT = TIZEN_ERROR_HTTP|0x07,                             /**< Couldn't Connect to host */
126         HTTP_ERROR_OPERATION_TIMEDOUT = TIZEN_ERROR_HTTP|0x28,           /**< Timeout */
127         HTTP_ERROR_SSL_CONNECT_ERROR = TIZEN_ERROR_HTTP|0x35,                   /**< SSL Error */
128         HTTP_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,           /**< API is not supported */
129 } http_error_code_e;
130
131 /**
132  * @brief Enumeration for the http status code.
133  * @since_tizen 3.0
134  */
135 typedef enum {
136         HTTP_STATUS_UNDEFINED = 0,                                          /**< The undefined status */
137         HTTP_STATUS_CONTINUE = 100,                                         /**< The status code: 100 Continue */
138         HTTP_STATUS_SWITCHING_PROTOCOLS = 101,                              /**< The status code: 101 Switching Protocols */
139         HTTP_STATUS_OK = 200,                                               /**< The status code: 200 OK */
140         HTTP_STATUS_CREATED = 201,                                          /**< The status code: 201 Created */
141         HTTP_STATUS_ACCEPTED = 202,                                         /**< The status code: 202 Accepted */
142         HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203,                    /**< The status code: 203 Non-Authoritative Information */
143         HTTP_STATUS_NO_CONTENT = 204,                                       /**< The status code: 204 No %Content */
144         HTTP_STATUS_RESET_CONTENT = 205,                                    /**< The status code: 205 Reset %Content */
145         HTTP_STATUS_PARTIAL_CONTENT = 206,                                  /**< The status code: 206 Partial %Content */
146
147         HTTP_STATUS_MULTIPLE_CHOICE = 300,                                  /**< The status code: 300 Multiple Choices */
148         HTTP_STATUS_MOVED_PERMANENTLY = 301,                                /**< The status code: 301 Moved Permanently */
149         HTTP_STATUS_MOVED_TEMPORARILY = 302,                                /**< The status code: 302 Found */
150         HTTP_STATUS_SEE_OTHER = 303,                                        /**< The status code: 303 See Other */
151         HTTP_STATUS_NOT_MODIFIED = 304,                                     /**< The status code: 304 Not Modified */
152         HTTP_STATUS_USE_PROXY = 305,                                        /**< The status code: 305 Use Proxy */
153
154         HTTP_STATUS_BAD_REQUEST = 400,                                      /**< The status code: 400 Bad Request */
155         HTTP_STATUS_UNAUTHORIZED = 401,                                     /**< The status code: 401 Unauthorized */
156         HTTP_STATUS_PAYMENT_REQUIRED = 402,                                 /**< The status code: 402 Payment Required */
157         HTTP_STATUS_FORBIDDEN = 403,                                        /**< The status code: 403 Forbidden */
158         HTTP_STATUS_NOT_FOUND = 404,                                        /**< The status code: 404 Not Found */
159         HTTP_STATUS_METHOD_NOT_ALLOWED = 405,                               /**< The status code: 405 Method Not Allowed */
160         HTTP_STATUS_NOT_ACCEPTABLE = 406,                                   /**< The status code: 406 Not Acceptable */
161         HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407,                    /**< The status code: 407 Proxy Authentication Required */
162         HTTP_STATUS_REQUEST_TIME_OUT = 408,                                 /**< The status code: 408 Request Timeout (not used) */
163         HTTP_STATUS_CONFLICT = 409,                                         /**< The status code: 409 Conflict */
164         HTTP_STATUS_GONE = 410,                                             /**< The status code: 410 Gone */
165         HTTP_STATUS_LENGTH_REQUIRED = 411,                                  /**< The status code: 411 Length Required */
166         HTTP_STATUS_PRECONDITION_FAILED = 412,                              /**< The status code: 412 Precondition Failed */
167         HTTP_STATUS_REQUEST_ENTITY_TOO_LARGE = 413,                         /**< The status code: 413 Request Entity Too Large (not used) */
168         HTTP_STATUS_REQUEST_URI_TOO_LARGE = 414,                            /**< The status code: 414 Request-URI Too Long (not used) */
169         HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415,                           /**< The status code: 415 Unsupported %Media Type */
170
171         HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,                            /**< The status code: 500 Internal Server Error */
172         HTTP_STATUS_NOT_IMPLEMENTED = 501,                                  /**< The status code: 501 Not Implemented */
173         HTTP_STATUS_BAD_GATEWAY = 502,                                      /**< The status code: 502 Bad Gateway */
174         HTTP_STATUS_SERVICE_UNAVAILABLE = 503,                              /**< The status code: 503 Service Unavailable */
175         HTTP_STATUS_GATEWAY_TIME_OUT = 504,                                 /**< The status code: 504 Gateway Timeout */
176         HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505                        /**< The status code: 505 HTTP Version Not Supported */
177 } http_status_code_e;
178
179 /**
180  * @brief Enumeration for the http authentication schemes.
181  * @since_tizen 3.0
182  */
183 typedef enum {
184         HTTP_AUTH_NONE = 0,             /**< No authentication type */
185         HTTP_AUTH_PROXY_BASIC = 1,      /**< The authentication type is Proxy Basic Authentication */
186         HTTP_AUTH_PROXY_MD5 = 2,        /**< The authentication type is Proxy Digest Authentication */
187         HTTP_AUTH_WWW_BASIC = 3,        /**< The authentication Type is HTTP Basic Authentication */
188         HTTP_AUTH_WWW_MD5 = 4,          /**< The authentication type is HTTP Digest Authentication */
189         HTTP_AUTH_PROXY_NTLM = 5,       /**< The authentication type is Proxy NTLM Authentication */
190         HTTP_AUTH_WWW_NTLM = 7,         /**< The authentication type is NTLM Authentication */
191         HTTP_AUTH_WWW_NEGOTIATE = 8     /**< The authentication type is Negotiate Authentication */
192 } http_auth_scheme_e;
193
194 /**
195  * @brief Called when the http header is received.
196  * @since_tizen 3.0
197  * @param[in]  http_transaction The http transaction handle
198  * @param[in]  header                   The header information of HTTP Transaction
199  * @param[in]  header_len               The length of the HTTP Transaction header
200  * @param[in]  user_data                The user data
201  * @see http_transaction_set_received_header_cb()
202  */
203 typedef void (*http_transaction_header_cb)(http_transaction_h http_transaction, char *header, size_t header_len, void *user_data);
204
205 /**
206  * @brief Called when the http response is received.
207  * @since_tizen 3.0
208  * @param[in]  http_transaction The http transaction handle
209  * @param[in]  body                             Response information of HTTP Transaction
210  * @param[in]  size                             Size in bytes of each element to be written
211  * @param[in]  count                    Number of elements, each one with a size of size bytes
212  * @param[in]  user_data                The user data
213  * @see http_transaction_set_received_body_cb()
214  */
215 typedef void (*http_transaction_body_cb)(http_transaction_h http_transaction, char *body, size_t size, size_t count, void *user_data);
216
217 /**
218  * @brief Called when the http ready to write event is received.
219  * @since_tizen 3.0
220  * @param[in]  http_transaction                 The http transaction handle
221  * @param[in]  recommended_chunk_size   Recommended chunk length(bytes) of the HTTP transaction
222  * @param[in]  user_data                                The user data
223  * @see http_transaction_set_uploaded_cb()
224  */
225 typedef void (*http_transaction_write_cb)(http_transaction_h http_transaction, int recommended_chunk_size, void *user_data);
226
227 /**
228  * @brief Called when the http transaction is completed.
229  * @since_tizen 3.0
230  * @param[in]  http_transaction The http transaction handle
231  * @param[in]  user_data                The user data
232  * @see http_transaction_set_completed_cb()
233  */
234 typedef void (*http_transaction_completed_cb)(http_transaction_h http_transaction, void *user_data);
235
236 /**
237  * @brief Called when the http transaction is aborted.
238  * @details Following error codes can be delivered. \n
239  *              #HTTP_ERROR_OPERATION_FAILED, \n
240  *              #HTTP_ERROR_COULDNT_RESOLVE_HOST, \n
241  *              #HTTP_ERROR_COULDNT_CONNECT, \n
242  *              #HTTP_ERROR_OPERATION_TIMEDOUT, \n
243  *              #HTTP_ERROR_SSL_CONNECT_ERROR
244  * @since_tizen 3.0
245  * @param[in]  http_transaction The http transaction handle
246  * @param[in]  error                    The error code about aborted reason
247  * @param[in]  user_data                The user data
248  * @see http_transaction_set_aborted_cb()
249  */
250 typedef void (*http_transaction_aborted_cb)(http_transaction_h http_transaction, http_error_code_e error, void *user_data);
251
252 /**
253  * @brief Called to notify when the content body of the response message is being downloaded or uploaded.
254  * @since_tizen 3.0
255  * @param[in]  http_transaction         The http transaction handle
256  * @param[in]  download_total           The total length of the data (in bytes) to download
257  * @param[in]  download_now                     The current length of the downloaded data (in bytes)
258  * @param[in]  upload_total                     The total length of the data (in bytes) to upload
259  * @param[in]  upload_now                       The current length of the uploaded data (in bytes)
260  * @param[in]  user_data                        The user data
261  * @see http_transaction_set_progress_cb()
262  */
263 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);
264
265 /**
266  * @brief Initializes the HTTP module.
267  * @since_tizen 3.0
268  * @return 0 on success, otherwise negative error value
269  * @retval  #HTTP_ERROR_NONE  Successful
270  * @retval  #HTTP_ERROR_OPERATION_FAILED Operation failed
271  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
272  * @see         http_deinit()
273  */
274 int http_init(void);
275
276 /**
277  * @brief Deinitializes the HTTP module.
278  * @since_tizen 3.0
279  * @return 0 on success, otherwise negative error value
280  * @retval  #HTTP_ERROR_NONE  Successful
281  * @retval  #HTTP_ERROR_OPERATION_FAILED Operation failed
282  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
283  * @see         http_init()
284  */
285 int http_deinit(void);
286
287 /**
288  * @}
289  */
290
291 /**
292  * @addtogroup CAPI_NETWORK_HTTP_SESSION_MODULE
293  * @{
294  */
295
296 /**
297  * @brief Creates the HTTP session handle.
298  * @since_tizen 3.0
299  * @remarks The @a http_session should be released using http_session_destroy(). \
300  *                      Opened transactions can't be submitted after destroying session handle.
301  * @param[in]   mode            The http session mode
302  * @param[out]  http_session    The http session handle
303  * @return 0 on success, otherwise negative error value
304  * @retval  #HTTP_ERROR_NONE  Successful
305  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
306  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
307  * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
308  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
309  * @see         http_session_destroy()
310  */
311 int http_session_create(http_session_mode_e mode, http_session_h *http_session);
312
313 /**
314  * @brief Destroys the HTTP session handle.
315  * @since_tizen 3.0
316  * @remarks http_session should be set to NULL after using it
317  * @param[in]  http_session  The http session handle
318  * @return 0 on success, otherwise negative error value
319  * @retval  #HTTP_ERROR_NONE  Successful
320  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
321  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
322  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
323  * @see     http_session_create()
324  */
325 int http_session_destroy(http_session_h http_session);
326
327 /**
328  * @brief Opens HTTP transaction from the HTTP Session.
329  * @since_tizen 3.0
330  * @remarks The @a http_transaction should be released using http_transaction_destroy().
331  * @param[in]  http_session             The http session handle
332  * @param[in]  method                   The http request method
333  * @param[out] http_transaction The http transaction handle
334  * @return 0 on success, otherwise negative error value
335  * @retval  #HTTP_ERROR_NONE  Successful
336  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
337  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
338  * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
339  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
340  */
341 int http_session_open_transaction(http_session_h http_session, http_method_e method, http_transaction_h *http_transaction);
342
343 /**
344  * @brief  Sets the value to redirect the HTTP request automatically.
345  * @since_tizen 3.0
346  * @param[in]  http_session     The http session handle
347  * @param[in]  auto_redirection The value which determines whether allow redirection or not
348  * @return 0 on success, otherwise negative error value
349  * @retval  #HTTP_ERROR_NONE  Successful
350  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
351  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
352  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
353  * @see         http_session_get_auto_redirection()
354  */
355 int http_session_set_auto_redirection(http_session_h http_session, bool auto_redirection);
356
357 /**
358  * @brief Gets the auto redirection for the HTTP request.
359  * @since_tizen 3.0
360  * @param[in]   http_session  The http session handle
361  * @param[out]  auto_redirect The value of auto redirect
362  * @return 0 on success, otherwise negative error value
363  * @retval  #HTTP_ERROR_NONE  Successful
364  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
365  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
366  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
367  * @see     http_session_set_auto_redirection()
368  */
369 int http_session_get_auto_redirection(http_session_h http_session, bool *auto_redirect);
370
371 /**
372  * @brief Gets the number of active transactions in the current session.
373  * @since_tizen 3.0
374  * @param[in]   http_session                            The http session handle
375  * @param[out]  active_transaction_count        The number of activated transactions
376  * @return 0 on success, otherwise negative error value
377  * @retval  #HTTP_ERROR_NONE  Successful
378  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
379  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
380  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
381  */
382 int http_session_get_active_transaction_count(http_session_h http_session, int *active_transaction_count);
383
384 /**
385  * @brief Gets the maximum number of transactions for the current session.
386  * @since_tizen 3.0
387  * @param[in]   http_session            The http session handle
388  * @param[out]  transaction_count       The maximum transaction count
389  * @return 0 on success, otherwise negative error value
390  * @retval  #HTTP_ERROR_NONE  Successful
391  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
392  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
393  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
394  */
395 int http_session_get_max_transaction_count(http_session_h http_session, int *transaction_count);
396
397 /**
398  * @brief Destroys all transaction.
399  * @since_tizen 3.0
400  * @remarks All http_transactions should be set to NULL after using it
401  * @param[in]  http_session  The http session handle
402  * @return 0 on success, otherwise negative error value
403  * @retval  #HTTP_ERROR_NONE  Successful
404  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
405  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
406  * @retval  #HTTP_ERROR_OPERATION_FAILED  Operation failed
407  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
408  */
409 int http_session_destroy_all_transactions(http_session_h http_session);
410 /**
411  * @}
412  */
413
414 /**
415  * @addtogroup CAPI_NETWORK_HTTP_TRANSACTION_MODULE
416  * @{
417  */
418
419 /**
420  * @brief Submits the HTTP request.
421  * @since_tizen 3.0
422  * @privlevel public
423  * @privilege %http://tizen.org/privilege/internet \n
424  *                              %http://tizen.org/privilege/network.get
425  * @param[in]  http_transaction  The http transaction handle
426  * @return 0 on success, otherwise negative error value
427  * @retval  #HTTP_ERROR_NONE  Successful
428  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
429  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
430  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
431  * @retval  #HTTP_ERROR_PERMISSION_DENIED Permission denied
432  */
433 int http_transaction_submit(http_transaction_h http_transaction);
434
435 /**
436  * @brief Closes the http transaction handle.
437  * @since_tizen 3.0
438  * @remarks  The @a transaction is released by http_transaction_destroy().
439  *                       http_transaction should be set to NULL after using it.
440  * @param[in]  http_transaction  The http transaction handle
441  * @return 0 on success, otherwise negative error value
442  * @retval  #HTTP_ERROR_NONE  Successful
443  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
444  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
445  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
446  * @see         http_transaction_create()
447  */
448 int http_transaction_destroy(http_transaction_h http_transaction);
449
450 /**
451  * @brief Registers callback called when receive header.
452  * @since_tizen 3.0
453  * @param[in]  http_transaction  The http transaction handle
454  * @param[in]  header_cb                 The callback function to be called
455  * @param[in]  user_data                 The user data passed to the callback function
456  * @return 0 on success, otherwise negative error value
457  * @retval  #HTTP_ERROR_NONE  Successful
458  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
459  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
460  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
461  */
462 int http_transaction_set_received_header_cb(http_transaction_h http_transaction, http_transaction_header_cb header_cb, void* user_data);
463
464 /**
465  * @brief Registers callback called when receive body.
466  * @since_tizen 3.0
467  * @param[in]  http_transaction  The http transaction handle
468  * @param[in]  body_cb                   The callback function to be called
469  * @param[in]  user_data                 The user data passed to the callback function
470  * @return 0 on success, otherwise negative error value
471  * @retval  #HTTP_ERROR_NONE  Successful
472  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
473  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
474  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
475  */
476 int http_transaction_set_received_body_cb(http_transaction_h http_transaction, http_transaction_body_cb body_cb, void* user_data);
477
478 /**
479  * @brief Registers callback called when write data.
480  * @since_tizen 3.0
481  * @param[in]  http_transaction  The http transaction handle
482  * @param[in]  write_cb                  The callback function to be called
483  * @param[in]  user_data                 The user data passed to the callback function
484  * @return 0 on success, otherwise negative error value
485  * @retval  #HTTP_ERROR_NONE  Successful
486  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
487  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
488  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
489  */
490 int http_transaction_set_uploaded_cb(http_transaction_h http_transaction, http_transaction_write_cb write_cb, void* user_data);
491
492 /**
493  * @brief Registers callback called when transaction is completed.
494  * @since_tizen 3.0
495  * @param[in]  http_transaction  The http transaction handle
496  * @param[in]  completed_cb      The callback function to be called
497  * @param[in]  user_data                 The user data passed to the callback function
498  * @return 0 on success, otherwise negative error value
499  * @retval  #HTTP_ERROR_NONE  Successful
500  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
501  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
502  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
503  */
504 int http_transaction_set_completed_cb(http_transaction_h http_transaction, http_transaction_completed_cb completed_cb, void* user_data);
505
506 /**
507  * @brief Registers callback called when transaction is aborted.
508  * @since_tizen 3.0
509  * @param[in]  http_transaction  The http transaction handle
510  * @param[in]  aborted_cb                The callback function to be called
511  * @param[in]  user_data                 The user data passed to the callback function
512  * @return 0 on success, otherwise negative error value
513  * @retval  #HTTP_ERROR_NONE  Successful
514  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
515  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
516  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
517  */
518 int http_transaction_set_aborted_cb(http_transaction_h http_transaction, http_transaction_aborted_cb aborted_cb, void* user_data);
519
520 /**
521  * @brief Registers the progress callbacks.
522  * @details Registers callback that is called when data is uploaded/downloaded.
523  * @since_tizen 3.0
524  * @param[in]  http_transaction  The http transaction handle
525  * @param[in]  progress_cb               The callback function to be called
526  * @param[in]  user_data         The user data passed to the callback function
527  * @return 0 on success, otherwise negative error value
528  * @retval  #HTTP_ERROR_NONE  Successful
529  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
530  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
531  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
532  */
533 int http_transaction_set_progress_cb(http_transaction_h http_transaction, http_transaction_progress_cb progress_cb, void* user_data);
534
535 /**
536  * @brief Sets the timeout in seconds that is the timeout for waiting the transaction.
537  * @details Sets the timeout in seconds that is the timeout for waiting the transaction. \n
538  *  A timeout value of zero means an infinite timeout.
539  * @since_tizen 3.0
540  * @param[in]  http_transaction  The http transaction handle
541  * @param[in]  timeout                   The timeout in seconds
542  * @return 0 on success, otherwise negative error value
543  * @retval  #HTTP_ERROR_NONE  Successful
544  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
545  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
546  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
547  */
548 int http_transaction_set_timeout(http_transaction_h http_transaction, int timeout);
549
550 /**
551  * @brief Gets the time out in seconds for the transaction.
552  * @since_tizen 3.0
553  * @param[in]  http_transaction  The http transaction handle
554  * @param[out] timeout                   The timeout in seconds
555  * @return 0 on success, otherwise negative error value
556  * @retval  #HTTP_ERROR_NONE  Successful
557  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
558  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
559  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
560  */
561 int http_transaction_get_timeout(http_transaction_h http_transaction, int *timeout);
562
563 /**
564  * @brief Resumes the transaction.
565  * @since_tizen 3.0
566  * @param[in]  http_transaction  The http transaction handle
567  * @return 0 on success, otherwise negative error value
568  * @retval  #HTTP_ERROR_NONE  Successful
569  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
570  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
571  * @retval  #HTTP_ERROR_OPERATION_FAILED  Operation failed
572  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
573  */
574 int http_transaction_resume(http_transaction_h http_transaction);
575
576 /**
577  * @brief Pauses the transaction.
578  * @since_tizen 3.0
579  * @param[in]  http_transaction  The http transaction handle
580  * @param[in]  pause_type                The pause type of the connection
581  * @return 0 on success, otherwise negative error value
582  * @retval  #HTTP_ERROR_NONE  Successful
583  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
584  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
585  * @retval  #HTTP_ERROR_OPERATION_FAILED  Operation failed
586  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
587  */
588 int http_transaction_pause(http_transaction_h http_transaction, http_pause_type_e pause_type);
589
590 /**
591  * @brief Sets ready to write event for a transaction.
592  * @since_tizen 3.0
593  * @param[in]  http_transaction  The http transaction handle
594  * @param[out] read_to_write     Enable/disable ready to write
595  * @return 0 on success, otherwise negative error value
596  * @retval  #HTTP_ERROR_NONE  Successful
597  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
598  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
599  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
600  */
601 int http_transaction_set_ready_to_write(http_transaction_h http_transaction, bool read_to_write);
602
603 /**
604  * @brief Sets the interface name.
605  * @since_tizen 3.0
606  * @param[in]  http_transaction  The http transaction handle
607  * @param[in]  interface_name    The interface name to use as outgoing network interface
608  * @return 0 on success, otherwise negative error value
609  * @retval  #HTTP_ERROR_NONE  Successful
610  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
611  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
612  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
613  */
614 int http_transaction_set_interface_name(http_transaction_h http_transaction, const char *interface_name);
615
616 /**
617  * @brief Gets the interface name.
618  * @since_tizen 3.0
619  * @remarks  The @a interface_name should be freed using free().
620  * @param[in]   http_transaction  The http transaction handle
621  * @param[out]  interface_name    The interface name
622  * @return 0 on success, otherwise negative error value
623  * @retval  #HTTP_ERROR_NONE  Successful
624  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
625  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
626  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
627  */
628 int http_transaction_get_interface_name(http_transaction_h http_transaction, char **interface_name);
629
630 /**
631  * @brief Sets the flag to verify a server certificate.
632  * @details The verify determines whether verifies the peer's certificate.
633  * @since_tizen 3.0
634  * @param[in]  http_transaction  The http transaction handle
635  * @param[in]  verify                    The flag to verify a server certificate; true means verifies; false means it doesn't.
636  * @return 0 on success, otherwise negative error value
637  * @retval  #HTTP_ERROR_NONE  Successful
638  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
639  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
640  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
641  */
642 int http_transaction_set_server_certificate_verification(http_transaction_h http_transaction, bool verify);
643
644 /**
645  * @brief Gets the flag to verify a server certificate.
646  * @since_tizen 3.0
647  * @param[in]  http_transaction  The http transaction handle
648  * @param[out] verify                    The flag to verify a server certificate; true means verifies; false means it doesn't.
649  * @return 0 on success, otherwise negative error value
650  * @retval  #HTTP_ERROR_NONE  Successful
651  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
652  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
653  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
654  */
655 int http_transaction_get_server_certificate_verification(http_transaction_h http_transaction, bool* verify);
656
657 /**
658  * @}
659  */
660
661 /**
662  * @addtogroup CAPI_NETWORK_HTTP_HEADER_MODULE
663  * @{
664  */
665
666 /**
667  * @brief Adds a named field to header.
668  * @details Adds a named field, which is a <@c fieldName, @c fieldValue> pair, to the current instance of HTTP Transaction.
669  * @since_tizen 3.0
670  * @param[in]  http_transaction  The http transaction handle
671  * @param[in]  field_name                The http Header Field name
672  * @param[in]  field_value       The http Header Field value
673  * @return 0 on success, otherwise negative error value
674  * @retval  #HTTP_ERROR_NONE  Successful
675  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
676  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
677  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
678  */
679 int http_transaction_header_add_field(http_transaction_h http_transaction, const char *field_name, const char* field_value);
680
681 /**
682  * @brief Removes the named field from header.
683  * @details Remove the named field, which is a <@c fieldName, @c fieldValue> pair, from the current instance of HTTP Transaction.
684  * @since_tizen 3.0
685  * @param[in]  http_transaction  The http transaction handle
686  * @param[in]  field_name                The http Header Field name
687  * @return 0 on success, otherwise negative error value
688  * @retval  #HTTP_ERROR_NONE  Successful
689  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
690  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
691  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
692  */
693 int http_transaction_header_remove_field(http_transaction_h http_transaction, const char *field_name);
694
695 /**
696  * @brief Gets the HTTP Header Field value from custom header.
697  * @since_tizen 3.0
698  * @remarks The @a field_value should be freed using free().
699  * @param[in]  http_transaction  The http transaction handle
700  * @param[in]  field_name                The http Header Field name
701  * @param[out] field_value       The http Header Field value
702  * @return 0 on success, otherwise negative error value
703  * @retval  #HTTP_ERROR_NONE  Successful
704  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
705  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
706  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
707  */
708 int http_transaction_header_get_field_value(http_transaction_h http_transaction, const char *field_name, char **field_value);
709
710 /**
711   * @}
712   */
713
714
715 /**
716  * @addtogroup CAPI_NETWORK_HTTP_REQUEST_MODULE
717  * @{
718  */
719
720 /**
721  * @brief Sets an HTTP method of the request header.
722  * @details Set an HTTP method such as GET, POST, PUT and etc.
723  * @since_tizen 3.0
724  * @remarks The default method is GET.
725  * @param[in]  http_transaction  The http transaction handle
726  * @param[in]  method                    The http method
727  * @return 0 on success, otherwise negative error value
728  * @retval  #HTTP_ERROR_NONE  Successful
729  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
730  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
731  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
732  */
733 int http_transaction_request_set_method(http_transaction_h http_transaction, http_method_e method);
734
735 /**
736  * @brief Gets the HTTP method from request header.
737  * @since_tizen 3.0
738  * @param[in]  http_transaction  The http transaction handle
739  * @param[out] method                    The http method
740  * @return 0 on success, otherwise negative error value
741  * @retval  #HTTP_ERROR_NONE  Successful
742  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
743  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
744  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
745  */
746 int http_transaction_request_get_method(http_transaction_h http_transaction, http_method_e *method);
747
748 /**
749  * @brief Sets an HTTP version of the request header.
750  * @since_tizen 3.0
751  * @remarks The default version is HTTP 1.1.
752  * @param[in]  http_transaction The http transaction handle
753  * @param[in]  version                  The http version
754  * @return 0 on success, otherwise negative error value
755  * @retval  #HTTP_ERROR_NONE  Successful
756  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
757  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
758  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
759  */
760 int http_transaction_request_set_version(http_transaction_h http_transaction, http_version_e version);
761
762 /**
763  * @brief Gets the HTTP version from request header.
764  * @details Get the HTTP version.
765  * @since_tizen 3.0
766  * @param[in]  http_transaction The http transaction handle
767  * @param[out]  version                 The http version
768  * @return 0 on success, otherwise negative error value
769  * @retval  #HTTP_ERROR_NONE  Successful
770  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
771  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
772  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
773  */
774 int http_transaction_request_get_version(http_transaction_h http_transaction, http_version_e *version);
775
776 /**
777  * @brief Sets a URI of the request header.
778  * @details Sets a URI of the request header.
779  * @since_tizen 3.0
780  * @remarks It should be used before http_transaction_submit().
781  * @param[in]  http_transaction The http transaction handle
782  * @param[in]  host_uri                 The uri to use in the request
783  * @return 0 on success, otherwise negative error value
784  * @retval  #HTTP_ERROR_NONE  Successful
785  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
786  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
787  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
788  */
789 int http_transaction_request_set_uri(http_transaction_h http_transaction, const char *host_uri);
790
791 /**
792  * @brief Gets the uri.
793  * @since_tizen 3.0
794  * @remarks  The @a host_uri should be freed using free().
795  * @param[in]  http_transaction The http transaction handle
796  * @param[out] host_uri                 The host uri
797  * @return 0 on success, otherwise negative error value
798  * @retval  #HTTP_ERROR_NONE  Successful
799  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
800  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
801  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
802  */
803 int http_transaction_request_get_uri(http_transaction_h http_transaction, char **host_uri);
804
805 /**
806  * @brief Sets the Accept-Encoding header field of HTTP Request.
807  * @details The Accept-Encoding header enables automatic decompression of HTTP downloads.
808  * @since_tizen 3.0
809  * @remarks  If empty string is set, an Accept-Encoding header contains all supported built-in compressions.
810  * @param[in]  http_transaction The http transaction handle
811  * @param[in]  encoding                 The encoding algorithms (e.g. gzip, deflate)
812  * @return 0 on success, otherwise negative error value
813  * @retval  #HTTP_ERROR_NONE  Successful
814  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
815  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
816  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
817  */
818 int http_transaction_request_set_accept_encoding(http_transaction_h http_transaction, const char *encoding);
819
820 /**
821  * @brief Gets the Accept-Encoding header field of HTTP Request.
822  * @since_tizen 3.0
823  * @remarks  The @a encoding should be freed using free().
824  * @param[in]  http_transaction The http transaction handle
825  * @param[out] encoding                 The encoding algorithms
826  * @return 0 on success, otherwise negative error value
827  * @retval  #HTTP_ERROR_NONE  Successful
828  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
829  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
830  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
831  */
832 int http_transaction_request_get_accept_encoding(http_transaction_h http_transaction, char **encoding);
833
834 /**
835  * @brief Sets a cookie in the HTTP request.
836  * @since_tizen 3.0
837  * @remarks  The format of string should be NME=CONTENTS (e.g. "name1=hello; name2=tizen;")
838  * @param[in]  http_transaction The http transaction handle
839  * @param[in]  cookie                   The cookie
840  * @return 0 on success, otherwise negative error value
841  * @retval  #HTTP_ERROR_NONE  Successful
842  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
843  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
844  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
845  */
846 int http_transaction_request_set_cookie(http_transaction_h http_transaction, const char *cookie);
847
848 /**
849  * @brief Gets a cookie in the HTTP request.
850  * @since_tizen 3.0
851  * @remarks  The @a cookie should be freed using free().
852  * @param[in]  http_transaction The http transaction handle
853  * @param[out] cookie                   The cookie
854  * @return 0 on success, otherwise negative error value
855  * @retval  #HTTP_ERROR_NONE  Successful
856  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
857  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
858  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
859  */
860 int http_transaction_request_get_cookie(http_transaction_h http_transaction, char **cookie);
861
862 /**
863  * @brief Writes the request message body.
864  * @details This function writes the request message body in the internal queue. \n
865  *                      The written queue for request body is uploaded after invoking http_transaction_submit()
866  * @since_tizen 3.0
867  * @param[in]  http_transaction The http transaction handle
868  * @param[in]  body                     The message body data
869  * @return 0 on success, otherwise negative error value
870  * @retval  #HTTP_ERROR_NONE  Successful
871  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
872  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
873  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
874  */
875 int http_transaction_request_write_body(http_transaction_h http_transaction, const char *body);
876
877 /**
878  * @}
879  */
880
881 /**
882  * @addtogroup CAPI_NETWORK_HTTP_RESPONSE_MODULE
883  * @{
884  */
885
886 /**
887  * @brief Gets the HTTP status code from HTTP Response.
888  * @since_tizen 3.0
889  * @param[in]  http_transaction  The http transaction handle
890  * @param[out] status_code               The http status code
891  * @return 0 on success, otherwise negative error value
892  * @retval  #HTTP_ERROR_NONE  Successful
893  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
894  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
895  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
896  */
897 int http_transaction_response_get_status_code(http_transaction_h http_transaction, http_status_code_e *status_code);
898
899 /**
900  * @brief Gets the HTTP status text from HTTP Response.
901  * @since_tizen 3.0
902  * @remarks  The @a status_text should be freed using free().
903  * @param[in]  http_transaction  The http transaction handle
904  * @param[out] status_text       The http status text
905  * @return 0 on success, otherwise negative error value
906  * @retval  #HTTP_ERROR_NONE  Successful
907  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
908  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
909  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
910  */
911 int http_transaction_response_get_status_text(http_transaction_h http_transaction, char **status_text);
912
913 /**
914  * @brief Gets the HTTP version from HTTP Response.
915  * @since_tizen 3.0
916  * @param[in]  http_transaction  The http transaction handle
917  * @param[out] version                   The http version
918  * @return 0 on success, otherwise negative error value
919  * @retval  #HTTP_ERROR_NONE  Successful
920  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
921  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
922  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
923  */
924 int http_transaction_response_get_version(http_transaction_h http_transaction, http_version_e *version);
925
926 /**
927  * @}
928  */
929
930 /**
931  * @addtogroup CAPI_NETWORK_HTTP_AUTHENTICATION_MODULE
932  * @{
933  */
934
935 /**
936  * @brief Opens HTTP transaction with authentication information.
937  * @since_tizen 3.0
938  * @remarks The @a http_auth_transaction should be released using http_transaction_destroy().
939  * @param[in]  http_transaction         The http transaction handle
940  * @param[out] http_auth_transaction The http transaction handle
941  * @return 0 on success, otherwise negative error value
942  * @retval  #HTTP_ERROR_NONE  Successful
943  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
944  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
945  * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
946  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
947  */
948 int http_transaction_open_authentication(http_transaction_h http_transaction, http_transaction_h *http_auth_transaction);
949
950 /**
951  * @brief Sets an HTTP credentials.
952  * @details Set an HTTP authentication scheme such as username and password.
953  * @since_tizen 3.0
954  * @param[in]  http_transaction  The http transaction handle
955  * @param[in]  user_name                 The http user name
956  * @param[in]  password                  The http password
957  * @return 0 on success, otherwise negative error value
958  * @retval  #HTTP_ERROR_NONE  Successful
959  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
960  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
961  */
962 int http_transaction_set_credentials(http_transaction_h http_transaction, const char *user_name, const char *password);
963
964 /**
965  * @brief Gets the username & password for the http credential.
966  * @since_tizen 3.0
967  * @remarks The @a user_name & @a password should be freed using free().
968  * @param[in]  http_transaction  The http transaction handle
969  * @param[out]  user_name                The http credential user name
970  * @param[out] password          The http credential password
971  * @return 0 on success, otherwise negative error value
972  * @retval  #HTTP_ERROR_NONE  Successful
973  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
974  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
975  * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
976  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
977  */
978 int http_transaction_get_credentials(http_transaction_h http_transaction, char **user_name, char **password);
979
980 /**
981  * @brief Sets an HTTP authentication scheme.
982  * @details Set an HTTP authentication scheme such as BASIC, MD5, NTLM and etc.
983  * @since_tizen 3.0
984  * @param[in]  http_transaction  The http transaction handle
985  * @param[in]  auth_scheme                       The http authentication scheme
986  * @return 0 on success, otherwise negative error value
987  * @retval  #HTTP_ERROR_NONE  Successful
988  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
989  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
990  */
991 int http_transaction_set_http_auth_scheme(http_transaction_h http_transaction, http_auth_scheme_e auth_scheme);
992
993 /**
994  * @brief Gets the HTTP authentication scheme.
995  * @since_tizen 3.0
996  * @param[in]  http_transaction  The http transaction handle
997  * @param[out] auth_scheme       The http auth scheme value
998  * @return 0 on success, otherwise negative error value
999  * @retval  #HTTP_ERROR_NONE  Successful
1000  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
1001  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
1002  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
1003  */
1004 int http_transaction_get_http_auth_scheme(http_transaction_h http_transaction, http_auth_scheme_e *auth_scheme);
1005
1006 /**
1007  * @brief Gets the HTTP authentication realm.
1008  * @since_tizen 3.0
1009  * @remarks The @a realm should be freed using free().
1010  * @param[in]  http_transaction  The http transaction handle
1011  * @param[out] realm     The http realm value
1012  * @return 0 on success, otherwise negative error value
1013  * @retval  #HTTP_ERROR_NONE  Successful
1014  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
1015  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
1016  * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
1017  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
1018  */
1019 int http_transaction_get_realm(http_transaction_h http_transaction, char **realm);
1020
1021 /**
1022  * @}
1023  */
1024
1025 #ifdef __cplusplus
1026  }
1027 #endif
1028
1029 #endif /* __TIZEN_NETWORK_HTTP_H__ */