}
}
+static bool __profile_ethernet_validate_eap_auth_type(net_dev_info_t *net_info)
+{
+ connection_ethernet_eap_type_e eap_type = net_info->eap.eap_type;
+
+ if (net_info->use_eapol == false)
+ return false;
+
+ if (eap_type != CONNECTION_ETHERNET_EAP_TYPE_PEAP &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_TTLS &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_FAST)
+ return false;
+
+ return true;
+}
+
+static bool __profile_ethernet_validate_eap_identity(net_dev_info_t *net_info)
+{
+ connection_ethernet_eap_type_e eap_type = net_info->eap.eap_type;
+
+ if (net_info->use_eapol == false)
+ return false;
+
+ if (eap_type != CONNECTION_ETHERNET_EAP_TYPE_MD5 &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_PEAP &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_TLS &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_TTLS &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_FAST)
+ return false;
+
+ return true;
+}
+
+static bool __profile_ethernet_validate_eap_anonymous_identity(net_dev_info_t *net_info)
+{
+ connection_ethernet_eap_type_e eap_type = net_info->eap.eap_type;
+
+ if (net_info->use_eapol == false)
+ return false;
+
+ if (eap_type != CONNECTION_ETHERNET_EAP_TYPE_PEAP &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_TTLS &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_FAST)
+ return false;
+
+ return true;
+}
+
+static bool __profile_ethernet_validate_eap_pac_file(net_dev_info_t *net_info)
+{
+ connection_ethernet_eap_type_e eap_type = net_info->eap.eap_type;
+
+ if (net_info->use_eapol == false)
+ return false;
+
+ if (eap_type != CONNECTION_ETHERNET_EAP_TYPE_FAST)
+ return false;
+
+ return true;
+}
+
+static bool __profile_ethernet_validate_eap_peap_version(net_dev_info_t *net_info)
+{
+ connection_ethernet_eap_type_e eap_type = net_info->eap.eap_type;
+
+ if (net_info->use_eapol == false)
+ return false;
+
+ if (eap_type != CONNECTION_ETHERNET_EAP_TYPE_PEAP)
+ return false;
+
+ return true;
+}
+
+static bool __profile_ethernet_validate_eap_private_key_file(net_dev_info_t *net_info)
+{
+ connection_ethernet_eap_type_e eap_type = net_info->eap.eap_type;
+
+ if (net_info->use_eapol == false)
+ return false;
+
+ if (eap_type != CONNECTION_ETHERNET_EAP_TYPE_TLS)
+ return false;
+
+ return true;
+}
+
+static bool __profile_ethernet_validate_eap_client_cert_file(net_dev_info_t *net_info)
+{
+ connection_ethernet_eap_type_e eap_type = net_info->eap.eap_type;
+
+ if (net_info->use_eapol == false)
+ return false;
+
+ if (eap_type != CONNECTION_ETHERNET_EAP_TYPE_TLS)
+ return false;
+
+ return true;
+}
+
+static bool __profile_ethernet_validate_eap_ca_cert_file(net_dev_info_t *net_info)
+{
+ connection_ethernet_eap_type_e eap_type = net_info->eap.eap_type;
+
+ if (net_info->use_eapol == false)
+ return false;
+
+ if (eap_type != CONNECTION_ETHERNET_EAP_TYPE_PEAP &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_TLS &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_TTLS)
+ return false;
+
+ return true;
+}
+
+static bool __profile_ethernet_validate_eap_passphrase(net_dev_info_t *net_info)
+{
+ connection_ethernet_eap_type_e eap_type = net_info->eap.eap_type;
+
+ if (net_info->use_eapol == false)
+ return false;
+
+ if (eap_type != CONNECTION_ETHERNET_EAP_TYPE_MD5 &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_PEAP &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_TTLS &&
+ eap_type != CONNECTION_ETHERNET_EAP_TYPE_FAST)
+ return false;
+
+ return true;
+}
+
static char *__profile_convert_ip_to_string(net_addr_t *ip_addr, connection_address_family_e address_family)
{
unsigned char *ipaddr = NULL;
CONN_UNLOCK;
return CONNECTION_ERROR_NONE;
}
+
+EXPORT_API int connection_profile_is_ethernet_eap_enabled(connection_profile_h profile, bool *enabled)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!(_connection_libnet_check_profile_validity(profile)) ||
+ enabled == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ int ret = _connection_libnet_ethernet_eap_enabled(enabled);
+ if (ret != CONNECTION_ERROR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to get EAP over Ethernet enabled status.");
+ CONN_UNLOCK;
+ return ret;
+ }
+
+ CONNECTION_LOG(CONNECTION_INFO, "EAP over Ethernet enabled status: [%s]", enabled ? "true" : "false");
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_enable_ethernet_eap(connection_profile_h profile, bool enable)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ int ret = _connection_libnet_enable_ethernet_eap(enable, net_info->ProfileName);
+ if (ret != CONNECTION_ERROR_NONE) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Failed to enable EAP over ethernet");
+ CONN_UNLOCK;
+ return ret;
+ }
+
+ net_info->use_eapol = enable;
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_type(connection_profile_h profile,
+ connection_ethernet_eap_type_e type)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (net_info->use_eapol == false) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+ net_info->eap.eap_type = type;
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_type(connection_profile_h profile,
+ connection_ethernet_eap_type_e *type)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) || type == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (net_info->use_eapol == false) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *type = net_info->eap.eap_type;
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_passphrase(connection_profile_h profile,
+ const char *user_name, const char *password)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ user_name == NULL || password == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_passphrase(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ g_strlcpy(net_info->eap.username, user_name, NET_USERNAME_LEN+1);
+ g_strlcpy(net_info->eap.password, password, NET_PASSWORD_LEN+1);
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_passphrase(connection_profile_h profile,
+ char **user_name, bool *is_password_set)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ user_name == NULL || is_password_set == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_passphrase(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *user_name = strdup(net_info->eap.username);
+ if (*user_name == NULL) {
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
+
+ if (strlen(net_info->eap.password) > 0)
+ *is_password_set = true;
+ else
+ *is_password_set = false;
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_identity(connection_profile_h profile,
+ const char *identity)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ identity == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_identity(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ g_strlcpy(net_info->eap.username, identity, NET_USERNAME_LEN+1);
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_identity(connection_profile_h profile,
+ char **identity)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ identity == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_identity(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *identity = strdup(net_info->eap.username);
+ if (*identity == NULL) {
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_ca_cert_file(connection_profile_h profile,
+ const char *file)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ file == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_ca_cert_file(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ g_strlcpy(net_info->eap.ca_cert_filename, file, NET_CA_CERT_FILENAME_LEN+1);
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_ca_cert_file(connection_profile_h profile,
+ char **file)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ file == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_ca_cert_file(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *file = strdup(net_info->eap.ca_cert_filename);
+ if (*file == NULL) {
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_client_cert_file(connection_profile_h profile,
+ const char *file)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ file == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_client_cert_file(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ g_strlcpy(net_info->eap.client_cert_filename, file, NET_CLIENT_CERT_FILENAME_LEN+1);
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_client_cert_file(connection_profile_h profile,
+ char **file)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ file == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_client_cert_file(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *file = strdup(net_info->eap.client_cert_filename);
+ if (*file == NULL) {
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_private_key_file(connection_profile_h profile,
+ char **file)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ file == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_private_key_file(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *file = strdup(net_info->eap.private_key_filename);
+ if (*file == NULL) {
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_private_key_info(connection_profile_h profile,
+ const char *file, const char *password)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ file == NULL || password == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_private_key_file(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ g_strlcpy(net_info->eap.private_key_filename, file, NET_PRIVATE_KEY_FILENAME_LEN+1);
+ g_strlcpy(net_info->eap.private_key_passwd, password, NET_PRIVATE_KEY_PASSWD_LEN+1);
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_anonymous_identity(connection_profile_h profile,
+ const char *anonymous_identity)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ anonymous_identity == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_anonymous_identity(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ g_strlcpy(net_info->eap.anonymous_identity, anonymous_identity, NET_USERNAME_LEN+1);
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_anonymous_identity(connection_profile_h profile,
+ char **anonymous_identity)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ anonymous_identity == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_anonymous_identity(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *anonymous_identity= strdup(net_info->eap.anonymous_identity);
+ if (*anonymous_identity== NULL) {
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_pac_file(connection_profile_h profile,
+ const char *file)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ file == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_pac_file(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ g_strlcpy(net_info->eap.pac_filename, file, NET_PAC_FILENAME_LEN+1);
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_pac_file(connection_profile_h profile,
+ char **file)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) ||
+ file == NULL ) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_pac_file(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *file = strdup(net_info->eap.pac_filename);
+ if (*file == NULL) {
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_OUT_OF_MEMORY;
+ }
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_auth_type(connection_profile_h profile,
+ connection_ethernet_eap_auth_type_e type)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_auth_type(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ net_info->eap.eap_auth = type;
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_auth_type(connection_profile_h profile,
+ connection_ethernet_eap_auth_type_e *type)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) || type == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_auth_type(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *type = net_info->eap.eap_auth;
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_set_ethernet_eap_peap_version(connection_profile_h profile,
+ connection_ethernet_eap_peap_version_e version)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_peap_version(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+ net_info->eap.peap_version= version;
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
+
+EXPORT_API int connection_profile_get_ethernet_eap_peap_version(connection_profile_h profile,
+ connection_ethernet_eap_peap_version_e *version)
+{
+ CONN_LOCK;
+
+ CHECK_FEATURE_SUPPORTED(TELEPHONY_FEATURE, WIFI_FEATURE,
+ TETHERING_BLUETOOTH_FEATURE, ETHERNET_FEATURE);
+
+ if (!_connection_libnet_check_profile_validity(profile) || version == NULL) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ net_profile_info_t *profile_info = profile;
+ net_dev_info_t *net_info = __profile_get_net_info(profile_info);
+
+ if (false == __profile_ethernet_validate_eap_peap_version(net_info)) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_INVALID_OPERATION;
+ }
+
+ *version = net_info->eap.peap_version;
+
+ CONN_UNLOCK;
+ return CONNECTION_ERROR_NONE;
+}
return 1;
}
+int test_ethernet_eap_connect(void)
+{
+ int rv;
+ int input;
+ bool enabled = false;
+ int type = 0;
+ int auth_type = 0;
+ char input_str1[100];
+ char input_str2[100];
+ connection_profile_h profile;
+
+ printf("\n** Choose a ethernet profile to connect. **\n");
+
+ if (test_get_user_selected_profile(&profile, true) == false)
+ return -1;
+
+ test_get_user_int("Input options (0:Use LAN 1:Use EAPoL) :", &input);
+ if (input == 1) {
+ if (connection_profile_enable_ethernet_eap(profile, true) != CONNECTION_ERROR_NONE) {
+ printf("Failed to enable EAP over Ethernet\n");
+ return -1;
+ }
+ } else {
+ printf("Disabling EAPoL. Use proper option for normal Lan connection.\n");
+ if (connection_profile_enable_ethernet_eap(profile, false) != CONNECTION_ERROR_NONE)
+ printf("Failed to disable EAP over Ethernet\n");
+ return -1;
+ }
+
+ if (connection_profile_is_ethernet_eap_enabled(profile, &enabled) != CONNECTION_ERROR_NONE) {
+ printf("Failed to get ethernet eap enabled status!!\n");
+ return -1;
+ }
+
+ printf("EAP over Ethernet is %s\n", enabled ? "enabled" : "not enabled");
+
+ printf("Input EAP type:\n");
+ printf("0 -> CONNECTION_ETHERNET_EAP_TYPE_MD5\n");
+ printf("1 -> CONNECTION_ETHERNET_EAP_TYPE_PEAP\n");
+ printf("2 -> CONNECTION_ETHERNET_EAP_TYPE_TLS\n");
+ printf("3 -> CONNECTION_ETHERNET_EAP_TYPE_TTLS\n");
+ printf("4 -> CONNECTION_ETHERNET_EAP_TYPE_FAST\n");
+ rv = scanf("%d", &type);
+
+ switch (type) {
+ case CONNECTION_ETHERNET_EAP_TYPE_MD5:
+ rv = connection_profile_set_ethernet_eap_type(profile, type);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap type : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input user name for ethernet:");
+ rv = scanf("%99s", input_str1);
+
+ printf("Input password for ethernet:");
+ rv = scanf("%99s", input_str2);
+
+ rv = connection_profile_set_ethernet_eap_passphrase(profile, input_str1, input_str2);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap passphrase : %s\n", test_print_error(rv));
+ return -1;
+ }
+ break;
+
+ case CONNECTION_ETHERNET_EAP_TYPE_TLS:
+ {
+ rv = connection_profile_set_ethernet_eap_type(profile, type);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap type : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input user identity for ethernet:");
+ rv = scanf("%99s", input_str1);
+
+ rv = connection_profile_set_ethernet_eap_identity(profile, input_str1);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap identity : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input user certificate for ethernet:");
+ rv = scanf("%129s", input_str1);
+
+ rv = connection_profile_set_ethernet_eap_client_cert_file(profile, input_str1);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap user cetificate : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input CA certificate for ethernet:");
+ rv = scanf("%129s", input_str1);
+
+ rv = connection_profile_set_ethernet_eap_ca_cert_file(profile, input_str1);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap CA cetificate : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input private key for ethernet:");
+ rv = scanf("%129s", input_str1);
+
+ printf("Input private key password for ethernet:");
+ rv = scanf("%129s", input_str2);
+
+ rv = connection_profile_set_ethernet_eap_private_key_info(profile, input_str1, input_str2);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap private key passphrase : %s\n", test_print_error(rv));
+ return -1;
+ }
+ }
+ break;
+
+ case CONNECTION_ETHERNET_EAP_TYPE_PEAP:
+ {
+ rv = connection_profile_set_ethernet_eap_type(profile, type);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap type : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input anonymous_identity for PEAP ethernet:");
+ rv = scanf("%99s", input_str1);
+
+ rv = connection_profile_set_ethernet_eap_anonymous_identity(profile, input_str1);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap anonymous_identity: %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input CA file for PEAP ethernet:");
+ rv = scanf("%129s", input_str1);
+
+ rv = connection_profile_set_ethernet_eap_ca_cert_file(profile, input_str1);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap CA file : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ int peap_version = 0;
+ printf("Input peap version[ 0 ~ 2] for PEAP ethernet:");
+ rv = scanf("%1d", &peap_version);
+
+ rv = connection_profile_set_ethernet_eap_peap_version(profile, peap_version);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap peap version : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input authentication type[3:MSCHAPV2 4:GTC 5:MD5] for PEAP ethernet:");
+ rv = scanf("%1d", &auth_type);
+
+ rv = connection_profile_set_ethernet_eap_auth_type(profile, auth_type);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap authentication type : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input username for PEAP ethernet:");
+ rv = scanf("%129s", input_str1);
+
+ printf("Input password for PEAP ethernet:");
+ rv = scanf("%129s", input_str2);
+
+ rv = connection_profile_set_ethernet_eap_passphrase(profile, input_str1, input_str2);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap username and password : %s\n", test_print_error(rv));
+ return -1;
+ }
+ }
+ break;
+
+ case CONNECTION_ETHERNET_EAP_TYPE_TTLS:
+ {
+ rv = connection_profile_set_ethernet_eap_type(profile, type);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap type : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input anonymous_identity for TTLS ethernet:");
+ rv = scanf("%99s", input_str1);
+
+ rv = connection_profile_set_ethernet_eap_anonymous_identity(profile, input_str1);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap anonymous_identity: %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input CA file for TTLS ethernet:");
+ rv = scanf("%129s", input_str1);
+
+ rv = connection_profile_set_ethernet_eap_ca_cert_file(profile, input_str1);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap CA file : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input authentication type[1:PAP, 2:MSCHAP, 3:MSCHAPV2] for TTLS ethernet:");
+ rv = scanf("%1d", &auth_type);
+
+ rv = connection_profile_set_ethernet_eap_auth_type(profile, auth_type);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap authentication type : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input username for TTLS ethernet:");
+ rv = scanf("%129s", input_str1);
+
+ printf("Input password for TTLS ethernet:");
+ rv = scanf("%129s", input_str2);
+
+ rv = connection_profile_set_ethernet_eap_passphrase(profile, input_str1, input_str2);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap username and password : %s\n", test_print_error(rv));
+ return -1;
+ }
+ }
+ break;
+
+ case CONNECTION_ETHERNET_EAP_TYPE_FAST:
+ {
+ rv = connection_profile_set_ethernet_eap_type(profile, type);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap type : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input anonymous_identity for FAST ethernet:");
+ rv = scanf("%99s", input_str1);
+
+ rv = connection_profile_set_ethernet_eap_anonymous_identity(profile, input_str1);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap anonymous_identity: %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input pac file for FAST ethernet:");
+ rv = scanf("%129s", input_str1);
+
+ rv = connection_profile_set_ethernet_eap_pac_file(profile, input_str1);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap pac file : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input authentication type[3:MSCHAPV2, 4:GTC] for FAST ethernet:");
+ rv = scanf("%1d", &auth_type);
+
+ rv = connection_profile_set_ethernet_eap_auth_type(profile, auth_type);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap authentication type : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ printf("Input username for FAST ethernet:");
+ rv = scanf("%129s", input_str1);
+
+ printf("Input password for FAST ethernet:");
+ rv = scanf("%129s", input_str2);
+
+ rv = connection_profile_set_ethernet_eap_passphrase(profile, input_str1, input_str2);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to set eap username and password : %s\n", test_print_error(rv));
+ return -1;
+ }
+ }
+ break;
+
+ default:
+ printf("Invalid EAP type\n");
+ return -1;
+ }
+
+ rv = connection_profile_save_ethernet_eap_config(connection, profile);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Fail to save eap config : %s\n", test_print_error(rv));
+ return -1;
+ }
+
+ if (connection_open_profile(connection, profile, test_connection_opened_callback, NULL) != CONNECTION_ERROR_NONE) {
+ printf("Connection open Failed!!\n");
+ return -1;
+ }
+
+ return 1;
+}
+
+static const char *test_print_eap_type(connection_ethernet_eap_type_e type)
+{
+ switch (type) {
+ case CONNECTION_ETHERNET_EAP_TYPE_MD5:
+ return "MD5";
+ case CONNECTION_ETHERNET_EAP_TYPE_PEAP:
+ return "PEAP";
+ case CONNECTION_ETHERNET_EAP_TYPE_TLS:
+ return "TLS";
+ case CONNECTION_ETHERNET_EAP_TYPE_TTLS:
+ return "TTLS";
+ case CONNECTION_ETHERNET_EAP_TYPE_FAST:
+ return "FAST";
+ default:
+ return NULL;
+ }
+}
+
+static const char *test_print_eap_auth_type(connection_ethernet_eap_auth_type_e type)
+{
+ switch (type) {
+ case CONNECTION_ETHERNET_EAP_AUTH_TYPE_PAP:
+ return "PAP";
+ case CONNECTION_ETHERNET_EAP_AUTH_TYPE_MSCHAP:
+ return "MSCHAP";
+ case CONNECTION_ETHERNET_EAP_AUTH_TYPE_MSCHAPV2:
+ return "MSCHAPV2";
+ case CONNECTION_ETHERNET_EAP_AUTH_TYPE_GTC:
+ return "GTC";
+ case CONNECTION_ETHERNET_EAP_AUTH_TYPE_MD5:
+ return "MD5";
+ case CONNECTION_ETHERNET_EAP_AUTH_TYPE_NONE:
+ return "NONE";
+ default:
+ return NULL;
+ }
+}
+
+int test_get_eapol_info(void)
+{
+ connection_profile_type_e prof_type;
+ connection_profile_state_e profile_state;
+ connection_profile_h profile;
+ char *profile_name = NULL;
+ connection_ethernet_eap_type_e type;
+ connection_ethernet_eap_auth_type_e auth_type;
+ connection_ethernet_eap_peap_version_e peapver;
+ char *str = NULL;
+
+ printf("\n** Choose a ethernet profile to print eapol info. **\n");
+ if (test_get_user_selected_profile(&profile, true) == false)
+ return -1;
+
+ if (connection_profile_get_name(profile, &profile_name) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get profile name\n");
+ return -1;
+ } else {
+ printf("Profile Name : %s\n", profile_name);
+ g_free(profile_name);
+ }
+
+ if (connection_profile_get_type(profile, &prof_type) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get profile type\n");
+ return -1;
+ }
+
+ if (prof_type != CONNECTION_PROFILE_TYPE_ETHERNET) {
+ printf("Not ethernet profile\n");
+ return -1;
+ }
+
+ if (connection_profile_get_state(profile, &profile_state) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get profile state\n");
+ return -1;
+ } else
+ printf("Profile State : %s\n", test_print_state(profile_state));
+
+
+ if (connection_profile_get_ethernet_eap_type(profile, &type) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get eap type\n");
+ return -1;
+ } else {
+ printf("eap_type: %s\n", test_print_eap_type(type));
+ }
+
+ if (connection_profile_get_ethernet_eap_identity(profile, &str) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get eap identity\n");
+ return -1;
+ } else {
+ printf("identity: %s\n", str);
+ }
+
+ if (type == CONNECTION_ETHERNET_EAP_TYPE_MD5)
+ goto out;
+
+ if (type == CONNECTION_ETHERNET_EAP_TYPE_PEAP || type == CONNECTION_ETHERNET_EAP_TYPE_TTLS ||
+ type == CONNECTION_ETHERNET_EAP_TYPE_FAST) {
+ if (connection_profile_get_ethernet_eap_anonymous_identity(profile, &str) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get eap anonymous_identity\n");
+ return -1;
+ } else {
+ printf("anonymous_identity: %s\n", str);
+ }
+ }
+
+ if (connection_profile_get_ethernet_eap_ca_cert_file(profile, &str) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get eap ca_cert_file\n");
+ return -1;
+ } else {
+ printf("ca_cert_file: %s\n", str);
+ }
+
+ if (type == CONNECTION_ETHERNET_EAP_TYPE_TLS) {
+ if (connection_profile_get_ethernet_eap_client_cert_file(profile, &str) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get eap client_cert_file\n");
+ return -1;
+ } else {
+ printf("client_cert_file: %s\n", str);
+ }
+
+ if (connection_profile_get_ethernet_eap_private_key_file(profile, &str) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get eap private_key_file\n");
+ return -1;
+ } else {
+ printf("private_key_file: %s\n", str);
+ }
+ }
+
+ if (type == CONNECTION_ETHERNET_EAP_TYPE_PEAP || type == CONNECTION_ETHERNET_EAP_TYPE_TTLS ||
+ type == CONNECTION_ETHERNET_EAP_TYPE_FAST) {
+ if (connection_profile_get_ethernet_eap_auth_type(profile, &auth_type) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get eap auth type\n");
+ return -1;
+ } else {
+ printf("eap_auth: %s\n", test_print_eap_auth_type(auth_type));
+ }
+ }
+
+ if (type == CONNECTION_ETHERNET_EAP_TYPE_PEAP) {
+ if (connection_profile_get_ethernet_eap_peap_version(profile, &peapver) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get eap peap_version\n");
+ return -1;
+ } else {
+ printf("peap_version: %d\n", peapver);
+ }
+ }
+
+ if (type == CONNECTION_ETHERNET_EAP_TYPE_FAST) {
+ if (connection_profile_get_ethernet_eap_pac_file(profile, &str) != CONNECTION_ERROR_NONE) {
+ printf("Fail to get eap pac_file\n");
+ return -1;
+ } else {
+ printf("pac_file: %s\n", str);
+ }
+ }
+
+out:
+ return 1;
+}
+
int main(int argc, char **argv)
{
GMainLoop *mainloop;
printf("P - Get MPTCP Scheduler (internal)\n");
printf(LOG_GREEN "Q - Create Handle and set callbacks in C# API\n" LOG_END);
printf("R - Destroy Handle(unset callbacks automatically in C# API)\n");
+ printf("S - Connect Ethernet EAP)\n");
+ printf("T - Get EAPoL info)\n");
printf(LOG_RED "0 - Exit \n" LOG_END);
printf("ENTER - Show options menu.......\n");
}
case 'R':
rv = test_deregister_client_cs();
break;
+ case 'S':
+ rv = test_ethernet_eap_connect();
+ break;
+ case 'T':
+ rv = test_get_eapol_info();
+ break;
}