change version to 1.2.2.0
[platform/framework/native/net.git] / src / FNet_IpHostEntryImpl.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 /**
18  * @file                FNet_IpHostEntryImpl.cpp
19  * @brief               This is the implementation for the _IpHostEntryImpl class.
20  */
21
22 #include <FBaseColArrayList.h>
23 #include <FBaseUtilStringUtil.h>
24 #include <FNetNetTypes.h>
25 #include <FNetIp4Address.h>
26 #include <FNetIpHostEntry.h>
27 #include <FBaseSysLog.h>
28 #include "FNet_NetTypes.h"
29 #include "FNet_IpHostEntryImpl.h"
30
31 using namespace std;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Collection;
34 using namespace Tizen::Base::Utility;
35
36 namespace Tizen { namespace Net
37 {
38
39 _IpHostEntryImpl::_IpHostEntryImpl(void)
40         : __pAddressList(null)
41         , __pAliasList(null)
42 {
43 }
44
45 _IpHostEntryImpl::~_IpHostEntryImpl(void)
46 {
47 }
48
49 IList*
50 _IpHostEntryImpl::GetAddressList(void) const
51 {
52         return __pAddressList.get();
53 }
54
55 IList*
56 _IpHostEntryImpl::GetAliasList(void) const
57 {
58         return __pAliasList.get();
59 }
60
61 IpHostEntry*
62 _IpHostEntryImpl::CreateIpHostEntryN()
63 {
64         IpHostEntry* pIpHostEntry = new (std::nothrow) IpHostEntry();
65         SysTryReturn(NID_NET, pIpHostEntry != null, null, E_OUT_OF_MEMORY,
66                         "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
67
68         return pIpHostEntry;
69 }
70
71 result
72 _IpHostEntryImpl::SetAddressList(const IList& addressList)
73 {
74         __pAddressList.reset(const_cast <IList*>(&addressList));
75
76         return E_SUCCESS;
77 }
78
79 result
80 _IpHostEntryImpl::SetAliasList(const IList& aliasList)
81 {
82         __pAliasList.reset(const_cast <IList*>(&aliasList));
83
84         return E_SUCCESS;
85 }
86
87 _IpHostEntryImpl*
88 _IpHostEntryImpl::GetInstance(IpHostEntry& ipHostEntry)
89 {
90         return ipHostEntry.__pIpHostEntryImpl;
91 }
92
93 const _IpHostEntryImpl*
94 _IpHostEntryImpl::GetInstance(const IpHostEntry& ipHostEntry)
95 {
96         return ipHostEntry.__pIpHostEntryImpl;
97 }
98
99 } }  // Tizen::Net