From baa733dbec2438cb4ebcc49902722c6599e7c61f Mon Sep 17 00:00:00 2001 From: Niraj Kumar Goit Date: Fri, 3 Apr 2020 10:04:31 +0530 Subject: [PATCH] Added prototype of APIs for EAP over ethernet. Change-Id: Ib561aa5ffbca167ac1614be5ecabf0d69b53da1b Signed-off-by: Niraj Kumar Goit --- include/connection_extension.h | 440 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 440 insertions(+) diff --git a/include/connection_extension.h b/include/connection_extension.h index 18a6545..3086599 100755 --- a/include/connection_extension.h +++ b/include/connection_extension.h @@ -238,6 +238,446 @@ int connection_mptcp_set_scheduler(connection_h connection, connection_mptcp_sch int connection_mptcp_get_scheduler(connection_h connection, connection_mptcp_scheduler_e* scheduler); /** + * @brief Enumeration for EAP type. + * @since_tizen 6.0 + */ +typedef enum { + CONNECTION_ETHERNET_EAP_TYPE_MD5 = 0, /**< EAP MD5 type */ + CONNECTION_ETHERNET_EAP_TYPE_PEAP = 1, /**< EAP PEAP type */ + CONNECTION_ETHERNET_EAP_TYPE_TLS = 2, /**< EAP TLS type */ + CONNECTION_ETHERNET_EAP_TYPE_TTLS = 3, /**< EAP TTLS type */ + CONNECTION_ETHERNET_EAP_TYPE_FAST = 4, /**< EAP FAST type */ +} connection_ethernet_eap_type_e; + +/** + * @brief Enumeration for EAP phase2 authentication type. + * @since_tizen 6.0 + */ +typedef enum { + CONNECTION_ETHERNET_EAP_AUTH_TYPE_NONE = 0, /**< EAP phase2 authentication none */ + CONNECTION_ETHERNET_EAP_AUTH_TYPE_PAP = 1, /**< EAP phase2 authentication PAP */ + CONNECTION_ETHERNET_EAP_AUTH_TYPE_MSCHAP = 2, /**< EAP phase2 authentication MSCHAP */ + CONNECTION_ETHERNET_EAP_AUTH_TYPE_MSCHAPV2 = 3, /**< EAP phase2 authentication MSCHAPv2 */ + CONNECTION_ETHERNET_EAP_AUTH_TYPE_GTC = 4, /**< EAP phase2 authentication GTC */ + CONNECTION_ETHERNET_EAP_AUTH_TYPE_MD5 = 5, /**< EAP phase2 authentication MD5 */ +} connection_ethernet_eap_auth_type_e; + +/** + * @brief Enumeration for PEAP version. + * @since_tizen 6.0 + */ +typedef enum { + CONNECTION_ETHERNET_EAP_PEAP_VERSION_AUTO = 0, /**< PEAP version Automatic */ + CONNECTION_ETHERNET_EAP_PEAP_VERSION_0 = 1, /**< PEAP version 0 */ + CONNECTION_ETHERNET_EAP_PEAP_VERSION_1 = 2, /**< PEAP version 1 */ +} connection_ethernet_eap_peap_version_e; + +/** + * @brief Called for each found ethernet configuration. + * @since_tizen 6.0 + * @param[in] profile The profile handle + * @param[in] user_data The user data passed from the request function + * @return @c true to continue with the next iteration of the loop, otherwise @c false to break out of the loop \n + * @pre connection_profile_foreach_ethernet_eap_config() will invoke this callback. + * @see connection_profile_foreach_ethernet_eap_config() + */ +typedef bool (*connection_profile_list_cb)(connection_profile_h profile, void *user_data); + +/** + * @brief Gets configurations of an ethernet. + * @since_tizen 6.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile + * + * @param[in] connection The connection handle + * @param[in] callback The callback to be called + * @param[in] user_data The user data passed to the callback function + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + * @pre This function needs connection_create() before use. + * @post This function invokes connection_profile_list_cb(). + */ +int connection_profile_foreach_ethernet_eap_config(connection_h connection, + connection_profile_list_cb callback, void *user_data); + +/** + * @brief Enable EAP over ethernet network + * @since_tizen 6.0 + * @param[in] profile The profile handle + * @param[in] enable The flag to enable or disable EAP over ethernet + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation Failed + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_enable_ethernet_eap(connection_profile_h profile, bool enable); + +/** + * @brief Check if EAP over ethernet is enabled. + * @since_tizen 6.0 + * @param[in] profile The profile handle + * @param[out] enabled true if EAP over ethernet is enabled, false otherwise + * @return @c 0 on success, otherwise a negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied + * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation Failed + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_is_ethernet_eap_enabled(connection_profile_h profile, bool *enabled); + +/** + * @brief Sets the EAP type of ethernet. + * @since_tizen 6.0 + * @param[in] profile The profile handle + * @param[in] type The type of EAP + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_type(connection_profile_h profile, connection_ethernet_eap_type_e type); + +/** + * @brief Gets the EAP type of ethernet. + * @since_tizen 6.0 + * @param[in] profile The profile handle + * @param[out] type The type of EAP + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_type(connection_profile_h profile, connection_ethernet_eap_type_e *type); + +/** + * @brief Sets the type of EAP phase2 authentication of ethernet. + * @since_tizen 6.0 + * @param[in] profile The profile handle + * @param[in] type The type of EAP phase2 authentication + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_auth_type(connection_profile_h profile, + connection_ethernet_eap_auth_type_e type); + +/** + * @brief Gets the type of EAP phase2 authentication of ethernet. + * @since_tizen 6.0 + * @param[in] profile The profile handle + * @param[out] type The type of EAP phase2 authentication + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_auth_type(connection_profile_h profile, + connection_ethernet_eap_auth_type_e *type); + +/** + * @brief Sets anonymous identity of EAP over ethernet. + * @since_tizen 6.0 + * @param[in] profile The profile handle + * @param[in] anonymous_identity The anonymous identity + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_anonymous_identity(connection_profile_h profile, + const char *anonymous_identity); + +/** + * @brief Gets anonymous identity of EAP over ethernet. + * @since_tizen 6.0 + * @remarks You must release @a anonymous_identity using free(). + * @param[in] profile The profile handle + * @param[out] anonymous_identity The anonymous identity of ethernet. + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_anonymous_identity(connection_profile_h profile, + char **anonymous_identity); + +/** + * @brief Sets the CA Certificate of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_TLS, + * #CONNECTION_ETHERNET_EAP_TYPE_TTLS or #CONNECTION_ETHERNET_EAP_TYPE_PEAP. + * @param[in] profile The profile handle + * @param[in] file The file path of CA Certificate + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_ca_cert_file(connection_profile_h profile, const char *file); + +/** + * @brief Gets the CA Certificate of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_TLS, + * #CONNECTION_ETHERNET_EAP_TYPE_TTLS or #CONNECTION_ETHERNET_EAP_TYPE_PEAP. + * You must release @a file using free(). + * @param[in] profile The profile handle + * @param[out] file The file path of CA Certificate + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_ca_cert_file(connection_profile_h profile, char **file); + +/** + * @brief Sets the Client Certificate of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_TLS. + * @param[in] profile The profile handle + * @param[out] file The file path of Client Certificate + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_client_cert_file(connection_profile_h profile, const char *file); + +/** + * @brief Gets the Client Certificate of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_TLS. + * You must release @a file using free(). + * @param[in] profile The profile handle + * @param[out] file The file path of Client Certificate + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_client_cert_file(connection_profile_h profile, char **file); + +/** + * @brief Sets the PAC file of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_FAST. + * @param[in] profile The profile handle + * @param[out] file The path of PAC file + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_pac_file(connection_profile_h profile, const char *file); + +/** + * @brief Gets the PAC file of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_FAST. + * You must release @a file using free(). + * @param[in] profile The profile handle + * @param[out] file The path of PAC file + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_pac_file(connection_profile_h profile, char **file); + +/** + * @brief Sets the version of EAP-PEAP of ethernet. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_PEAP. + * @param[in] profile The profile handle + * @param[in] version The version of EAP-PEAP. + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_peap_version(connection_profile_h profile, + connection_ethernet_eap_peap_version_e version); + +/** + * @brief Gets the version of EAP-PEAP of ethernet. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_PEAP. + * @param[in] profile The profile handle + * @param[out] version The version of EAP-PEAP. + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_peap_version(connection_profile_h profile, + connection_ethernet_eap_peap_version_e *version); + +/** + * @brief Sets the identity of EAP over ethernet. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_TLS. + * @param[in] profile The profile handle + * @param[in] identity The identity + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_identity(connection_profile_h profile, const char *identity); + +/** + * @brief Gets the identity of EAP over ethernet. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_TLS. + * You must release @a identity using free(). + * @param[in] profile The profile handle + * @param[out] identity The identity of ethernet. + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_identity(connection_profile_h profile, char **identity); + +/** + * @brief Sets the private key information of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_TLS. + * @param[in] profile The profile handle + * @param[in] file The file path of private key + * @param[in] password The password + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_private_key_info(connection_profile_h profile, + const char *file, const char *password); +/** + * @brief Gets the private key file of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_TLS. + * You must release @a file using free(). + * @param[in] profile The profile handle + * @param[out] file The file path of private key + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_private_key_file(connection_profile_h profile, char **file); + +/** + * @brief Sets the user name and passphrase of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_MD5, + * #CONNECTION_ETHERNET_EAP_TYPE_PEAP, #CONNECTION_ETHERNET_EAP_TYPE_TTLS or #CONNECTION_ETHERNET_EAP_TYPE_FAST. + * @param[in] profile The profile handle + * @param[in] user_name The user name + * @param[in] password The password + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_set_ethernet_eap_passphrase(connection_profile_h profile, + const char *user_name, const char *password); + +/** + * @brief Gets the username and password status of EAP. + * @since_tizen 6.0 + * @remarks This function is valid only if the EAP type is #CONNECTION_ETHERNET_EAP_TYPE_MD5, + * #CONNECTION_ETHERNET_EAP_TYPE_PEAP, #CONNECTION_ETHERNET_EAP_TYPE_TTLS or #CONNECTION_ETHERNET_EAP_TYPE_FAST. + * You must release @a user_name using free(). + * @param[in] profile The profile handle + * @param[out] user_name The user name + * @param[out] is_password_set @c true if password is set, + * otherwise @c false if password is not set. + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + */ +int connection_profile_get_ethernet_eap_passphrase(connection_profile_h profile, + char **user_name, bool *is_password_set); + +/** + * @brief Removes configuration of ethernet profile. + * @since_tizen 6.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile + * + * @param[in] connection The connection handle + * @param[in] profile The profile handle + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + * @see connection_profile_create() + * @see connection_profile_foreach_ethernet_eap_config() + */ +int connection_profile_remove_ethernet_eap_config(connection_h connection, + connection_profile_h profile); + +/** + * @brief Saves configuration of ethernet profile. + * @details When a configuration is changed, these changes will be not applied to the Connection Manager immediately.\n + * When you call this function, your changes affect the Connection Manager and the existing configuration is updated. + * @since_tizen 6.0 + * @privlevel public + * @privilege %http://tizen.org/privilege/network.profile + * + * @param[in] connection The connection handle + * @param[in] profile The profile handle + * @return 0 on success, otherwise negative error value + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied + * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported + * @see connection_profile_create() + */ +int connection_profile_save_ethernet_eap_config(connection_h connection, + connection_profile_h profile); + +/** * @} */ -- 2.7.4