Merge "Add the exception handling when using manual cert mode" into tizen_2.1
[platform/framework/native/net.git] / src / FNet_DnsEventArg.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                FNetDns_DnsEventArg.h
19  * @brief               This is the header file for the _DnsEventArg Class.
20  *
21  * This header file contains declaration of the _DnsEventArg Class.
22  */
23 #ifndef _FNET_INTERNAL_DNS_EVENT_ARG_H_
24 #define _FNET_INTERNAL_DNS_EVENT_ARG_H_
25
26 #include <FBaseDataType.h>
27 #include <FBaseObject.h>
28 #include <FBaseRtIEventArg.h>
29
30 namespace Tizen { namespace Net
31 {
32
33 //DNS related enum values
34 /*
35  * @enum NetDnsEventType
36  * Type for specifying the type of %Dns events
37  * @since 2.1
38  */
39 enum _NetDnsEventType
40 {
41         NET_DNS_EVENT_NONE = 0,
42         NET_DNS_EVENT_HOSTNAME,     /** < alias info is expected */
43         NET_DNS_EVENT_ADDRESS       /** < Address info is expected */
44 };
45
46 class IpHostEntry;
47
48 /**
49  * @class       _DnsEventArg
50  * @brief       This class is used as an argument of methods of the IDnsEventListener class.
51  *
52  * @since 2.1
53  * This class is used as an argument of IDnsEventListener's methods.
54  * When a %Dns event occurs, the _DnsEvent object finds a IDnsEventListener object
55  * which is registered for the Dns object and calls an appropriate method of the listener.
56  * @see IDnsEventListener for example codes
57  */
58 class _DnsEventArg
59         : public Tizen::Base::Object
60         , public Tizen::Base::Runtime::IEventArg
61 {
62
63 public:
64         /*
65          * This is constructor.
66          */
67         _DnsEventArg(result errorCode, IpHostEntry* pIpHostEntry);
68
69         /*
70          * This is the class destructor.
71          */
72         virtual ~_DnsEventArg(void);
73
74 public:
75         /*
76          * Returns the IpHostEntry which contains the result of the Dns request.
77          *
78          * @return              An IpHostEntry object which contains a domain name, an associated IP address list and an associated alias list.
79          *                                              In case of error condition, null is returned.
80          * @remark              You can refer detailed error cause by calling GetLastError()
81          * @exception E_INVALID_STATE                   - dns query succeed, but not valid info found
82          * @exception E_OPERATION_FAILED        - operation failed, so no IpHostEntry info
83          * @exception E_SUCCESS - DNS query successful
84          */
85         IpHostEntry* GetIpHostEntry(void) const;
86
87         /*
88          * Returns the cause of a Dns error.
89          *
90          * @return      See the comment above.
91          */
92         result GetError(void) const;
93
94 private:
95         /*
96          * This is constructor.
97          */
98         _DnsEventArg(void);
99
100         /*
101          * This is the copy constructor for this class. @n
102          * Do @b not use directly.
103          *
104          * @param[in]   rhs                     An instance of _DnsEventArg
105          */
106         _DnsEventArg(const _DnsEventArg& rhs);
107
108         /*
109          * This is the assignment operator. Do @b not use directly.
110          *
111          * @param[in]   rhs                     An instance of _DnsEventArg
112          */
113         _DnsEventArg& operator =(const _DnsEventArg& rhs);
114
115 private:
116         IpHostEntry* __pIpHostEntry;
117         result __errorCode;
118
119 }; // _DnsEventArg
120 } } //Tizen::Net
121
122 #endif // _FNET_INTERNAL_DNS_EVENT_ARG_H_