From: Nishant Chaprana Date: Thu, 16 Jul 2020 05:43:03 +0000 (+0530) Subject: Add P2P tethering interface details X-Git-Tag: submit/tizen/20200824.065557~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7178dd7de0707c68ed4d55bcbdf3764f7e7cb66d;p=platform%2Fcore%2Fapi%2Ftethering.git Add P2P tethering interface details Change-Id: Id3bfec99db93090039daa4fab85f2c1c0e734c76 Signed-off-by: Nishant Chaprana --- diff --git a/include/tethering_private.h b/include/tethering_private.h index 69e12bf..ff6e579 100644 --- a/include/tethering_private.h +++ b/include/tethering_private.h @@ -229,6 +229,9 @@ typedef enum { #define TETHERING_BT_IF "bnep0" #define TETHERING_BT_GATEWAY "192.168.130.1" +#define TETHERING_P2P_IF "p2p0" +#define TETHERING_P2P_GATEWAY "192.168.49.1" + #define TETHERING_WIFI_SSID_MAX_LEN 32 /**< Maximum length of ssid */ #define TETHERING_WIFI_KEY_MIN_LEN 8 /**< Minimum length of wifi key */ #define TETHERING_WIFI_KEY_MAX_LEN 64 /**< Maximum length of wifi key */ diff --git a/packaging/capi-network-tethering.spec b/packaging/capi-network-tethering.spec index a07a678..a2ebc2d 100644 --- a/packaging/capi-network-tethering.spec +++ b/packaging/capi-network-tethering.spec @@ -1,6 +1,6 @@ Name: capi-network-tethering Summary: Tethering Framework -Version: 1.0.57 +Version: 1.0.58 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/tethering.c b/src/tethering.c index bf4551c..9d76233 100755 --- a/src/tethering.c +++ b/src/tethering.c @@ -1193,6 +1193,9 @@ static bool __get_intf_name(tethering_type_e type, char *buf, unsigned int len) case TETHERING_TYPE_BT: g_strlcpy(buf, TETHERING_BT_IF, len); break; + case TETHERING_TYPE_P2P: + g_strlcpy(buf, TETHERING_P2P_IF, len); + break; default: ERR("Not supported type : %d\n", type); return false; @@ -1214,6 +1217,9 @@ static bool __get_gateway_addr(tethering_type_e type, char *buf, unsigned int le case TETHERING_TYPE_BT: g_strlcpy(buf, TETHERING_BT_GATEWAY, len); break; + case TETHERING_TYPE_P2P: + g_strlcpy(buf, TETHERING_P2P_GATEWAY, len); + break; default: ERR("Not supported type : %d\n", type); return false; diff --git a/tests/tethering-gtest-common.cpp b/tests/tethering-gtest-common.cpp index 135f7a7..d97055b 100755 --- a/tests/tethering-gtest-common.cpp +++ b/tests/tethering-gtest-common.cpp @@ -190,6 +190,10 @@ TEST_F(TetheringTest, GetNetworkInterfaceNameP) EXPECT_EQ(TETHERING_ERROR_NONE, tethering_get_network_interface_name(handle, TETHERING_TYPE_BT, &interface_name)); free(interface_name); + + EXPECT_EQ(TETHERING_ERROR_NONE, + tethering_get_network_interface_name(handle, TETHERING_TYPE_P2P, &interface_name)); + free(interface_name); } TEST_F(TetheringTest, GetIpAddressN) @@ -239,6 +243,11 @@ TEST_F(TetheringTest, GetIpAddressP) tethering_get_ip_address(handle, TETHERING_TYPE_BT, TETHERING_ADDRESS_FAMILY_IPV4, &ip)); free(ip); + + EXPECT_EQ(TETHERING_ERROR_NONE, + tethering_get_ip_address(handle, TETHERING_TYPE_P2P, + TETHERING_ADDRESS_FAMILY_IPV4, &ip)); + free(ip); } TEST_F(TetheringTest, GetGatewayAddressN) @@ -288,6 +297,11 @@ TEST_F(TetheringTest, GetGatewayAddressP) tethering_get_gateway_address(handle, TETHERING_TYPE_BT, TETHERING_ADDRESS_FAMILY_IPV4, &gateway)); free(gateway); + + EXPECT_EQ(TETHERING_ERROR_NONE, + tethering_get_gateway_address(handle, TETHERING_TYPE_P2P, + TETHERING_ADDRESS_FAMILY_IPV4, &gateway)); + free(gateway); } TEST_F(TetheringTest, GetSubnetMaskN) @@ -337,6 +351,11 @@ TEST_F(TetheringTest, GetSubnetMaskP) tethering_get_subnet_mask(handle, TETHERING_TYPE_BT, TETHERING_ADDRESS_FAMILY_IPV4, &subnetmask)); free(subnetmask); + + EXPECT_EQ(TETHERING_ERROR_NONE, + tethering_get_subnet_mask(handle, TETHERING_TYPE_P2P, + TETHERING_ADDRESS_FAMILY_IPV4, &subnetmask)); + free(subnetmask); } TEST_F(TetheringTest, ForeachConnectedClientsN)