Merge "Add the exception handling when using manual cert mode" into tizen_2.1
[platform/framework/native/net.git] / src / FNet_LocalDhcpServerEvent.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_LocalDhcpServerEvent.h
19  * @brief               This is the header file for the _LocalDhcpServerEvent class.
20  *
21  * This header file contains declaration of the _LocalDhcpServerEvent class.
22  * The __LocalDhcpServerEvent class can call a method of a listener (ILocalDhcpServerEventListener object).
23  * So, when a dhcp server event occurs, an application can handle it appropriately.
24  */
25
26 #ifndef _FNET_INTERNAL_LOCAL_DHCP_SERVER_EVENT_H_
27 #define _FNET_INTERNAL_LOCAL_DHCP_SERVER_EVENT_H_
28
29 #include <FBaseDataType.h>
30 #include <FBaseRt_Event.h>
31
32 namespace Tizen { namespace Net
33 {
34 class LocalDhcpServer;
35 class _LocalDhcpServerImpl;
36 class ILocalDhcpServerEventListener;
37 class DhcpClientInfo;
38
39 /**
40  * @class       _LocalDhcpServerEvent
41  * @brief       This class handles dhcp server events.
42  *
43  *
44  * When a dhcp server event occurs, the _LocalDhcpServerEvent class finds a listener and calls
45  * the appropriate method of the listener.
46  *
47  */
48 class _LocalDhcpServerEvent
49         : public Tizen::Base::Runtime::_Event
50 {
51 public:
52         /**
53          * This is the default class constructor.
54          *
55          * @remarks             After creating an instance of this class, you must explicitly call
56          *                              construction methods to initialize the instance.
57          */
58         _LocalDhcpServerEvent(void);
59
60         /**
61          * This is the class destructor.
62          */
63         virtual ~_LocalDhcpServerEvent(void);
64
65         /**
66          * Initializes a new instance of the __LocalDhcpServerEvent class
67          *
68          * @return              The error code
69          * @param[in]   localDhcpServer                 An LocalDhcpServer object whose events are processed
70          * @exception   E_SUCCESS                       - This method is successful.
71          * @exception   E_INVALID_ARG           - The argument passed to a method contains an invalid value.
72          * @exception   E_OUT_OF_MEMORY         - Failed to allocate required/requested memory.
73          * @exception   E_SYSTEM                        - Internal error (System)
74          *
75          */
76         result Construct(const LocalDhcpServer& localDhcpServer);
77
78 public:
79         /**
80          * Gets an associated LocalDhcpServer object
81          *
82          * @return              The LocalDhcpServer object 's pointer whose events are processed. If error happens, null is returned.
83          * @exception   E_SUCCESS                       - This method is successful.
84          * @exception   E_INVALID_STATE         - succeed, but not valid info found
85          * @remark              You can refer GetLastResult() for detailed error cause.
86          */
87         LocalDhcpServer* GetLocalDhcpServer(void) const;
88
89         /**
90          * Sets a listener instance for events about a local DHCP server.
91          *
92          * @param[in]   pListener                       An instance of ILocalDhcpServerEventListener if an argument is null, it will reset the event listener.
93          * @return              An error code
94          * @exception   E_SUCCESS                       The method was successful.
95          * @exception   E_INVALID_STATE         This instance has not been constructed as yet.
96          * @exception   E_SYSTEM                        An internal error occurred.
97          */
98         result SetEventListener(ILocalDhcpServerEventListener* pListener);
99
100 protected:
101         /**
102          * Checks the arg and finds out the type of event. After that this method calls appropriate
103          * pListener's method.
104          *
105          * @return              A result code.
106          * @param[in]   pListener                       It is a event listener related to this Http event.
107          * @param[in]   arg                                     It is an argument-like instance of Http event retransmitted to the listener's method as an argument.
108          * @exception   E_SUCCESS                       - The method is successful.
109          * @exception   E_INVALID_ARG           - The argument passed to a method contains an invalid value.@n
110          */
111         void FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg);
112
113 private:
114         /*
115          * This is the copy constructor for this class. @n
116          * Do @b not use directly.
117          *
118          * @param[in]   rhs                     An instance of __LocalDhcpServerEvent
119          */
120         _LocalDhcpServerEvent(const _LocalDhcpServerEvent& rhs);
121
122         /*
123          * This is the assignment operator. Do @b not use directly.
124          *
125          * @param[in]   rhs                             An instance of __LocalDhcpServerEvent
126          */
127         _LocalDhcpServerEvent& operator =(const _LocalDhcpServerEvent& rhs);
128
129 private:
130         LocalDhcpServer* __pLocalDhcpServer;    //for reference
131         ILocalDhcpServerEventListener* __pLocalDhcpServerEventListener;
132         
133         friend class _LocalDhcpServerImpl;
134 }; // _LocalDhcpServerEvent
135
136 } } // Tizen::Net
137 #endif // _FNET_INTERNAL_DHCP_SERVER_EVENT_H_