Add P2P tethering interface details 60/238660/3
authorNishant Chaprana <n.chaprana@samsung.com>
Thu, 16 Jul 2020 05:43:03 +0000 (11:13 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Thu, 16 Jul 2020 10:19:36 +0000 (15:49 +0530)
Change-Id: Id3bfec99db93090039daa4fab85f2c1c0e734c76
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
include/tethering_private.h
packaging/capi-network-tethering.spec
src/tethering.c
tests/tethering-gtest-common.cpp

index 69e12bf..ff6e579 100644 (file)
@@ -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 */
index a07a678..a2ebc2d 100644 (file)
@@ -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
index bf4551c..9d76233 100755 (executable)
@@ -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;
index 135f7a7..d97055b 100755 (executable)
@@ -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)