change version to 1.2.2.0
[platform/framework/native/net.git] / src / FNet_NetAccountInfoImpl.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_NetAccountInfoImpl.h
19  * @brief               This is the header file for the _NetAccountInfoImpl class.
20  */
21
22 #ifndef _FNET_INTERNAL_NET_ACCOUNT_INFO_IMPL_H_
23 #define _FNET_INTERNAL_NET_ACCOUNT_INFO_IMPL_H_
24
25 #include <unique_ptr.h>
26 #include <FBaseDataType.h>
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29 #include <FNetNetTypes.h>
30
31 namespace Tizen { namespace Net
32 {
33 class IpAddress;
34 class NetEndPoint;
35 class NetAccountInfo;
36 class _NetAccountManagerImpl;
37
38 class _NetAccountInfoImpl
39         : public Tizen::Base::Object
40 {
41
42 public:
43         /**
44          * This is the default constructor for this class.
45          *
46          * @since 2.1
47          * @remarks             After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
48          * @see                 Construct()
49          */
50         _NetAccountInfoImpl(void);
51
52         /**
53          * This is the destructor for this class.
54          *
55          * @since 2.1
56          */
57         virtual ~_NetAccountInfoImpl(void);
58
59         /**
60          * @see                 NetAccountInfo::Construct()
61          */
62         result Construct(const _NetAccountInfoImpl& netAccountInfo);
63
64         /**
65          * @see                 NetAccountInfo::Construct()
66          */
67         result Construct(void);
68
69         /**
70          * Initializes this instance of %_NetAccountInfoImpl with the specified profile instance. @n
71          *
72          * @since 2.1
73          * @return              An error code
74          * @param[in]   pAccountInfo                    A %NetAccountInfo instance
75          * @param[in]   pProfileHandle                  A profile handle
76          * @exception   E_SUCCESS                       The method is successful.
77          * @exception   E_INVALID_STATE This instance has already been constructed.
78          * @exception   E_INVALID_ARG           The specified @c pAccountInfo or  @c pProfileInfo is invalid.
79          */
80         result Construct(NetAccountInfo* pAccountInfo, void* pProfileHandle);
81
82 public:
83         /**
84          * @see                 NetAccountInfo::GetAccountId()
85          */
86         NetAccountId GetAccountId(void) const;
87
88         /**
89          * @see                 NetAccountInfo::GetAccountName()
90          */
91         Tizen::Base::String GetAccountName(void) const;
92
93         /**
94          * @see                 NetAccountInfo::SetAccountName()
95          */
96         result SetAccountName(const Tizen::Base::String& accountName);
97
98         /**
99          * @see                 NetAccountInfo::GetProtocolType()
100          */
101         NetProtocolType GetProtocolType(void) const;
102
103         /**
104          * @see                 NetAccountInfo::SetProtocolType()
105          */
106         result SetProtocolType(NetProtocolType netProtocolType);
107
108         /**
109          * @see                 NetAccountInfo::GetAccessPointName()
110          */
111         Tizen::Base::String GetAccessPointName(void) const;
112
113         /**
114          * @see                 NetAccountInfo::SetAccessPointName()
115          */
116         result SetAccessPointName(const Tizen::Base::String& accessPointName);
117
118         /**
119          * @see                 NetAccountInfo::GetLocalAddressScheme()
120          */
121         NetAddressScheme GetLocalAddressScheme(void) const;
122
123         /**
124          * @see                 NetAccountInfo::GetLocalAddress()
125          */
126         const IpAddress* GetLocalAddress(void) const;
127
128         /**
129          * @see                 NetAccountInfo::SetLocalAddress()
130          */
131         result SetLocalAddress(NetAddressScheme localAddrScheme, const IpAddress* pLocalAddress);
132
133         /**
134          * @see                 NetAccountInfo::GetDnsAddressScheme()
135          */
136         NetAddressScheme GetDnsAddressScheme(void) const;
137
138         /**
139          * @see                 NetAccountInfo::GetPrimaryDnsAddress()
140          */
141         const IpAddress* GetPrimaryDnsAddress(void) const;
142
143         /**
144          * @see                 NetAccountInfo::GetSecondaryDnsAddress()
145          */
146         const IpAddress* GetSecondaryDnsAddress(void) const;
147
148         /**
149          * @see                 NetAccountInfo::SetDnsAddress()
150          */
151         result SetDnsAddress(NetAddressScheme dnsAddrScheme, const IpAddress* pPrimaryDnsAddress, const IpAddress* pSecondaryDnsAddress);
152
153         /**
154          * @see                 NetAccountInfo::GetProxyAddress()
155          */
156         const NetEndPoint* GetProxyAddress(void) const;
157
158         /**
159          * @see                 NetAccountInfo::SetProxyAddress()
160          */
161         result SetProxyAddress(const NetEndPoint* pProxyEndPoint);
162
163         /**
164          * @see                 NetAccountInfo::GetAuthenticationInfo()
165          */
166         result GetAuthenticationInfo(NetNapAuthType& authenticationType, Tizen::Base::String& id, Tizen::Base::String& password) const;
167
168         /**
169          * @see                 NetAccountInfo::SetAuthenticationInfo()
170          */
171         result SetAuthenticationInfo(NetNapAuthType authenticationType, const Tizen::Base::String& id, const Tizen::Base::String& password);
172
173         /**
174          * @see                 NetAccountInfo::GetBearerType()
175          */
176         NetBearerType GetBearerType(void) const;
177
178         /**
179          * @see                 NetAccountInfo::GetHomeUrl()
180          */
181         Tizen::Base::String GetHomeUrl(void) const;
182
183         /**
184          * @see                 NetAccountInfo::SetHomeUrl()
185          */
186         void SetHomeUrl(const Tizen::Base::String& homeUrl);
187
188         /**
189          * @see                 NetAccountInfo::GetMaximumLengthOfId()
190          */
191         int GetMaximumLengthOfId(void) const;
192
193         /**
194          * @see                 NetAccountInfo::GetMaximumLengthOfPassword()
195          */
196         int GetMaximumLengthOfPassword(void) const;
197
198         /**
199          * @see                 NetAccountInfo::GetMaximumLengthOfAccountName()
200          */
201         int GetMaximumLengthOfAccountName(void) const;
202
203         /**
204          * @see                 NetAccountInfo::IsReadOnly()
205          */
206         bool IsReadOnly(void) const;
207
208         result ConvertToProfileInfo(void* pProfileHandle) const;
209
210         /**
211          * @see                 NetAccountInfo::Equals()
212          */
213         virtual bool Equals(const Tizen::Base::Object& rhs) const;
214
215         /**
216          * @see                 NetAccountInfo::GetHashCode()
217          */
218         virtual int GetHashCode(void) const;
219
220 public:
221         static NetAccountInfo* CreateNetAccountInfoN(void* pProfileHandle);
222
223 public:
224     /**
225      * Gets the Impl instance.
226      *
227      * @since 2.1
228      * @return              The pointer to _NetAccountInfoImpl
229      * @param[in]   netAccountInfo            An instance of NetAccountInfo
230      */
231         static _NetAccountInfoImpl* GetInstance(NetAccountInfo& netAccountInfo);
232
233     /**
234      * Gets the Impl instance.
235      *
236      * @since 2.1
237      * @return              The pointer to  _NetAccountInfoImpl
238      * @param[in]   netAccountInfo     An instance of NetAccountInfo
239      */
240         static const _NetAccountInfoImpl* GetInstance(const NetAccountInfo& netAccountInfo);
241
242 private:
243         /**
244          * Sets the bearer type.
245          *
246          * @since 2.1
247          *
248          * @return              An error code
249          * @param[in]   bearerType                      The type of the bearer
250          * @exception   E_SUCCESS                               The method is successful.
251          * @exception   E_INVALID_STATE                 This instance has not been constructed as yet.
252          * @remarks             If this method fails, the state of this instance does not change.
253          * @see                 GetBearerType()
254          */
255         result SetBearerType(NetBearerType bearerType);
256
257         /**
258          * Sets the account Id.
259          *
260          * @since 2.1
261          *
262          * @return              An error code
263          * @param[in]   accountId                       The account id
264          * @exception   E_SUCCESS                               The method is successful.
265          * @exception   E_INVALID_STATE                 This instance has not been constructed as yet.
266          * @remarks             If this method fails, the state of this instance does not change.
267          * @see                 GetAccountId()
268          */
269         result SetAccountId(NetAccountId accountId);
270
271 private:
272         /**
273          * This is the copy constructor for this class. @n
274          * Do @b not use directly.
275          *
276          * @param[in]   rhs                     An instance of _NetAccountInfoImpl
277          */
278         _NetAccountInfoImpl(const _NetAccountInfoImpl& rhs);
279
280         /**
281          * This is the assignment operator for this class. @n
282          * Do @b not use directly.
283          *
284          * @param[in]   rhs                     An instance of _NetAccountInfoImpl
285          */
286         _NetAccountInfoImpl& operator =(const _NetAccountInfoImpl& rhs);
287
288 private:
289         NetAccountId __accountId;
290         Tizen::Base::String __accountName;
291         Tizen::Base::String __accessPointName;
292         NetNapAuthType  __authType;
293         Tizen::Base::String __authId;
294         Tizen::Base::String __authPassword;
295         Tizen::Base::String __homeUrl;
296         NetBearerType __bearerType;
297         NetProtocolType __protocolType;
298         NetAddressScheme __localAddressScheme;
299         NetAddressScheme __dnsAddressScheme;
300         std::unique_ptr<IpAddress> __pLocalAddress;
301         std::unique_ptr<IpAddress> __pPrimaryDnsAddress;
302         std::unique_ptr<IpAddress> __pSecondaryDnsAddress;
303         std::unique_ptr<NetEndPoint> __pProxyAddress;
304         bool __isReadOnly;
305
306         friend class _NetAccountManagerImpl;
307 }; // _NetAccountInfoImpl
308
309 } } //Tizen::Net
310
311 #endif // _FNET_INTERNAL_NET_ACCOUNT_INFO_IMPL_H_