Below changes are applied
[platform/core/api/tethering.git] / include / tethering.h
index 8236c66..71fa7b3 100644 (file)
@@ -18,6 +18,7 @@
 #define __TIZEN_NETWORK_TETHERING_H__
 
 #include <tizen.h>
+#include <time.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -38,12 +39,14 @@ typedef void * tethering_h;
  */
 typedef enum {
     TETHERING_ERROR_NONE = TIZEN_ERROR_NONE,  /**< Successful */
+    TETHERING_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED,  /**< Operation not permitted */
     TETHERING_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid parameter */
     TETHERING_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,  /**< Out of memory */
     TETHERING_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,  /**< Resource busy */
     TETHERING_ERROR_NOT_ENABLED = TIZEN_ERROR_NETWORK_CLASS | 0x0501,  /**< Not enabled */
     TETHERING_ERROR_OPERATION_FAILED = TIZEN_ERROR_NETWORK_CLASS | 0x0502,  /**< Operation failed */
     TETHERING_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
+    TETHERING_ERROR_NOT_SUPPORT_API = TIZEN_ERROR_NOT_SUPPORT_API, /**< API is not supported */
 } tethering_error_e;
 
 /**
@@ -181,6 +184,32 @@ typedef bool(*tethering_connected_client_cb)(tethering_client_h client, void *us
 typedef void (*tethering_data_usage_cb)(tethering_error_e result, unsigned long long received_data, unsigned long long sent_data, void *user_data);
 
 /**
+ * @brief  Called when the security type of Wi-Fi tethering is changed
+ * @param[in]  changed_type  The changed security type of Wi-Fi tethering
+ * @param[in]  user_data  The user data passed from the register function
+ * @see        tethering_wifi_set_security_type_changed_cb()
+ * @see        tethering_wifi_unset_security_type_changed_cb()
+ */
+typedef void (*tethering_wifi_security_type_changed_cb)(tethering_wifi_security_type_e changed_type, void *user_data);
+
+/**
+ * @brief  Called when the visibility of SSID is changed
+ * @param[in]  changed_visible  The changed visibility of SSID
+ * @param[in]  user_data  The user data passed from the register function
+ * @see        tethering_wifi_set_ssid_visibility_changed_cb()
+ * @see        tethering_wifi_unset_ssid_visibility_changed_cb()
+ */
+typedef void (*tethering_wifi_ssid_visibility_changed_cb)(bool changed_visible, void *user_data);
+
+/**
+ * @brief  Called when the passphrase of Wi-Fi tethering is changed
+ * @param[in]  user_data  The user data passed from the register function
+ * @see        tethering_wifi_set_passphrase_changed_cb()
+ * @see        tethering_wifi_unset_passphrase_changed_cb()
+ */
+typedef void (*tethering_wifi_passphrase_changed_cb)(void *user_data);
+
+/**
  * @brief  Creates the handle of tethering.
  * @remarks  The @a tethering must be released tethering_destroy() by you.
  * @param[out]  tethering  A handle of a new mobile ap handle on success
@@ -188,6 +217,7 @@ typedef void (*tethering_data_usage_cb)(tethering_error_e result, unsigned long
  * @retval  #TETHERING_ERROR_NONE  Successful
  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
+ * @retval  #TETHERING_ERROR_NOT_SUPPORT_API  API is not supported
  * @see  tethering_destroy()
  */
 int tethering_create(tethering_h *tethering);
@@ -345,7 +375,7 @@ int tethering_get_subnet_mask(tethering_h tethering, tethering_type_e type, teth
 int tethering_get_data_usage(tethering_h tethering, tethering_data_usage_cb callback, void *user_data);
 
 /**
- * @brief Gets the client which is connected by USB tethering.
+ * @brief Gets the clients which are connected.
  * @param[in]  tethering  The handle of tethering
  * @param[in]  type  The type of tethering
  * @param[in]  callback  The callback function to invoke
@@ -361,6 +391,27 @@ int tethering_get_data_usage(tethering_h tethering, tethering_data_usage_cb call
 int tethering_foreach_connected_clients(tethering_h tethering, tethering_type_e type, tethering_connected_client_cb callback, void *user_data);
 
 /**
+ * @brief Set the ip forward status
+ * @param[in]  tethering  The handle of tethering
+ * @param[in]  status  The ip forward status: (@c true = enable, @c false = disable)
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_get_ip_forward_status()
+ */
+int tethering_set_ip_forward_status(tethering_h tethering, bool status);
+
+/**
+ * @brief Get the ip forward status
+ * @param[in]  tethering  The handle of tethering
+ * @param[out]  status  The ip forward status: (@c true = enable, @c false = disable)
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
+ * @see  tethering_set_ip_forward_status()
+ */
+int tethering_get_ip_forward_status(tethering_h tethering, bool *status);
+
+/**
  * @brief Registers the callback function called when tethering is enabled.
  * @param[in]  tethering  The handle of tethering
  * @param[in]  type  The type of tethering
@@ -427,6 +478,67 @@ int tethering_set_connection_state_changed_cb(tethering_h tethering, tethering_t
 int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethering_type_e type);
 
 /**
+ * @brief Registers the callback function called when the security type of Wi-Fi tethering is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @param[in]  callback  The callback function to invoke
+ * @param[in]  user_data  The user data to be passed to the callback function
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_unset_security_type_changed_cb()
+ */
+int tethering_wifi_set_security_type_changed_cb(tethering_h tethering, tethering_wifi_security_type_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function called when the security type of Wi-Fi tethering is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @param[in]  type  The type of tethering
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_set_security_type_changed_cb()
+ */
+int tethering_wifi_unset_security_type_changed_cb(tethering_h tethering);
+
+/**
+ * @brief Registers the callback function called when the visibility of SSID is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @param[in]  callback  The callback function to invoke
+ * @param[in]  user_data  The user data to be passed to the callback function
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_unset_ssid_visibility_changed_cb_cb()
+ */
+int tethering_wifi_set_ssid_visibility_changed_cb(tethering_h tethering, tethering_wifi_ssid_visibility_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function called when the visibility of SSID is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_set_ssid_visibility_changed_cb()
+ */
+int tethering_wifi_unset_ssid_visibility_changed_cb(tethering_h tethering);
+
+/**
+ * @brief Registers the callback function called when the passphrase of Wi-Fi tethering is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @param[in]  callback  The callback function to invoke
+ * @param[in]  user_data  The user data to be passed to the callback function
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_unset_passphrase_changed_cb()
+ */
+int tethering_wifi_set_passphrase_changed_cb(tethering_h tethering, tethering_wifi_passphrase_changed_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function called when the passphrase of Wi-Fi tethering is changed.
+ * @param[in]  tethering  The handle of tethering
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_wifi_set_passphrase_changed_cb()
+ */
+int tethering_wifi_unset_passphrase_changed_cb(tethering_h tethering);
+
+/**
  * @}
  */
 
@@ -438,16 +550,13 @@ int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethering
 
 /**
  * @brief Sets the security type of Wi-Fi tethering.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @param[in]  tethering  The handle of tethering
  * @param[in]  type  The security type
  * @return 0 on success, otherwise negative error value.
  * @retval  #TETHERING_ERROR_NONE  Successful
  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_security_type()
  */
 int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
@@ -465,6 +574,19 @@ int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_secur
 int tethering_wifi_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
 
 /**
+ * @brief Sets the SSID (service set identifier).
+ * @details If SSID is not set, Device name is used as SSID
+ * @remarks This change is applied next time Wi-Fi tethering is enabled with same @a tethering handle
+ * @param[in]  tethering  The handle of tethering
+ * @param[out]  ssid  The SSID
+ * @return 0 on success, otherwise negative error value.
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval  #TETHERING_ERROR_OUT_OF_MEMORY  Out of memory
+ */
+int tethering_wifi_set_ssid(tethering_h tethering, const char *ssid);
+
+/**
  * @brief Gets the SSID (service set identifier).
  * @remarks @a ssid must be released with free() by you.
  * @param[in]  tethering  The handle of tethering
@@ -480,16 +602,13 @@ int tethering_wifi_get_ssid(tethering_h tethering, char **ssid);
 /**
  * @brief Sets the visibility of SSID(service set identifier).
  * @details If you set the visibility invisible, then the SSID of this device is hidden. So, Wi-Fi scan can't find your device.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @param[in]  tethering  The handle of tethering
  * @param[in]  visible  The visibility of SSID: (@c true = visible, @c false = invisible)
  * @return 0 on success, otherwise negative error value.
  * @retval  #TETHERING_ERROR_NONE  Successful
  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_ssid_visibility()
  */
 int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible);
@@ -509,16 +628,13 @@ int tethering_wifi_get_ssid_visibility(tethering_h tethering, bool *visible);
 
 /**
  * @brief Sets the passphrase.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @param[in]  tethering  The handle of tethering
  * @param[in]  passphrase  The passphrase
  * @return 0 on success, otherwise negative error value.
  * @retval  #TETHERING_ERROR_NONE  Successful
  * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_passphrase()
  */
 int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphrase);
@@ -626,6 +742,18 @@ int tethering_client_get_ip_address(tethering_client_h client, tethering_address
 int tethering_client_get_mac_address(tethering_client_h client, char **mac_address);
 
 /**
+ * @brief  Gets the connection time of client.
+ * @param[in]  client  The handle of client
+ * @param[out]  time  The connected time of client
+ * @return  0 on success, otherwise a negative error value.
+ * @retval  #TETHERING_ERROR_NONE  Successful
+ * @retval  #TETHERING_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @see  tethering_usb_get_connected_client()
+ * @see  tethering_connection_state_changed_cb()
+ */
+int tethering_client_get_time(tethering_client_h client, time_t *timestamp);
+
+/**
  * @}
  */