Merge "Add the exception handling when using manual cert mode" into tizen_2.1
[platform/framework/native/net.git] / src / FNet_DnsImpl.h
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_DnsImpl.h
19  * @brief       This is the header file for the _DnsImpl class.
20  *
21  * This header file contains the declarations of the _DnsImpl Class.
22  */
23
24 #ifndef _FNET_INTERNAL_DNS_IMPL_H_
25 #define _FNET_INTERNAL_DNS_IMPL_H_
26
27 #include <FBaseDataType.h>
28 #include <FBaseObject.h>
29 #include "FNet_NetUtility.h"
30
31 namespace Tizen { namespace Base
32 {
33 class String;
34 } } // Tizen::Base
35
36 namespace Tizen { namespace Base { namespace Collection
37 {
38 class ArrayList;
39 } } } // Tizen::Base::Collection
40
41 namespace Tizen { namespace Net
42 {
43 class Dns;
44 class IpAddress;
45 class NetConnection;
46 class NetConnectionManager;
47 class ManagedNetConnection;
48 class IDnsEventListener;
49 class _DnsEvent;
50 class _DnsManagedNetConnectionEventListener;
51
52 class _DnsImpl
53         : public Tizen::Base::Object
54 {
55
56 public:
57         /**
58          * This is the default constructor for this class.
59          *
60          * @since 2.1
61          * @remarks                     After creating an instance of this class, you must explicitly call the
62          *                                              Construct() method to initialize the instance.
63          * @see                         Construct()
64          */
65         _DnsImpl(void);
66
67         /**
68          * This is the destructor for this class.
69          *
70          * @since 2.1
71          */
72         virtual ~_DnsImpl(void);
73
74         /**
75          * Initializes this instance of Dns with the specified parameters.
76          *
77          * @see                                 Dns::Construct()
78          * @since 2.1
79          * @return                              An error code
80          *
81          */
82         result Construct(const NetConnection& netConnection, IDnsEventListener& listener);
83
84         /**
85          * Initializes this instance of Dns with the specified listener.
86          *
87          * @see                                 Dns::Construct()
88          * @since 2.1
89          * @return                              An error code
90          */
91         result Construct(IDnsEventListener& listener);
92
93 public:
94         /**
95          * Requests a DNS lookup by IP address. This method is asynchronous.
96          *
97          * @see                                 Dns::GetHostByName()
98          * @since 2.1
99          * @return                              An error code
100          */
101         result GetHostByName(const Tizen::Base::String& hostName);
102
103         /**
104          * Requests a DNS lookup by IP address. This method is asynchronous.
105          *
106          * @see                                 Dns::GetHostByAddress()
107          * @since 2.1
108          * @return                              An error code
109          */
110         result GetHostByAddress(const IpAddress& ipAddress);
111
112 public:
113     /**
114      * Gets the Impl instance.
115      *
116      * @since 2.1
117      * @return              The pointer to _DnsImpl
118      * @param[in]   pDns            An instance of Dns
119      */
120         static _DnsImpl* GetInstance(Dns& dns);
121
122     /**
123      * Gets the Impl instance.
124      *
125      * @since 2.1
126      * @return              The pointer to  _DnsImpl
127      * @param[in]   pDns     An instance of Dns
128      */
129         static const _DnsImpl* GetInstance(const Dns& dns);
130
131 private:
132         /*
133          * This is the copy constructor for this class. @n
134          * Do @b not use directly.
135          *
136          * @param[in]   rhs                     An instance of Dns
137          */
138         _DnsImpl(const _DnsImpl& rhs);
139
140         /*
141          * This is the assignment operator. Do @b not use directly.
142          *
143          * @param[in]   rhs             An instance of Dns
144          */
145         _DnsImpl& operator =(const _DnsImpl& rhs);
146
147 private:
148         Tizen::Net::NetConnection* __pNetConnection;
149         std::unique_ptr<_DnsEvent> __pDnsEvent;
150         std::unique_ptr<Tizen::Base::Collection::ArrayList, _CollectionDeleter> __pDnsRequestHandlerList; // List of Runnable to handle requests asynchronously
151         std::unique_ptr<_DnsManagedNetConnectionEventListener> __pManagedNetConnectionEventListener;
152         std::unique_ptr<ManagedNetConnection> __pManagedNetConnection;
153 }; // _DnsImpl
154
155 } } // Tizen::Net
156
157 #endif // _FNET_INTERNAL_DNS_IMPL_H_