2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FNetNetConnectionInfo.cpp
20 * @brief This is the implementation for the %NetConnectionInfo class.
23 #include <FBaseUtilStringUtil.h>
24 #include <FNetNetConnectionInfo.h>
25 #include <FNetIp4Address.h>
26 #include <FBaseSysLog.h>
27 #include "FNet_NetConnectionInfoImpl.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Utility;
32 namespace Tizen { namespace Net
35 NetConnectionInfo::NetConnectionInfo(void)
37 __pNetConnectionInfoImpl = new (std::nothrow) _NetConnectionInfoImpl();
38 SysTryReturnVoidResult(NID_NET, __pNetConnectionInfoImpl != null, E_OUT_OF_MEMORY,
39 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
42 NetConnectionInfo::~NetConnectionInfo(void)
44 delete __pNetConnectionInfoImpl;
45 __pNetConnectionInfoImpl = null;
49 NetConnectionInfo::GetBearerType(void) const
51 return __pNetConnectionInfoImpl->GetBearerType();
56 NetConnectionInfo::GetProtocolType(void) const
58 return __pNetConnectionInfoImpl->GetProtocolType();
63 NetConnectionInfo::GetAccessPointName(void) const
65 return __pNetConnectionInfoImpl->GetAccessPointName();
69 NetConnectionInfo::GetLocalAddressScheme(void) const
71 return __pNetConnectionInfoImpl->GetLocalAddressScheme();
75 NetConnectionInfo::GetLocalAddress(void) const
77 return __pNetConnectionInfoImpl->GetLocalAddress();
82 NetConnectionInfo::GetDnsAddressScheme(void) const
84 return __pNetConnectionInfoImpl->GetDnsAddressScheme();
88 NetConnectionInfo::GetPrimaryDnsAddress(void) const
90 return __pNetConnectionInfoImpl->GetPrimaryDnsAddress();
94 NetConnectionInfo::GetSecondaryDnsAddress(void) const
96 return __pNetConnectionInfoImpl->GetSecondaryDnsAddress();
100 NetConnectionInfo::GetSubnetMaskAddress(void) const
102 return __pNetConnectionInfoImpl->GetSubnetMaskAddress();
106 NetConnectionInfo::GetDefaultGatewayAddress(void) const
108 return __pNetConnectionInfoImpl->GetDefaultGatewayAddress();
111 NetConnectionInfo::NetConnectionInfo(const NetConnectionInfo& rhs)
113 __pNetConnectionInfoImpl = new (std::nothrow) _NetConnectionInfoImpl(*(rhs.__pNetConnectionInfoImpl));
114 SysTryReturnVoidResult(NID_NET, __pNetConnectionInfoImpl != null, E_OUT_OF_MEMORY,
115 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
119 NetConnectionInfo::operator =(const NetConnectionInfo& rhs)
126 *__pNetConnectionInfoImpl = *rhs.__pNetConnectionInfoImpl;
133 NetConnectionInfo::Equals(const Object& rhs) const
135 const NetConnectionInfo* pRhs = dynamic_cast<const NetConnectionInfo*>(&rhs);
141 const _NetConnectionInfoImpl* pRhsImpl = _NetConnectionInfoImpl::GetInstance(*pRhs);
142 if (pRhsImpl == null)
147 return __pNetConnectionInfoImpl->Equals(*pRhsImpl);
151 NetConnectionInfo::GetHashCode(void) const
153 return __pNetConnectionInfoImpl->GetHashCode();