Fixed doxygen comments 36/74536/5
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 14 Jun 2016 12:03:59 +0000 (21:03 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 16 Jun 2016 01:28:19 +0000 (10:28 +0900)
Change-Id: Iab5600653586a8bc26e8d580100f954a6039298a
Signed-off-by: Seonah Moon <seonah1.moon@samsung.com>
doc/http_doc.h
include/http.h
src/http_transaction.c
test/http_test.c

index 557c2ad..5331e00 100755 (executable)
@@ -19,9 +19,9 @@
 #define __TIZEN_NETWORK_HTTP_DOC_H__
 
 /**
- * @ingroup CAPI_NETWORK_FRAMEWORK
  * @defgroup CAPI_NETWORK_HTTP_MODULE  HTTP
  * @brief The HTTP API provides functions for communication with server according to HTTP protocol.
+ * @ingroup CAPI_NETWORK_FRAMEWORK
  *
  * @section CAPI_NETWORK_HTTP_MODULE_HEADER Required Header
  *   \#include <http.h>
  * - http://tizen.org/feature/network.internet \n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
- *
  * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
- *
  * 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.\n
- *
  * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
- * @ endif
  *
+ * @endif
  */
 
 /**
- * @ingroup CAPI_NETWORK_HTTP_MODULE
  * @defgroup CAPI_NETWORK_HTTP_SESSION_MODULE  HTTP Session
  * @brief The HTTP Session API provides functions for managing HTTP session.
+ * @ingroup CAPI_NETWORK_HTTP_MODULE
  *
  * @section CAPI_NETWORK_HTTP_SESSION_MODULE_HEADER Required Header
  *   \#include <http.h>
  * - http://tizen.org/feature/network.internet \n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
- *
  * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
- *
  * 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.\n
- *
  * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
- * @ endif
- *
+ * @endif
  */
 
 /**
- * @ingroup CAPI_NETWORK_HTTP_SESSION_MODULE
  * @defgroup CAPI_NETWORK_HTTP_TRANSACTION_MODULE  HTTP Transaction
  * @brief The HTTP Transaction API provides functions for managing HTTP transactions.
+ * @ingroup CAPI_NETWORK_HTTP_SESSION_MODULE
  *
  * @section CAPI_NETWORK_HTTP_TRANSACTION_MODULE_HEADER Required Header
  *   \#include <http.h>
  * - http://tizen.org/feature/network.internet \n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
- *
  * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
- *
  * 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.\n
- *
  * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
- * @ endif
- *
+ * @endif
  */
 
 /**
- * @ingroup CAPI_NETWORK_HTTP_TRANSACTION_MODULE
  * @defgroup CAPI_NETWORK_HTTP_REQUEST_MODULE  HTTP Request
  * @brief It manages HTTP request.
+ * @ingroup CAPI_NETWORK_HTTP_TRANSACTION_MODULE
  *
  * @section CAPI_NETWORK_HTTP_REQUEST_MODULE_HEADER  Required Header
  *   \#include <http.h>
  * - http://tizen.org/feature/network.internet\n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
- *
  * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
- *
  * 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.\n
- *
  * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
- * @ endif
- *
+ * @endif
  */
 
 /**
- * @ingroup CAPI_NETWORK_HTTP_TRANSACTION_MODULE
  * @defgroup CAPI_NETWORK_HTTP_RESPONSE_MODULE  HTTP Response
  * @brief It manages HTTP response.
+ * @ingroup CAPI_NETWORK_HTTP_TRANSACTION_MODULE
  *
  * @section CAPI_NETWORK_HTTP_RESPONSE_MODULE_HEADER  Required Header
  *   \#include <http.h>
  * - http://tizen.org/feature/network.internet \n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
- *
  * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
- *
  * 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.\n
- *
  * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
- * @ endif
- *
+ * @endif
  */
 
 /**
- * @ingroup CAPI_NETWORK_HTTP_TRANSACTION_MODULE
  * @defgroup CAPI_NETWORK_HTTP_HEADER_MODULE  HTTP Header
  * @brief It manages custom header
+ * @ingroup CAPI_NETWORK_HTTP_TRANSACTION_MODULE
  *
  * @section CAPI_NETWORK_HTTP_HEADER_MODULE_HEADER  Required Header
  *   \#include <http.h>
  * - http://tizen.org/feature/network.internet \n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
- *
  * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
- *
  * 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.\n
- *
  * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
- * @ endif
+ * @endif
+ */
+
+/**
+ * @defgroup CAPI_NETWORK_HTTP_AUTHENTICATION_MODULE  HTTP Authentication
+ * @brief It manages HTTP Autehntication and credential
+ * @ingroup CAPI_NETWORK_HTTP_TRANSACTION_MODULE
  *
+ * @section CAPI_NETWORK_HTTP_AUTHENTICATION_MODULE_HEADER  Required Header
+ *   \#include <http.h>
+ *
+ * @section CAPI_NETWORK_HTTP_AUTHENTICATION_MODULE_OVERVIEW Overview
+ * It manages HTTP Autehntication and credential
+ *
+ * @if WEARABLE
+ * @section CAPI_NETWORK_HTTP_HEADER_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.internet \n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ * 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.\n
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/getting-started/native-application/understanding-tizen-programming/application-filtering"><b>Feature List</b>.</a>
+ * @endif
  */
 
 #endif /* __TIZEN_NETWORK_HTTP_DOC_H__ */
index afd604b..2e2a137 100644 (file)
@@ -403,7 +403,7 @@ int http_session_get_max_transaction_count(http_session_h http_session, int *tra
  * @retval  #HTTP_ERROR_NONE  Successful
  * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
- * @retval  #HTTP_ERROR_OPERATION_fAILED  Operation failed
+ * @retval  #HTTP_ERROR_OPERATION_FAILED  Operation failed
  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
  */
 int http_session_destroy_all_transactions(http_session_h http_session);
@@ -420,7 +420,8 @@ int http_session_destroy_all_transactions(http_session_h http_session);
  * @brief Submits the HTTP request.
  * @since_tizen 3.0
  * @privlevel public
- * @privilege %http://tizen.org/privilege/internet
+ * @privilege %http://tizen.org/privilege/internet \n
+ *                             %http://tizen.org/privilege/network.get
  * @param[in]  http_transaction  The http transaction handle
  * @return 0 on success, otherwise negative error value
  * @retval  #HTTP_ERROR_NONE  Successful
@@ -514,7 +515,7 @@ int http_transaction_set_completed_cb(http_transaction_h http_transaction, http_
  * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
  * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
  */
-int http_transaction_set_aborted_cb(http_transaction_h http_http_transaction, http_transaction_aborted_cb aborted_cb, void* user_data);
+int http_transaction_set_aborted_cb(http_transaction_h http_transaction, http_transaction_aborted_cb aborted_cb, void* user_data);
 
 /**
  * @brief Registers the progress callbacks.
@@ -654,6 +655,15 @@ int http_transaction_set_server_certificate_verification(http_transaction_h http
 int http_transaction_get_server_certificate_verification(http_transaction_h http_transaction, bool* verify);
 
 /**
+ * @}
+ */
+
+/**
+ * @addtogroup CAPI_NETWORK_HTTP_HEADER_MODULE
+ * @{
+ */
+
+/**
  * @brief Adds a named field to header.
  * @details Adds a named field, which is a <@c fieldName, @c fieldValue> pair, to the current instance of HTTP Transaction.
  * @since_tizen 3.0
@@ -698,94 +708,9 @@ int http_transaction_header_remove_field(http_transaction_h http_transaction, co
 int http_transaction_header_get_field_value(http_transaction_h http_transaction, const char *field_name, char **field_value);
 
 /**
- * @brief Opens HTTP transaction with authentication information.
- * @since_tizen 3.0
- * @remarks The @a http_auth_transaction should be released using http_transaction_destroy().
- * @param[in]  http_transaction                The http transaction handle
- * @param[out] http_auth_transaction The http transaction handle
- * @return 0 on success, otherwise negative error value
- * @retval  #HTTP_ERROR_NONE  Successful
- * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
- * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
- */
-int http_open_authentication(http_transaction_h http_transaction, http_transaction_h *http_auth_transaction);
-
-/**
- * @brief Sets an HTTP credentials.
- * @details Set an HTTP authentication scheme such as username and password.
- * @since_tizen 3.0
- * @param[in]  http_transaction  The http transaction handle
- * @param[in]  user_name                The http user name
- * @param[in]  password                         The http password
- * @return 0 on success, otherwise negative error value
- * @retval  #HTTP_ERROR_NONE  Successful
- * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
- */
-int http_transaction_set_credentials(http_transaction_h http_transaction, const char *user_name, const char *password);
-
-/**
- * @brief Gets the username & password for the http credential.
- * @since_tizen 3.0
- * @remarks The @a user_name & @a password should be freed using free().
- * @param[in]  http_transaction  The http transaction handle
- * @param[out]  user_name               The http credential user name
- * @param[out] password         The http credential password
- * @return 0 on success, otherwise negative error value
- * @retval  #HTTP_ERROR_NONE  Successful
- * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
- * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
- */
-int http_transaction_get_credentials(http_transaction_h http_transaction, char **user_name, char **password);
-
-/**
- * @brief Sets an HTTP authentication scheme.
- * @details Set an HTTP authentication scheme such as BASIC, MD5, NTLM and etc.
- * @since_tizen 3.0
- * @param[in]  http_transaction  The http transaction handle
- * @param[in]  auth_scheme                      The http authentication scheme
- * @return 0 on success, otherwise negative error value
- * @retval  #HTTP_ERROR_NONE  Successful
- * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
- */
-int http_transaction_set_http_auth_scheme(http_transaction_h http_transaction, http_auth_scheme_e auth_scheme);
-
-/**
- * @brief Gets the HTTP authentication scheme.
- * @since_tizen 3.0
- * @param[in]  http_transaction  The http transaction handle
- * @param[out] auth_scheme      The http auth scheme value
- * @return 0 on success, otherwise negative error value
- * @retval  #HTTP_ERROR_NONE  Successful
- * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
- * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
- */
-int http_transaction_get_http_auth_scheme(http_transaction_h http_transaction, http_auth_scheme_e *auth_scheme);
-
-/**
- * @brief Gets the HTTP authentication realm.
- * @since_tizen 3.0
- * @remarks The @a realm should be freed using free().
- * @param[in]  http_transaction  The http transaction handle
- * @param[out] realm    The http realm value
- * @return 0 on success, otherwise negative error value
- * @retval  #HTTP_ERROR_NONE  Successful
- * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
- * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
- * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
- */
-int http_transaction_get_realm(http_transaction_h http_transaction, char **realm);
+  * @}
+  */
 
-/**
- * @}
- */
 
 /**
  * @addtogroup CAPI_NETWORK_HTTP_REQUEST_MODULE
@@ -1002,6 +927,101 @@ int http_transaction_response_get_version(http_transaction_h http_transaction, h
  * @}
  */
 
+/**
+ * @addtogroup CAPI_NETWORK_HTTP_AUTHENTICATION_MODULE
+ * @{
+ */
+
+/**
+ * @brief Opens HTTP transaction with authentication information.
+ * @since_tizen 3.0
+ * @remarks The @a http_auth_transaction should be released using http_transaction_destroy().
+ * @param[in]  http_transaction                The http transaction handle
+ * @param[out] http_auth_transaction The http transaction handle
+ * @return 0 on success, otherwise negative error value
+ * @retval  #HTTP_ERROR_NONE  Successful
+ * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
+ * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
+ */
+int http_transaction_open_authentication(http_transaction_h http_transaction, http_transaction_h *http_auth_transaction);
+
+/**
+ * @brief Sets an HTTP credentials.
+ * @details Set an HTTP authentication scheme such as username and password.
+ * @since_tizen 3.0
+ * @param[in]  http_transaction  The http transaction handle
+ * @param[in]  user_name                The http user name
+ * @param[in]  password                         The http password
+ * @return 0 on success, otherwise negative error value
+ * @retval  #HTTP_ERROR_NONE  Successful
+ * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
+ */
+int http_transaction_set_credentials(http_transaction_h http_transaction, const char *user_name, const char *password);
+
+/**
+ * @brief Gets the username & password for the http credential.
+ * @since_tizen 3.0
+ * @remarks The @a user_name & @a password should be freed using free().
+ * @param[in]  http_transaction  The http transaction handle
+ * @param[out]  user_name               The http credential user name
+ * @param[out] password         The http credential password
+ * @return 0 on success, otherwise negative error value
+ * @retval  #HTTP_ERROR_NONE  Successful
+ * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
+ * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
+ */
+int http_transaction_get_credentials(http_transaction_h http_transaction, char **user_name, char **password);
+
+/**
+ * @brief Sets an HTTP authentication scheme.
+ * @details Set an HTTP authentication scheme such as BASIC, MD5, NTLM and etc.
+ * @since_tizen 3.0
+ * @param[in]  http_transaction  The http transaction handle
+ * @param[in]  auth_scheme                      The http authentication scheme
+ * @return 0 on success, otherwise negative error value
+ * @retval  #HTTP_ERROR_NONE  Successful
+ * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
+ */
+int http_transaction_set_http_auth_scheme(http_transaction_h http_transaction, http_auth_scheme_e auth_scheme);
+
+/**
+ * @brief Gets the HTTP authentication scheme.
+ * @since_tizen 3.0
+ * @param[in]  http_transaction  The http transaction handle
+ * @param[out] auth_scheme      The http auth scheme value
+ * @return 0 on success, otherwise negative error value
+ * @retval  #HTTP_ERROR_NONE  Successful
+ * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
+ * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
+ */
+int http_transaction_get_http_auth_scheme(http_transaction_h http_transaction, http_auth_scheme_e *auth_scheme);
+
+/**
+ * @brief Gets the HTTP authentication realm.
+ * @since_tizen 3.0
+ * @remarks The @a realm should be freed using free().
+ * @param[in]  http_transaction  The http transaction handle
+ * @param[out] realm    The http realm value
+ * @return 0 on success, otherwise negative error value
+ * @retval  #HTTP_ERROR_NONE  Successful
+ * @retval  #HTTP_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #HTTP_ERROR_INVALID_OPERATION  Invalid operation
+ * @retval  #HTTP_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval  #HTTP_ERROR_NOT_SUPPORTED  Not Supported
+ */
+int http_transaction_get_realm(http_transaction_h http_transaction, char **realm);
+
+/**
+ * @}
+ */
+
 #ifdef __cplusplus
  }
 #endif
index b1962bd..e5323c7 100644 (file)
@@ -941,6 +941,9 @@ API int http_transaction_get_realm(http_transaction_h http_transaction, char **r
 
        __http_transaction_h *transaction = (__http_transaction_h *)http_transaction;
 
+       if (transaction->realm == NULL)
+               return HTTP_ERROR_INVALID_OPERATION;
+
        *realm = g_strdup(transaction->realm);
        if (*realm == NULL) {
                ERR("strdup is failed\n");
@@ -992,7 +995,7 @@ API int http_transaction_get_credentials(http_transaction_h http_transaction, ch
        return HTTP_ERROR_NONE;
 }
 
-API int http_open_authentication(http_transaction_h http_transaction, http_transaction_h *http_auth_transaction)
+API int http_transaction_open_authentication(http_transaction_h http_transaction, http_transaction_h *http_auth_transaction)
 {
        _retvm_if(http_transaction == NULL, HTTP_ERROR_INVALID_PARAMETER,
                        "parameter(http_transaction) is NULL\n");
index e064d07..738d6dc 100644 (file)
@@ -69,7 +69,7 @@ void __transaction_completed_cb(http_transaction_h transaction, void *user_data)
                http_transaction_h http_auth_transaction;
                http_auth_scheme_e auth_scheme = HTTP_AUTH_NONE;
 
-               http_open_authentication(transaction, &http_auth_transaction);
+               http_transaction_open_authentication(transaction, &http_auth_transaction);
                http_transaction_get_http_auth_scheme(http_auth_transaction, &auth_scheme);
 
                printf("User ID: ");