Add new methods
authorchleun.moon <chleun.moon@samsung.com>
Tue, 11 Apr 2017 06:31:29 +0000 (15:31 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Mon, 8 May 2017 02:07:43 +0000 (11:07 +0900)
1. Change ConnectionProfile.State --> ConnectionProfile.GetState(AddressFamily family)
2. Add PrefixLength to IAddressInformation
3. Add DnsConfigType to IAddressInformation
4. Add GetStatistics() and ResetStatistics() to ConnectionManager
5. Add Refresh() to ConnectionProfile
6. Add PdnType and RoamPdnType to CellularProfile
7. Add GetAllIPv6Addresses() to ConnectionManager

Change-Id: I99b67847b8b508aff8352cb8f0f5f6cce9e37326
Signed-off-by: cheoleun <chleun.moon@samsung.com>
packaging/csapi-network-connection.spec
src/Tizen.Network.Connection/Interop/Interop.Connection.cs
src/Tizen.Network.Connection/Tizen.Network.Connection.project.json
src/Tizen.Network.Connection/Tizen.Network.Connection/CellularProfile.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionError.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfileManager.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionTypes.cs
src/Tizen.Network.Connection/Tizen.Network.Connection/IAddressInformation.cs

index abc7968..a497e6d 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       csapi-network-connection
 Summary:    Tizen Connection API for C#
-Version:    1.0.13
+Version:    1.0.14
 Release:    1
 Group:      Development/Libraries
 License:    Apache-2.0
index 097da6b..5563025 100755 (executable)
@@ -30,6 +30,8 @@ internal static partial class Interop
         public delegate void ConnectionAddressChangedCallback(IntPtr ipv4, IntPtr ipv6, IntPtr userData);
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         public delegate void ConnectionCallback(ConnectionError result, IntPtr userData);
+        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+        public delegate bool IPv6AddressCallback(IntPtr ipv6, IntPtr userData);
 
         [DllImport(Libraries.Connection, EntryPoint = "connection_create")]
         public static extern int Create(out IntPtr handle);
@@ -43,6 +45,9 @@ internal static partial class Interop
         [DllImport(Libraries.Connection, EntryPoint = "connection_get_ip_address")]
         public static extern int GetIPAddress(IntPtr handle, int family, out IntPtr address);
 
+        [DllImport(Libraries.Connection, EntryPoint = "connection_foreach_ipv6_address")]
+        public static extern int GetAllIPv6Addresses(IntPtr handle, int type, IPv6AddressCallback callback, IntPtr userData);
+
         [DllImport(Libraries.Connection, EntryPoint = "connection_get_proxy")]
         public static extern int GetProxy(IntPtr handle, int family, out IntPtr address);
 
@@ -64,6 +69,12 @@ internal static partial class Interop
         [DllImport(Libraries.Connection, EntryPoint = "connection_get_bt_state")]
         public static extern int GetBtState(IntPtr handle, out int state);
 
+        [DllImport(Libraries.Connection, EntryPoint = "connection_get_statistics")]
+        public static extern int GetStatistics(IntPtr handle, int connectionType, int statisticsType, out long size);
+
+        [DllImport(Libraries.Connection, EntryPoint = "connection_reset_statistics")]
+        public static extern int ResetStatistics(IntPtr handle, int connectionType, int statisticsType);
+
         [DllImport(Libraries.Connection, EntryPoint = "connection_set_type_changed_cb")]
         public static extern int SetTypeChangedCallback(IntPtr handle, ConnectionTypeChangedCallback callback, IntPtr userData);
 
@@ -157,6 +168,9 @@ internal static partial class Interop
         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_state")]
         public static extern int GetState(IntPtr profileHandle, out int type);
 
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_ipv6_state")]
+        public static extern int GetIPv6State(IntPtr profileHandle, out int type);
+
         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_ip_config_type")]
         public static extern int GetIPConfigType(IntPtr profileHandle, int family, out int type);
 
@@ -178,6 +192,15 @@ internal static partial class Interop
         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_proxy_address")]
         public static extern int GetProxyAddress(IntPtr profileHandle, int family, out IntPtr address);
 
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_prefix_length")]
+        public static extern int GetPrefixLength(IntPtr profileHandle, int family, out int length);
+
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_dns_config_type")]
+        public static extern int GetDnsConfigType(IntPtr profileHandle, int family, out int type);
+
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_refresh")]
+        public static extern int Refresh(IntPtr profileHandle);
+
         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_ip_config_type")]
         public static extern int SetIPConfigType(IntPtr profileHandle, int family, int type);
 
@@ -199,6 +222,12 @@ internal static partial class Interop
         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_proxy_address")]
         public static extern int SetProxyAddress(IntPtr profileHandle, int family, string address);
 
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_prefix_length")]
+        public static extern int SetPrefixLength(IntPtr profileHandle, int family, int length);
+
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_dns_config_type")]
+        public static extern int SetDnsConfigType(IntPtr profileHandle, int family, int type);
+
         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_state_changed_cb")]
         public static extern int SetStateChangeCallback(IntPtr profileHandle, ProfileStateChangedCallback callback, IntPtr userData);
 
@@ -220,6 +249,12 @@ internal static partial class Interop
         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_home_url")]
         public static extern int GetHomeUrl(IntPtr profileHandle, out IntPtr homeUrl);
 
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_pdn_type")]
+        public static extern int GetPdnType(IntPtr profileHandle, out int pdnType);
+
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_roam_pdn_type")]
+        public static extern int GetRoamingPdnType(IntPtr profileHandle, out int roamPdnType);
+
         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_roaming")]
         public static extern int IsRoaming(IntPtr profileHandle, out bool roaming);
 
@@ -244,6 +279,11 @@ internal static partial class Interop
         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_home_url")]
         public static extern int SetHomeUrl(IntPtr profileHandle, string homeUrl);
 
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_pdn_type")]
+        public static extern int SetPdnType(IntPtr profileHandle, int pdnType);
+
+        [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_roam_pdn_type")]
+        public static extern int SetRoamingPdnType(IntPtr profileHandle, int roamPdnType);
     }
 
     internal static partial class ConnectionWiFiProfile
index e454711..416e53e 100755 (executable)
@@ -1,8 +1,8 @@
-{
+{
   "dependencies": {
-    "NETStandard.Library": "1.6.0",
+    "NETStandard.Library": "1.6.1",
     "System.Threading.Thread": "4.0.0",
-    "Tizen": "1.0.2"
+    "Tizen": "1.0.3"
   },
   "frameworks": {
     "netstandard1.3": {}
index 628cc33..855f5bf 100755 (executable)
@@ -122,6 +122,78 @@ namespace Tizen.Network.Connection
         }
 
         /// <summary>
+        /// The cellular pdn type.
+        /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
+        /// <exception cref="System.ObjectDisposedException">Thrown when operation is performed on a disposed object.</exception>
+        public CellularPdnType PdnType
+        {
+            get
+            {
+                Log.Debug(Globals.LogTag, "Get PdnType");
+                int value;
+                int ret = Interop.ConnectionCellularProfile.GetPdnType(ProfileHandle, out value);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to get pdn type, " + (ConnectionError)ret);
+                }
+                return (CellularPdnType)value;
+            }
+
+            set
+            {
+                Log.Debug(Globals.LogTag, "Set PdnType");
+                CheckDisposed();
+                int ret = Interop.ConnectionCellularProfile.SetPdnType(ProfileHandle, (int)value);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to set pdn type, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
+                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                }
+            }
+        }
+
+        /// <summary>
+        /// The cellular roaming pdn type.
+        /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
+        /// <exception cref="System.ObjectDisposedException">Thrown when operation is performed on a disposed object.</exception>
+        public CellularPdnType RoamingPdnType
+        {
+            get
+            {
+                Log.Debug(Globals.LogTag, "Get RoamingPdnType");
+                int value;
+                int ret = Interop.ConnectionCellularProfile.GetRoamingPdnType(ProfileHandle, out value);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to get roam pdn type, " + (ConnectionError)ret);
+                }
+                return (CellularPdnType)value;
+            }
+
+            set
+            {
+                Log.Debug(Globals.LogTag, "Set RoamingPdnType");
+                CheckDisposed();
+                int ret = Interop.ConnectionCellularProfile.SetRoamingPdnType(ProfileHandle, (int)value);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to set roam pdn type, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
+                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                }
+            }
+        }
+
+        /// <summary>
         /// Gets cellular Authentification Information.
         /// </summary>
         public CellularAuthInformation CellularAuthInfo
index be0e5dc..9e8d587 100755 (executable)
@@ -24,7 +24,34 @@ namespace Tizen.Network.Connection
 {
     internal static class ConnectionErrorFactory
     {
-        internal static void ThrowConnectionException(int errno)
+        internal static void CheckFeatureUnsupportedException(int err, string message)
+        {
+            if ((ConnectionError)err == ConnectionError.NotSupported)
+            {
+                ThrowConnectionException(err, message);
+            }
+        }
+
+        internal static void CheckPermissionDeniedException(int err, string message)
+        {
+            if ((ConnectionError)err == ConnectionError.PermissionDenied)
+            {
+                ThrowConnectionException(err, message);
+            }
+        }
+
+        internal static void CheckHandleNullException(int err, bool isHandleInvalid, string message)
+        {
+            if ((ConnectionError)err == ConnectionError.InvalidParameter)
+            {
+                if (isHandleInvalid)
+                {
+                    ThrowConnectionException((int)ConnectionError.InvalidOperation, message);
+                }
+            }
+        }
+
+        internal static void ThrowConnectionException(int errno , string message = "")
         {
             ConnectionError _error = (ConnectionError)errno;
             Log.Debug(Globals.LogTag, "ThrowConnectionException " + _error);
@@ -41,15 +68,15 @@ namespace Tizen.Network.Connection
                 case ConnectionError.InvalidKey:
                     throw new InvalidOperationException("Invalid Key");
                 case ConnectionError.InvalidOperation:
-                    throw new InvalidOperationException("Invalid Operation");
+                    throw new InvalidOperationException("Invalid Operation " + message);
                 case ConnectionError.InvalidParameter:
-                    throw new InvalidOperationException("Invalid Parameter");
+                    throw new ArgumentException("Invalid Parameter");
                 case ConnectionError.NoConnection:
                     throw new InvalidOperationException("No Connection");
                 case ConnectionError.NoReply:
                     throw new InvalidOperationException("No Reply");
                 case ConnectionError.NotSupported:
-                    throw new NotSupportedException("Not Supported");
+                    throw new NotSupportedException("Unsupported feature " + message);
                 case ConnectionError.NowInProgress:
                     throw new InvalidOperationException("Now In Progress");
                 case ConnectionError.OperationAborted:
@@ -57,9 +84,9 @@ namespace Tizen.Network.Connection
                 case ConnectionError.OperationFailed:
                     throw new InvalidOperationException("Operation Failed");
                 case ConnectionError.OutOfMemoryError:
-                    throw new InvalidOperationException("Out Of Memory Error");
+                    throw new OutOfMemoryException("Out Of Memory Error");
                 case ConnectionError.PermissionDenied:
-                    throw new InvalidOperationException("Permission Denied");
+                    throw new UnauthorizedAccessException("Permission Denied " + message);
             }
         }
     }
index deb59d4..501b6a5 100755 (executable)
@@ -32,7 +32,6 @@ namespace Tizen.Network.Connection
 
         public HandleHolder()
         {
-            Log.Debug(Globals.LogTag, "HandleHolder() ^^");
             Interop.Connection.Create(out Handle);
             Log.Debug(Globals.LogTag, "Handle: " + Handle);
         }
@@ -141,7 +140,6 @@ namespace Tizen.Network.Connection
 
         internal IntPtr GetHandle()
         {
-            Log.Debug(Globals.LogTag, "GetHandle, Thread Id = " + Thread.CurrentThread.ManagedThreadId);
             return s_threadName.Value.GetHandle();
         }
 
@@ -390,8 +388,9 @@ namespace Tizen.Network.Connection
             return Interop.Connection.DestroyProfileIterator(iterator);
         }
 
-        internal string GetIPAddress(AddressFamily family)
+        internal System.Net.IPAddress GetIPAddress(AddressFamily family)
         {
+            Log.Debug(Globals.LogTag, "GetIPAddress " + family);
             IntPtr ip;
             int ret = Interop.Connection.GetIPAddress(GetHandle(), (int)family, out ip);
             if ((ConnectionError)ret != ConnectionError.None)
@@ -401,11 +400,38 @@ namespace Tizen.Network.Connection
             }
             string result = Marshal.PtrToStringAnsi(ip);
             Interop.Libc.Free(ip);
-            return result;
+            return System.Net.IPAddress.Parse(result);
+        }
+
+        internal IEnumerable<System.Net.IPAddress> GetAllIPv6Addresses(ConnectionType type)
+        {
+            Log.Debug(Globals.LogTag, "GetAllIPv6Addresses");
+            List<System.Net.IPAddress> ipList = new List<System.Net.IPAddress>();
+            Interop.Connection.IPv6AddressCallback callback = (IntPtr ipv6Address, IntPtr userData) =>
+            {
+                if (ipv6Address != IntPtr.Zero)
+                {
+                    string ipv6 = Marshal.PtrToStringAnsi(ipv6Address);
+                    ipList.Add(System.Net.IPAddress.Parse(ipv6));
+                    return true;
+                }
+                return false;
+            };
+
+            int ret = Interop.Connection.GetAllIPv6Addresses(GetHandle(), (int)type, callback, IntPtr.Zero);
+            if (ret != (int)ConnectionError.None)
+            {
+                Log.Error(Globals.LogTag, "Failed to get all IPv6 addresses, Error - " + (ConnectionError)ret);
+                ConnectionErrorFactory.ThrowConnectionException(ret);
+            }
+
+            return ipList;
         }
 
+
         internal string GetProxy(AddressFamily family)
         {
+            Log.Debug(Globals.LogTag, "GetProxy " + family);
             IntPtr ip;
             int ret = Interop.Connection.GetProxy(GetHandle(), (int)family, out ip);
             if ((ConnectionError)ret != ConnectionError.None)
@@ -420,24 +446,51 @@ namespace Tizen.Network.Connection
 
         internal string GetMacAddress(ConnectionType type)
         {
-            IntPtr ip;
-            int ret = Interop.Connection.GetMacAddress(GetHandle(), (int)type, out ip);
+            Log.Debug(Globals.LogTag, "GetMacAddress " + type);
+            IntPtr mac;
+            int ret = Interop.Connection.GetMacAddress(GetHandle(), (int)type, out mac);
             if ((ConnectionError)ret != ConnectionError.None)
             {
                 Log.Error(Globals.LogTag, "It failed to get mac address, " + (ConnectionError)ret);
                 ConnectionErrorFactory.ThrowConnectionException(ret);
             }
-            string result = Marshal.PtrToStringAnsi(ip);
-            Interop.Libc.Free(ip);
+            string result = Marshal.PtrToStringAnsi(mac);
+            Interop.Libc.Free(mac);
             return result;
         }
 
+        internal long GetStatistics(ConnectionType connectionType, StatisticsType statisticsType)
+        {
+            Log.Debug(Globals.LogTag, "GetStatistics " + connectionType + ", " + statisticsType);
+            long size;
+            int ret = Interop.Connection.GetStatistics(GetHandle(), (int)connectionType,
+                    (int)statisticsType, out size);
+            if ((ConnectionError)ret != ConnectionError.None)
+            {
+                Log.Error(Globals.LogTag, "It failed to get statistics, " + (ConnectionError)ret);
+                ConnectionErrorFactory.ThrowConnectionException(ret);
+            }
+            return size;
+        }
+
+        internal void ResetStatistics(ConnectionType connectionType, StatisticsType statisticsType)
+        {
+            Log.Debug(Globals.LogTag, "ResetStatistics " + connectionType + ", " + statisticsType);
+            int ret = Interop.Connection.ResetStatistics(GetHandle(), (int)connectionType,
+                    (int)statisticsType);
+            if ((ConnectionError)ret != ConnectionError.None)
+            {
+                Log.Error(Globals.LogTag, "It failed to reset statistics, " + (ConnectionError)ret);
+                ConnectionErrorFactory.ThrowConnectionException(ret);
+            }
+        }
+
         internal ConnectionType ConnectionType
         {
             get
             {
+                Log.Debug(Globals.LogTag, "get ConnectionType");
                 int type = 0;
-                Log.Debug(Globals.LogTag, "Handle: " + GetHandle());
                 int ret = Interop.Connection.GetType(GetHandle(), out type);
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
@@ -452,8 +505,8 @@ namespace Tizen.Network.Connection
         {
             get
             {
+                Log.Debug(Globals.LogTag, "get CellularState");
                 int type = 0;
-                Log.Debug(Globals.LogTag, "CellularState Handle: " + GetHandle());
                 int ret = Interop.Connection.GetCellularState(GetHandle(), out type);
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
@@ -468,6 +521,7 @@ namespace Tizen.Network.Connection
         {
             get
             {
+                Log.Debug(Globals.LogTag, "get WiFiState");
                 int type = 0;
                 int ret = Interop.Connection.GetWiFiState(GetHandle(), out type);
                 if ((ConnectionError)ret != ConnectionError.None)
@@ -483,6 +537,7 @@ namespace Tizen.Network.Connection
         {
             get
             {
+                Log.Debug(Globals.LogTag, "get BluetoothState");
                 int type = 0;
                 int ret = Interop.Connection.GetBtState(GetHandle(), out type);
                 if ((ConnectionError)ret != ConnectionError.None)
@@ -498,6 +553,7 @@ namespace Tizen.Network.Connection
         {
             get
             {
+                Log.Debug(Globals.LogTag, "get ConnectionType");
                 int type = 0;
                 int ret = Interop.Connection.GetEthernetState(GetHandle(), out type);
                 if ((ConnectionError)ret != ConnectionError.None)
@@ -513,6 +569,7 @@ namespace Tizen.Network.Connection
         {
             get
             {
+                Log.Debug(Globals.LogTag, "get EthernetCableState");
                 int type = 0;
                 int ret = Interop.Connection.GetEthernetCableState(GetHandle(), out type);
                 if ((ConnectionError)ret != ConnectionError.None)
@@ -526,7 +583,7 @@ namespace Tizen.Network.Connection
 
         internal IntPtr CreateCellularProfile(ConnectionProfileType type, string keyword)
         {
-            Log.Error(Globals.LogTag, "CreateCellularProfile, " + type + ", " + keyword);
+            Log.Debug(Globals.LogTag, "CreateCellularProfile, " + type + ", " + keyword);
             IntPtr connectionHandle = GetHandle();
             if (connectionHandle == IntPtr.Zero)
             {
@@ -547,6 +604,7 @@ namespace Tizen.Network.Connection
 
         internal void AddCellularProfile(CellularProfile profile)
         {
+            Log.Debug(Globals.LogTag, "AddCellularProfile");
             if (profile.Type == ConnectionProfileType.Cellular)
             {
                 int ret = Interop.Connection.AddProfile(GetHandle(), profile.ProfileHandle);
@@ -565,6 +623,7 @@ namespace Tizen.Network.Connection
 
         internal void RemoveProfile(ConnectionProfile profile)
         {
+            Log.Debug(Globals.LogTag, "RemoveProfile");
             int ret = Interop.Connection.RemoveProfile(GetHandle(), profile.ProfileHandle);
             if ((ConnectionError)ret != ConnectionError.None)
             {
@@ -575,6 +634,7 @@ namespace Tizen.Network.Connection
 
         internal void UpdateProfile(ConnectionProfile profile)
         {
+            Log.Debug(Globals.LogTag, "UpdateProfile");
             int ret = Interop.Connection.UpdateProfile(GetHandle(), profile.ProfileHandle);
             if ((ConnectionError)ret != ConnectionError.None)
             {
@@ -585,6 +645,7 @@ namespace Tizen.Network.Connection
 
         internal ConnectionProfile GetCurrentProfile()
         {
+            Log.Debug(Globals.LogTag, "GetCurrentProfile");
             IntPtr ProfileHandle;
             int ret = Interop.Connection.GetCurrentProfile(GetHandle(), out ProfileHandle);
             if ((ConnectionError)ret != ConnectionError.None)
@@ -598,6 +659,7 @@ namespace Tizen.Network.Connection
 
         internal ConnectionProfile GetDefaultCellularProfile(CellularServiceType type)
         {
+            Log.Debug(Globals.LogTag, "GetDefaultCellularProfile");
             IntPtr ProfileHandle;
             int ret = Interop.Connection.GetDefaultCellularServiceProfile(GetHandle(), (int)type, out ProfileHandle);
             if ((ConnectionError)ret != ConnectionError.None)
@@ -612,6 +674,7 @@ namespace Tizen.Network.Connection
 
         internal Task SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile)
         {
+            Log.Debug(Globals.LogTag, "SetDefaultCellularProfile");
             TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
             Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
             {
@@ -637,8 +700,8 @@ namespace Tizen.Network.Connection
 
         internal Task<IEnumerable<ConnectionProfile>> GetProfileListAsync(ProfileListType type)
         {
+            Log.Debug(Globals.LogTag, "GetProfileListAsync");
             var task = new TaskCompletionSource<IEnumerable<ConnectionProfile>>();
-
             List<ConnectionProfile> Result = new List<ConnectionProfile>();
             IntPtr iterator;
             int ret = Interop.Connection.GetProfileIterator(GetHandle(), (int)type, out iterator);
@@ -679,9 +742,11 @@ namespace Tizen.Network.Connection
 
         internal Task OpenProfileAsync(ConnectionProfile profile)
         {
+            Log.Debug(Globals.LogTag, "OpenProfileAsync " + profile.Name);
             TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
             Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
             {
+                Log.Debug(Globals.LogTag, "Connected " + profile.Name);
                 if (Result != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "Error occurs during connecting profile, " + Result);
@@ -703,6 +768,7 @@ namespace Tizen.Network.Connection
 
         internal Task CloseProfileAsync(ConnectionProfile profile)
         {
+            Log.Debug(Globals.LogTag, "CloseProfileAsync " + profile.Name);
             TaskCompletionSource<bool> task = new TaskCompletionSource<bool>();
             Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) =>
             {
@@ -725,4 +791,4 @@ namespace Tizen.Network.Connection
             return task.Task;
         }
     }
-}
\ No newline at end of file
+}
index 6a2f380..881e279 100755 (executable)
@@ -138,19 +138,50 @@ namespace Tizen.Network.Connection
         /// Gets the IP address of the current connection.
         /// </summary>
         /// <param name="family">The address family</param>
-        /// <returns>IP address of the connection.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
-        public static string GetIPAddress(AddressFamily family)
+        /// <returns>IP address of the connection (global address in case of IPv6).</returns>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</feature>
+        /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
+        /// <exception cref="System.UnauthorizedAccessException">Thrown when permission is denied.</exception>
+        /// <exception cref="System.ArgumentException">Thrown when value is invalid parameter.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation.</exception>
+        public static System.Net.IPAddress GetIPAddress(AddressFamily family)
         {
             return ConnectionInternalManager.Instance.GetIPAddress(family);
         }
 
         /// <summary>
+        /// Gets the all IPv6 addresses of the current connection.
+        /// </summary>
+        /// <param name="type">The type of current network connection</param>
+        /// <returns>A list of IPv6 addresses of the connection.</returns>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</feature>
+        /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
+        /// <exception cref="System.UnauthorizedAccessException">Thrown when permission is denied.</exception>
+        /// <exception cref="System.ArgumentException">Thrown when value is invalid parameter.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation.</exception>
+        public static IEnumerable<System.Net.IPAddress> GetAllIPv6Addresses(ConnectionType type)
+        {
+            return ConnectionInternalManager.Instance.GetAllIPv6Addresses(type);
+        }
+
+        /// <summary>
         /// Gets the proxy address of the current connection.
         /// </summary>
         /// <param name="family">The address family</param>
         /// <returns>Proxy address of the connection.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation.</exception>
         public static string GetProxy(AddressFamily family)
         {
             return ConnectionInternalManager.Instance.GetProxy(family);
@@ -161,13 +192,58 @@ namespace Tizen.Network.Connection
         /// </summary>
         /// <param name="type">The type of current network connection</param>
         /// <returns>MAC address of the Wi-Fi or ethernet.</returns>
-        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown when value is invalid parameter.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation.</exception>
         public static string GetMacAddress(ConnectionType type)
         {
             return ConnectionInternalManager.Instance.GetMacAddress(type);
         }
 
         /// <summary>
+        /// Gets the statistics information.
+        /// </summary>
+        /// <param name="connectionType">The type of connection (only WiFi and Cellular are supported)</param>
+        /// <param name="statisticsType">The type of statistics</param>
+        /// <returns>The statistics information associated with statisticsType</returns>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</feature>
+        /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
+        /// <exception cref="System.UnauthorizedAccessException">Thrown when permission is denied.</exception>
+        /// <exception cref="System.ArgumentException">Thrown when value is invalid parameter.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation.</exception>
+        public static long GetStatistics(ConnectionType connectionType, StatisticsType statisticsType)
+        {
+            return ConnectionInternalManager.Instance.GetStatistics(connectionType, statisticsType);
+        }
+
+        /// <summary>
+        /// Resets the statistics information.
+        /// </summary>
+        /// <param name="connectionType">The type of connection (only WiFi and Cellular are supported)</param>
+        /// <param name="statisticsType">The type of statistics</param>
+        /// <privilege>http://tizen.org/privilege/network.get</privilege>
+        /// <privilege>http://tizen.org/privilege/network.set</privilege>
+        /// <feature>http://tizen.org/feature/network.telephony</feature>
+        /// <feature>http://tizen.org/feature/network.wifi</feature>
+        /// <feature>http://tizen.org/feature/network.tethering.bluetooth</feature>
+        /// <feature>http://tizen.org/feature/network.ethernet</feature>
+        /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
+        /// <exception cref="System.UnauthorizedAccessException">Thrown when permission is denied.</exception>
+        /// <exception cref="System.ArgumentException">Thrown when value is invalid parameter.</exception>
+        /// <exception cref="System.OutOfMemoryException">Thrown when memory is not enough to continue execution.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when connection instance is invalid or when method failed due to invalid operation.</exception>
+        public static void ResetStatistics(ConnectionType connectionType, StatisticsType statisticsType)
+        {
+            ConnectionInternalManager.Instance.ResetStatistics(connectionType, statisticsType);
+        }
+
+        /// <summary>
         /// Type and state of the current profile for data connection
         /// </summary>
         public static ConnectionItem CurrentConnection
@@ -189,6 +265,11 @@ namespace Tizen.Network.Connection
         /// <param name="type">The type of profile. Cellular profile type is supported.</param>
         /// <param name="keyword">The keyword included in profile name.</param>
         /// <returns>CellularProfile object</returns>
+        /// <exception cref="System.NotSupportedException">Thrown when feature is not supported.</exception>
+        /// <exception cref="System.UnauthorizedAccessException">Thrown when permission is denied.</exception>
+        /// <exception cref="System.ArgumentException">Thrown when value is invalid parameter.</exception>
+        /// <exception cref="System.ArgumentNullException">Thrown when keyword value is null.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown when method failed due to invalid operation.</exception>
         public static CellularProfile CreateCellularProfile(ConnectionProfileType type, string keyword)
         {
             IntPtr profileHandle = IntPtr.Zero;
index 7e70bc9..4512996 100755 (executable)
@@ -47,6 +47,7 @@ namespace Tizen.Network.Connection
         {
             add
             {
+                Log.Debug(Globals.LogTag, "ProfileStateChanged add");
                 if (_ProfileStateChanged == null)
                 {
                     ProfileStateChangedStart();
@@ -55,6 +56,7 @@ namespace Tizen.Network.Connection
             }
             remove
             {
+                Log.Debug(Globals.LogTag, "ProfileStateChanged remove");
                 _ProfileStateChanged -= value;
                 if (_ProfileStateChanged == null)
                 {
@@ -73,6 +75,7 @@ namespace Tizen.Network.Connection
                 }
             };
 
+            Log.Debug(Globals.LogTag, "ProfileStateChangedStart");
             int ret = Interop.ConnectionProfile.SetStateChangeCallback(ProfileHandle, _profileChangedCallback, IntPtr.Zero);
             if ((ConnectionError)ret != ConnectionError.None)
             {
@@ -82,6 +85,7 @@ namespace Tizen.Network.Connection
 
         private void ProfileStateChangedStop()
         {
+            Log.Debug(Globals.LogTag, "ProfileStateChangedStop");
             int ret = Interop.ConnectionProfile.UnsetStateChangeCallback(ProfileHandle);
             if ((ConnectionError)ret != ConnectionError.None)
             {
@@ -133,6 +137,15 @@ namespace Tizen.Network.Connection
         private void Destroy()
         {
             Interop.ConnectionProfile.Destroy(ProfileHandle);
+            ProfileHandle = IntPtr.Zero;
+        }
+
+        internal void CheckDisposed()
+        {
+            if (disposed)
+            {
+                throw new ObjectDisposedException(GetType().FullName);
+            }
         }
 
         /// <summary>
@@ -211,20 +224,42 @@ namespace Tizen.Network.Connection
         }
 
         /// <summary>
-        /// The profile state.
+        /// Refreshes the profile information.
         /// </summary>
-        public ProfileState State
+        /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
+        public void Refresh()
         {
-            get
+            int ret = Interop.ConnectionProfile.Refresh(ProfileHandle);
+            if ((ConnectionError)ret != ConnectionError.None)
             {
+                Log.Error(Globals.LogTag, "It failed to get network interface name, " + (ConnectionError)ret);
+                ConnectionErrorFactory.ThrowConnectionException(ret);
+            }
+        }
+
+        /// <summary>
+        /// Get the network state.
+        /// </summary>
+        /// <param name="family">The address family</param>
+        /// <returns>The network state.</returns>
+        public ProfileState GetState(AddressFamily family)
+        {
                 int Value;
-                int ret = Interop.ConnectionProfile.GetState(ProfileHandle, out Value);
+                int ret = (int)ConnectionError.None;
+                if (family == AddressFamily.IPv4)
+                {
+                    ret = Interop.ConnectionProfile.GetState(ProfileHandle, out Value);
+                }
+                else
+                {
+                    ret = Interop.ConnectionProfile.GetIPv6State(ProfileHandle, out Value);
+                }
+
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to get profile state, " + (ConnectionError)ret);
                 }
                 return (ProfileState)Value;
-            }
         }
 
         /// <summary>
@@ -284,7 +319,7 @@ namespace Tizen.Network.Connection
         }
 
         /// <summary>
-        /// The subnet mask address(IPv4).
+        /// The address information (IPv4)
         /// </summary>
         public IAddressInformation IPv4Settings
         {
@@ -296,7 +331,7 @@ namespace Tizen.Network.Connection
         }
 
         /// <summary>
-        /// The subnet mask address(IPv4).
+        /// The address information (IPv6)
         /// </summary>
         public IAddressInformation IPv6Settings
         {
index cbd2933..baa7d06 100755 (executable)
@@ -36,6 +36,7 @@ namespace Tizen.Network.Connection
         /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
         public static void AddCellularProfile(CellularProfile profile)
         {
+            Log.Debug(Globals.LogTag, "AddCellularProfile");
             ConnectionInternalManager.Instance.AddCellularProfile(profile);
         }
 
@@ -47,6 +48,7 @@ namespace Tizen.Network.Connection
         /// <returns>List of connection profile objects.</returns>
         public static Task<IEnumerable<ConnectionProfile>> GetProfileListAsync(ProfileListType type)
         {
+            Log.Debug(Globals.LogTag, "GetProfileListAsync");
             return ConnectionInternalManager.Instance.GetProfileListAsync(type);
         }
 
@@ -60,6 +62,7 @@ namespace Tizen.Network.Connection
         /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
         public static Task ConnectProfileAsync(ConnectionProfile profile)
         {
+            Log.Debug(Globals.LogTag, "ConnectProfile");
             return ConnectionInternalManager.Instance.OpenProfileAsync(profile);
         }
 
@@ -72,6 +75,7 @@ namespace Tizen.Network.Connection
         /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
         public static Task DisconnectProfileAsync(ConnectionProfile profile)
         {
+            Log.Debug(Globals.LogTag, "DisconnectProfileAsync");
             return ConnectionInternalManager.Instance.CloseProfileAsync(profile);
         }
 
@@ -99,6 +103,7 @@ namespace Tizen.Network.Connection
         /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
         public static void UpdateProfile(ConnectionProfile profile)
         {
+            Log.Debug(Globals.LogTag, "UpdateProfile");
             ConnectionInternalManager.Instance.UpdateProfile(profile);
         }
 
@@ -110,6 +115,7 @@ namespace Tizen.Network.Connection
         /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
         public static ConnectionProfile GetCurrentProfile()
         {
+            Log.Debug(Globals.LogTag, "GetCurrentProfile");
             return ConnectionInternalManager.Instance.GetCurrentProfile();
         }
 
@@ -122,6 +128,7 @@ namespace Tizen.Network.Connection
         /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
         public static ConnectionProfile GetDefaultCellularProfile(CellularServiceType type)
         {
+            Log.Debug(Globals.LogTag, "GetDefaultCurrentProfile");
             return ConnectionInternalManager.Instance.GetDefaultCellularProfile(type);
         }
 
@@ -136,6 +143,7 @@ namespace Tizen.Network.Connection
         /// <exception cref="InvalidOperationException">Thrown when method failed due to invalid operation</exception>
         public static Task SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile)
         {
+            Log.Debug(Globals.LogTag, "SetDefaultCellularProfile");
             return ConnectionInternalManager.Instance.SetDefaultCellularProfile(type, profile);
         }
     }
index 817128c..075967d 100755 (executable)
@@ -41,8 +41,8 @@ namespace Tizen.Network.Connection
     /// </summary>
     public enum AddressFamily
     {
-        IPv4 = 0,
-        IPv6 = 1
+        IPv4 = 0,   /**< IPv4 Address */
+        IPv6 = 1    /**< IPv6 Address */
     }
 
     /// <summary>
@@ -78,6 +78,17 @@ namespace Tizen.Network.Connection
     }
 
     /// <summary>
+    /// Enumeration for statistics type.
+    /// </summary>
+    public enum StatisticsType
+    {
+        LastReceivedData = 0,  /**< Last received data */
+        LastSentData = 1,  /**< Last sent data */
+        TotalReceivedData = 2,  /**< Total received data */
+        TotalSentData = 3,  /**< Total sent data */
+    }
+
+    /// <summary>
     /// Enumeration for network connection type.
     /// </summary>
     public enum ConnectionProfileType
@@ -135,6 +146,27 @@ namespace Tizen.Network.Connection
         Application = 6,  /**< Specific application */
     }
 
+    /// <summary>
+    /// Enumeration for cellular pdn type.
+    /// </summary>
+    public enum CellularPdnType
+    {
+        Unknown = 0,  /**< Unknown */
+        IPv4 = 1,  /**< IPv4 */
+        IPv6 = 2,  /**< IPv6 */
+        IPv4_IPv6 = 3,  /**< Both IPv4 and IPv6 */
+    }
+
+    /// <summary>
+    /// Enumeration for DNS configuration type.
+    /// </summary>
+    public enum DnsConfigType
+    {
+        None = 0,  /**< Not defined */
+        Static = 1,  /**< Manual DNS configuration */
+        Dynamic = 2,  /**< Config DNS using DHCP client */
+    }
+
     static internal class ConnectionErrorValue
     {
         internal const int Base = -0x01C10000;
index b9f76aa..2407419 100755 (executable)
@@ -32,32 +32,66 @@ namespace Tizen.Network.Connection
         /// <summary>
         /// The DNS address.
         /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         System.Net.IPAddress Dns1 { get; set; }
 
         /// <summary>
         /// The DNS address.
         /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         System.Net.IPAddress Dns2 { get; set; }
 
         /// <summary>
         /// The gateway address.
         /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         System.Net.IPAddress Gateway { get; set; }
 
         /// <summary>
         /// The subnet mask address.
         /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         System.Net.IPAddress SubnetMask { get; set; }
 
         /// <summary>
         /// The IP address.
         /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         System.Net.IPAddress IP { get; set; }
 
         /// <summary>
         /// The type of IP config.
         /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
         IPConfigType IPConfigType { get; set; }
+
+        /// <summary>
+        /// The prefix length.
+        /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
+        int PrefixLength { get; set; }
+
+        /// <summary>
+        /// The DNS config type.
+        /// </summary>
+        /// <exception cref="System.NotSupportedException">Thrown during set when feature is not supported.</exception>
+        /// <exception cref="System.ArgumentException">Thrown during set when value is invalid parameter.</exception>
+        /// <exception cref="System.InvalidOperationException">Thrown during set when profile instance is invalid or when method failed due to invalid operation.</exception>
+        DnsConfigType DnsConfigType { get; set; }
     }
 
     internal class ConnectionAddressInformation : IAddressInformation
@@ -80,7 +114,6 @@ namespace Tizen.Network.Connection
                 if ((ConnectionError)ret != ConnectionError.None)
                 {
                     Log.Error(Globals.LogTag, "It failed to get dns1 address, " + (ConnectionError)ret);
-                    ConnectionErrorFactory.ThrowConnectionException(ret);
                 }
                 string result = Marshal.PtrToStringAnsi(Value);
                 Interop.Libc.Free(Value);
@@ -88,6 +121,7 @@ namespace Tizen.Network.Connection
                     return System.Net.IPAddress.Parse("0.0.0.0");
                 return System.Net.IPAddress.Parse(result);
             }
+
             set
             {
                 int ret = Interop.ConnectionProfile.SetDnsAddress(_profileHandle, (int)_family, value.ToString());
@@ -235,5 +269,57 @@ namespace Tizen.Network.Connection
                 }
             }
         }
+
+        public int PrefixLength
+        {
+            get
+            {
+                int Value;
+                int ret = Interop.ConnectionProfile.GetPrefixLength(_profileHandle, (int)_family, out Value);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to get prefix length, " + (ConnectionError)ret);
+                }
+                return Value;
+            }
+
+            set
+            {
+                int ret = Interop.ConnectionProfile.SetPrefixLength(_profileHandle, (int)_family, value);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to set prefix length, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
+                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                }
+            }
+        }
+
+        public DnsConfigType DnsConfigType
+        {
+            get
+            {
+                int Value;
+                int ret = Interop.ConnectionProfile.GetDnsConfigType(_profileHandle, (int)_family, out Value);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to get DNS config type, " + (ConnectionError)ret);
+                }
+                return (DnsConfigType)Value;
+            }
+
+            set
+            {
+                int ret = Interop.ConnectionProfile.SetDnsConfigType(_profileHandle, (int)_family, (int)value);
+                if ((ConnectionError)ret != ConnectionError.None)
+                {
+                    Log.Error(Globals.LogTag, "It failed to set DNS config type, " + (ConnectionError)ret);
+                    ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet");
+                    ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released");
+                    ConnectionErrorFactory.ThrowConnectionException(ret);
+                }
+            }
+        }
     }
 }