[Doxygen] Merge LB reviewed doxygen.
[platform/framework/native/net.git] / inc / FNetNetAccountInfo.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 /**
19  * @file                FNetNetAccountInfo.h
20  * @brief               This is the header file for the %NetAccountInfo class.
21  *
22  * This header file contains the declarations of the %NetAccountInfo class.
23  */
24 #ifndef _FNET_NET_ACCOUNT_INFO_H_
25 #define _FNET_NET_ACCOUNT_INFO_H_
26
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29 #include <FBaseResult.h>
30 #include <FBaseErrors.h>
31 #include <FNetNetTypes.h>
32 #include <FNetIpAddress.h>
33 #include <FNetIp4Address.h>
34 #include <FNetNetEndPoint.h>
35
36 namespace Tizen { namespace Net
37 {
38 class _NetAccountInfoImpl;
39
40 /**
41  * @class       NetAccountInfo
42  * @brief       This class provides methods for all the network accounts.
43  *
44  * @since       2.0
45  *
46  * The %NetAccountInfo class provides configuration parameters for setting up network connections.
47  * %NetAccountInfo contains the base information required to connect to various bearers and it is designed to be
48  * used in Programmed Data Processor (PDP) context activation. The Wi-Fi accounts are derived from this class
49  * and contain additional information specific to Wi-Fi (such as SSID).
50  *
51  * For more information on the class features, see
52  * <a href="../org.tizen.native.appprogramming/html/guide/net/network_accounts.htm">Network Accounts</a>.
53  */
54 class _OSP_EXPORT_ NetAccountInfo
55         : public Tizen::Base::Object
56 {
57 public:
58         /**
59         * The object is not fully constructed after this constructor is called. @n
60         * For full construction, the Construct() method must be called right after calling this constructor.
61         *
62         * @since        2.0
63         *
64         * @remarks      After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
65         */
66         NetAccountInfo(void);
67
68         /**
69         * This destructor overrides Tizen::Base::Object::~Object().
70         *
71         * @since        2.0
72         */
73         virtual ~NetAccountInfo(void);
74
75         /**
76          * Initializes this instance of %NetAccountInfo with the specified %NetAccountInfo instance. @n
77          * Only the data part is cloned. Attributes such as NetAccountId and the connection status, which are linked with the registry are set to default values.
78          *
79          * @since               2.0
80          *
81          * @return              An error code
82          * @param[in]   netAccountInfo          A %NetAccountInfo instance to initialize the calling instance
83          * @exception   E_SUCCESS                       The method is successful.
84          * @exception   E_INVALID_ARG           The specified @c netAccountInfo is invalid.
85          */
86         result Construct(const NetAccountInfo& netAccountInfo);
87
88         /**
89          * Initializes this instance of %NetAccountInfo.
90          *
91          * @since               2.0
92          *
93          *      @return         An error code
94          *      @exception      E_SUCCESS                       The method is successful.
95          */
96         result Construct(void);
97
98         /**
99          * Gets an account ID.
100          *
101          * @since               2.0
102          *
103          * @return              The account ID
104          * @exception   E_SUCCESS                               The method is successful.
105          * @remarks             The specific error code can be accessed using the GetLastResult() method.
106          */
107         NetAccountId GetAccountId(void) const;
108
109         /**
110          * Gets the name of an account.
111          *
112          * @since               2.0
113          *
114          * @return              The name of the account, @n
115          *                              else a null string if the name is not set or not constructed
116          * @exception   E_SUCCESS                               The method is successful.
117          * @remarks             The specific error code can be accessed using the GetLastResult() method.
118          * @see                 SetAccountName()
119          */
120         Tizen::Base::String GetAccountName(void) const;
121
122         /**
123          * Sets the name of an account. @n
124          * If this method fails, the state of this instance does not change.
125          *
126          * @since               2.0
127          *
128          * @return              An error code
129          * @param[in]   accountName                             The name of an account
130          * @exception   E_SUCCESS                               The method is successful.
131          * @see                 GetAccountName()
132          */
133         result SetAccountName(const Tizen::Base::String& accountName);
134
135         /**
136          * Gets the protocol type.
137          *
138          * @since               2.0
139          *
140          * @return              The type of the protocol
141          * @exception   E_SUCCESS                               The method is successful.
142          * @remarks             The specific error code can be accessed using the GetLastResult() method.
143          * @see                 SetProtocolType()
144          */
145         NetProtocolType GetProtocolType(void) const;
146
147         /**
148          * Sets the protocol type.
149          *
150          * @since               2.0
151          *
152          * @return              An error code
153          * @param[in]   netProtocolType                 The type of the protocol
154          * @exception   E_SUCCESS                               The method is successful.
155          * @remarks             If this method fails, the state of this instance does not change.
156          * @see                 GetProtocolType()
157          */
158         result SetProtocolType(NetProtocolType netProtocolType);
159
160         /**
161          * Gets an Access Point Name.
162          *
163          * @since               2.0
164          *
165          * @return              The Access Point Name, @n
166          *                              else a null string if the name is not set or the instance is not constructed
167          * @exception   E_SUCCESS                               The method is successful.
168          * @remarks             The specific error code can be accessed using the GetLastResult() method.
169          * @see                 SetAccessPointName()
170          */
171         Tizen::Base::String GetAccessPointName(void) const;
172
173         /**
174          * Sets the name of the access point. @n
175          * If this method fails, the state of this instance does not change.
176          *
177          * @since               2.0
178          *
179          * @return              An error code
180          * @param[in]   accessPointName                 The Access Point Name
181          * @exception   E_SUCCESS                               The method is successful.
182          * @see                 GetAccessPointName()
183          */
184         result SetAccessPointName(const Tizen::Base::String& accessPointName);
185
186         /**
187          * Gets the setting for the local address scheme. @n
188          * This scheme can be dynamic or static.
189          *
190          * @since               2.0
191          *
192          * @return              The address scheme
193          * @exception   E_SUCCESS                               The method is successful.
194          * @remarks             The specific error code can be accessed using the GetLastResult() method.
195          * @see                 SetLocalAddress()
196          * @see                 GetLocalAddress()
197          */
198         NetAddressScheme GetLocalAddressScheme(void) const;
199
200         /**
201          * Gets the local address.
202          *
203          * @since                       2.0
204          *
205          * @return                      The local address, @n
206          *                                      else @c null if an error occurs or the dynamic address scheme is being used
207          * @exception           E_SUCCESS                               The method is successful.
208          * @exception           E_INVALID_OPERATION             This operation is not allowed in the dynamic address scheme.
209          * @remarks                     The specific error code can be accessed using the GetLastResult() method.
210          * @see                         SetLocalAddress()
211          */
212         const IpAddress* GetLocalAddress(void) const;
213
214         /**
215          * Enables or disables the use of a static local IP address.
216          *
217          * @since               2.0
218          *
219          * @return              An error code
220          * @param[in]   localAddrScheme                 An indicator specifying whether to use a static local IP address
221          * @param[in]   pLocalAddress                   The local IP address @n
222          *                                                                              If @c localAddrScheme is set to NET_ADDRESS_SCHEME_STATIC, the local IP address assigned is static.
223          *                                                                              If @c localAddrScheme is set to NET_ADDRESS_SCHEME_DYNAMIC or NET_ADDRESS_SCHEME_NONE, this parameter is ignored.
224          * @exception   E_SUCCESS                               The method is successful.
225          * @exception   E_INVALID_ARG                   A specified input parameter is invalid.
226          * @see                 GetLocalAddress()
227          */
228         result SetLocalAddress(NetAddressScheme localAddrScheme, const IpAddress* pLocalAddress);
229
230         /**
231          * Gets the setting for the DNS address scheme.
232          *
233          * @since               2.0
234          *
235          * @return              The address scheme for the DNS
236          * @exception   E_SUCCESS                       The method is successful.
237          * @remarks             The specific error code can be accessed using the GetLastResult() method.
238          * @see                 GetPrimaryDnsAddress()
239          * @see                 GetSecondaryDnsAddress()
240          * @see                 SetDnsAddress()
241          */
242         NetAddressScheme GetDnsAddressScheme(void) const;
243
244         /**
245          * Gets the setting for the primary DNS address.
246          *
247          * @since                       2.0
248          *
249          * @return                      The IpAddress of primary DNS address, @n
250          *                                      else @c null if an error occurs or the dynamic address scheme is being used
251          * @exception           E_SUCCESS                               The method is successful.
252          * @exception           E_INVALID_OPERATION             This operation is not allowed in the dynamic address scheme.
253          * @remarks                     When this instance is got by NetAccountManager::GetNetAccountInfoN(),
254          *                                      - this method returns a statically assigned primary DNS address pointer if the DNS address scheme is NET_ADDRESS_SCHEME_STATIC
255          *                                      - this method returns @n null if the DNS address scheme is @c NET_ADDRESS_SCHEME_DYNAMIC @n
256          *                      The specific error code can be accessed using the GetLastResult() method.
257          * @see                         GetSecondaryDnsAddress()
258          */
259         const IpAddress* GetPrimaryDnsAddress(void) const;
260
261         /**
262          * Gets the setting for the secondary DNS address.
263          *
264          * @since                       2.0
265          *
266          * @return                      The secondary DNS IP address, @n
267          *                                      else @c null if an error occurs or the dynamic address scheme is being used
268          * @exception           E_SUCCESS                               The method is successful.
269          * @exception           E_INVALID_OPERATION             This operation is not allowed in the dynamic address scheme.
270          * @remarks                     The specific error code can be accessed using the GetLastResult() method.
271          * @see                         SetDnsAddress()
272          */
273         const IpAddress* GetSecondaryDnsAddress(void) const;
274
275         /**
276          * Enables or disables the use of a static DNS address with the specified IpAddress objects. @n
277          * If @c dnsAddrScheme is NET_ADDRESS_SCHEME_DYNAMIC, both @c primaryDnsAddress and @c secondaryDnsAddress are ignored. @n
278          * If @c dnsAddrScheme is NET_ADDRESS_SCHEME_STATIC, @c primaryDnsAddress must be a valid IpAddress.
279          * However, @c pSecondaryDnsAddress can be @c null.
280          *
281          * @since               2.0
282          *
283          * @return              An error code
284          * @param[in]   dnsAddrScheme                   An indicator specifying whether or not to use a static DNS address
285          * @param[in]   pPrimaryDnsAddress              The statically assigned primary DNS address if @c dnsAddrScheme is NET_ADDRESS_SCHEME_STATIC
286          * @param[in]   pSecondaryDnsAddress    The statically assigned secondary DNS address if @c dnsAddrScheme is NET_ADDRESS_SCHEME_STATIC
287          * @exception   E_SUCCESS                               The method is successful.
288          * @exception   E_INVALID_ARG                   A specified input parameter is invalid.
289          * @see                 GetPrimaryDnsAddress()
290          * @see                 GetSecondaryDnsAddress()
291          */
292         result SetDnsAddress(NetAddressScheme dnsAddrScheme, const IpAddress* pPrimaryDnsAddress, const IpAddress* pSecondaryDnsAddress);
293
294         /**
295          * Gets the proxy address of the network accounts.
296          *
297          * @since               2.0
298          *
299          * @return              The proxy address, @n
300          *                              else @c null if an error occurs or the address is not set
301          * @exception   E_SUCCESS                               The method is successful.
302          * @exception   E_UNSUPPORTED_FORMAT    The specified address format is not supported.
303          * @remarks             The specific error code can be accessed using the GetLastResult() method.
304          */
305         const NetEndPoint* GetProxyAddress(void) const;
306
307         /**
308          * Sets the proxy address of the network accounts.
309          *
310          * @since               2.0
311          *
312          * @return              An error code
313          * @param[in]   pProxyEndPoint                  A pointer to a NetEndPoint instance containing the IP address and port
314          * @exception   E_SUCCESS                               The method is successful.
315          */
316         result SetProxyAddress(const NetEndPoint* pProxyEndPoint);
317
318         /**
319          * Gets the authentication configuration of network accounts. @n
320          * The user is not provided with read access to the credential information present in the registry if the network account information is extracted from
321          * the registry using @ref NetAccountManager::GetNetAccountInfoN().
322          *
323          * @since               2.0
324          *
325          * @return              An error code
326          * @param[out]  authenticationType      The type of the authentication used
327          * @param[out]  id                                      The ID
328          * @param[out]  password                        The password
329          * @exception   E_SUCCESS                       The method is successful.
330          * @exception   E_ILLEGAL_ACCESS        The user is not provided with read access to the credential information present in the registry, if the network
331          *                                                                      account information is extracted from the registry using NetAccountManager::GetNetAccountInfoN().
332          * @remarks             If this method fails, the state of this instance does not change.
333          * @see                 SetAuthenticationInfo()
334          *
335          */
336         result GetAuthenticationInfo(NetNapAuthType& authenticationType, Tizen::Base::String& id, Tizen::Base::String& password) const;
337
338         /**
339          * Sets the authentication configuration of the network accounts.
340          *
341          * @since               2.0
342          *
343          * @return              An error code
344          * @param[in]   authenticationType      The type of the authentication used
345          * @param[in]   id                                      The ID
346          * @param[in]   password                        The password
347          * @exception   E_SUCCESS                       The method is successful.
348          * @remarks             If this method fails, the state of this instance does not change.
349          * @see                 GetAuthenticationInfo()
350          *
351          */
352         result SetAuthenticationInfo(NetNapAuthType authenticationType, const Tizen::Base::String& id, const Tizen::Base::String& password);
353
354         /**
355          * Gets the operational bearer type of this account.
356          *
357          * @since               2.0
358          *
359          * @return              The operational bearer type
360          * @exception   E_SUCCESS                       The method is successful.
361          * @remarks             The specific error code can be accessed using the GetLastResult() method.
362          */
363         NetBearerType GetBearerType(void) const;
364
365         /**
366          * Gets the current URL of a home page.
367          *
368          * @since                    2.0
369          *
370          * @return                  The current URL of a home page
371          * @see                      SetHomeUrl()
372          */
373         Tizen::Base::String GetHomeUrl(void) const;
374
375         /**
376          * Sets a URL as a home page.
377          *
378          * @since                  2.0
379          *
380          * @param[in]   homeUrl         The URL to set as a home page
381          * @see                    GetHomeUrl()
382          */
383         void SetHomeUrl(const Tizen::Base::String& homeUrl);
384
385         /**
386          * Gets the maximum length of the user name.
387          *
388          * @since               2.0
389          *
390          * @return              The maximum length of the user name
391          */
392         int GetMaximumLengthOfId(void) const;
393
394         /**
395          * Gets the maximum length of the password.
396          *
397          * @since               2.0
398          *
399          * @return              The maximum length of the password
400          */
401         int GetMaximumLengthOfPassword(void) const;
402
403         /**
404          * Gets the maximum length of the account name.
405          *
406          * @since               2.0
407          *
408          * @return              The maximum length of the account name
409          */
410         int GetMaximumLengthOfAccountName(void) const;
411
412         /**
413          * Gets a value that indicates whether the network account is read-only. @n
414          * If it returns @c true, this account is read-only; so any change to this account is not permitted. @n
415          * When it returns @c false, modification is possible.
416          *
417          * @since               2.0
418          *
419          * @return              @c true if this account is read only, @n
420          *                              else @c false
421          * @exception   E_SUCCESS                               The method is successful.
422          * @remarks             The specific error code can be accessed using the GetLastResult() method.
423          */
424         bool IsReadOnly(void) const;
425
426         /**
427          * Compares the specified instance of %NetAccountInfo with the calling instance.
428          *
429          * @since               2.0
430          *
431          * @return              @c true if the values match, @n
432          *                              else @c false
433          * @param[in]   rhs     The other Tizen::Base::Object to compare
434          * @see                 Tizen::Base::Object::Equals()
435          */
436         virtual bool Equals(const Tizen::Base::Object& rhs) const;
437
438         /**
439          * Gets the hash value of the current instance.
440          *
441          * @since               2.0
442          *
443          * @return      The hash value of the current instance
444          */
445         virtual int GetHashCode(void) const;
446
447 private:
448         /**
449          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
450          *
451          * @param[in]   rhs                     An instance of %NetAccountInfo
452          */
453         NetAccountInfo(const NetAccountInfo& rhs);
454
455         /**
456          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
457          *
458          * @param[in]   rhs An instance of %NetAccountInfo
459          */
460         NetAccountInfo& operator =(const NetAccountInfo& rhs);
461
462 private:
463         _NetAccountInfoImpl* __pNetAccountInfoImpl;
464
465         friend class _NetAccountInfoImpl;
466 }; // NetAccountInfo
467
468 } } //Tizen::Net
469
470 #endif // _FNET_NET_ACCOUNT_INFO_H_