2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FNetNetAccountInfo.h
20 * @brief This is the header file for the %NetAccountInfo class.
22 * This header file contains the declarations of the %NetAccountInfo class.
24 #ifndef _FNET_NET_ACCOUNT_INFO_H_
25 #define _FNET_NET_ACCOUNT_INFO_H_
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>
36 namespace Tizen { namespace Net
38 class _NetAccountInfoImpl;
41 * @class NetAccountInfo
42 * @brief This class provides methods for all the network accounts.
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).
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>.
54 class _OSP_EXPORT_ NetAccountInfo
55 : public Tizen::Base::Object
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.
64 * @remarks After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
69 * This destructor overrides Tizen::Base::Object::~Object().
73 virtual ~NetAccountInfo(void);
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.
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.
86 result Construct(const NetAccountInfo& netAccountInfo);
89 * Initializes this instance of %NetAccountInfo.
93 * @return An error code
94 * @exception E_SUCCESS The method is successful.
96 result Construct(void);
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.
107 NetAccountId GetAccountId(void) const;
110 * Gets the name of an account.
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()
120 Tizen::Base::String GetAccountName(void) const;
123 * Sets the name of an account. @n
124 * If this method fails, the state of this instance does not change.
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()
133 result SetAccountName(const Tizen::Base::String& accountName);
136 * Gets the protocol type.
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()
145 NetProtocolType GetProtocolType(void) const;
148 * Sets the protocol type.
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()
158 result SetProtocolType(NetProtocolType netProtocolType);
161 * Gets an Access Point Name.
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()
171 Tizen::Base::String GetAccessPointName(void) const;
174 * Sets the name of the access point. @n
175 * If this method fails, the state of this instance does not change.
179 * @return An error code
180 * @param[in] accessPointName The Access Point Name
181 * @exception E_SUCCESS The method is successful.
182 * @see GetAccessPointName()
184 result SetAccessPointName(const Tizen::Base::String& accessPointName);
187 * Gets the setting for the local address scheme. @n
188 * This scheme can be dynamic or static.
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()
198 NetAddressScheme GetLocalAddressScheme(void) const;
201 * Gets the local address.
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()
212 const IpAddress* GetLocalAddress(void) const;
215 * Enables or disables the use of a static local IP address.
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 @c NET_ADDRESS_SCHEME_STATIC, the local IP address assigned is static.
223 * If @c localAddrScheme is set to @c NET_ADDRESS_SCHEME_DYNAMIC or @c 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()
228 result SetLocalAddress(NetAddressScheme localAddrScheme, const IpAddress* pLocalAddress);
231 * Gets the setting for the DNS address scheme.
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()
242 NetAddressScheme GetDnsAddressScheme(void) const;
245 * Gets the setting for the primary DNS address.
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.
254 * - When this instance is got by NetAccountManager::GetNetAccountInfoN(),
255 * - this method returns a statically assigned primary DNS address pointer if the DNS address scheme is NET_ADDRESS_SCHEME_STATIC
256 * - this method returns @n null if the DNS address scheme is @c NET_ADDRESS_SCHEME_DYNAMIC @n
257 * - The specific error code can be accessed using the GetLastResult() method.
258 * @see GetSecondaryDnsAddress()
260 const IpAddress* GetPrimaryDnsAddress(void) const;
263 * Gets the setting for the secondary DNS address.
267 * @return The secondary DNS IP address, @n
268 * else @c null if an error occurs or the dynamic address scheme is being used
269 * @exception E_SUCCESS The method is successful.
270 * @exception E_INVALID_OPERATION This operation is not allowed in the dynamic address scheme.
271 * @remarks The specific error code can be accessed using the GetLastResult() method.
272 * @see SetDnsAddress()
274 const IpAddress* GetSecondaryDnsAddress(void) const;
277 * Enables or disables the use of a static DNS address with the specified IpAddress objects. @n
278 * If @c dnsAddrScheme is @c NET_ADDRESS_SCHEME_DYNAMIC, both @c primaryDnsAddress and @c secondaryDnsAddress are ignored. @n
279 * If @c dnsAddrScheme is @c NET_ADDRESS_SCHEME_STATIC, @c primaryDnsAddress must be a valid IpAddress.
280 * However, @c pSecondaryDnsAddress can be @c null.
284 * @return An error code
285 * @param[in] dnsAddrScheme An indicator specifying whether or not to use a static DNS address
286 * @param[in] pPrimaryDnsAddress The statically assigned primary DNS address if @c dnsAddrScheme is @c NET_ADDRESS_SCHEME_STATIC
287 * @param[in] pSecondaryDnsAddress The statically assigned secondary DNS address if @c dnsAddrScheme is @c NET_ADDRESS_SCHEME_STATIC
288 * @exception E_SUCCESS The method is successful.
289 * @exception E_INVALID_ARG A specified input parameter is invalid.
290 * @see GetPrimaryDnsAddress()
291 * @see GetSecondaryDnsAddress()
293 result SetDnsAddress(NetAddressScheme dnsAddrScheme, const IpAddress* pPrimaryDnsAddress, const IpAddress* pSecondaryDnsAddress);
296 * Gets the proxy address of the network accounts.
300 * @return The proxy address, @n
301 * else @c null if an error occurs or the address is not set
302 * @exception E_SUCCESS The method is successful.
303 * @exception E_UNSUPPORTED_FORMAT The specified address format is not supported.
304 * @remarks The specific error code can be accessed using the GetLastResult() method.
306 const NetEndPoint* GetProxyAddress(void) const;
309 * Sets the proxy address of the network accounts.
313 * @return An error code
314 * @param[in] pProxyEndPoint A pointer to a NetEndPoint instance containing the IP address and port
315 * @exception E_SUCCESS The method is successful.
317 result SetProxyAddress(const NetEndPoint* pProxyEndPoint);
320 * Gets the authentication configuration of network accounts. @n
321 * The user is not provided with read access to the credential information present in the registry if the network account information is extracted from
322 * the registry using @ref NetAccountManager::GetNetAccountInfoN().
326 * @return An error code
327 * @param[out] authenticationType The type of the authentication used
328 * @param[out] id The ID
329 * @param[out] password The password
330 * @exception E_SUCCESS The method is successful.
331 * @exception E_ILLEGAL_ACCESS The user is not provided with read access to the credential information present in the registry, if the network
332 * account information is extracted from the registry using NetAccountManager::GetNetAccountInfoN().
333 * @remarks If this method fails, the state of this instance does not change.
334 * @see SetAuthenticationInfo()
337 result GetAuthenticationInfo(NetNapAuthType& authenticationType, Tizen::Base::String& id, Tizen::Base::String& password) const;
340 * Sets the authentication configuration of the network accounts.
344 * @return An error code
345 * @param[in] authenticationType The type of the authentication used
346 * @param[in] id The ID
347 * @param[in] password The password
348 * @exception E_SUCCESS The method is successful.
349 * @remarks If this method fails, the state of this instance does not change.
350 * @see GetAuthenticationInfo()
353 result SetAuthenticationInfo(NetNapAuthType authenticationType, const Tizen::Base::String& id, const Tizen::Base::String& password);
356 * Gets the operational bearer type of this account.
360 * @return The operational bearer type
361 * @exception E_SUCCESS The method is successful.
362 * @remarks The specific error code can be accessed using the GetLastResult() method.
364 NetBearerType GetBearerType(void) const;
367 * Gets the current URL of a home page.
371 * @return The current URL of a home page
374 Tizen::Base::String GetHomeUrl(void) const;
377 * Sets a URL as a home page.
381 * @param[in] homeUrl The URL to set as a home page
384 void SetHomeUrl(const Tizen::Base::String& homeUrl);
387 * Gets the maximum length of the user name.
391 * @return The maximum length of the user name
393 int GetMaximumLengthOfId(void) const;
396 * Gets the maximum length of the password.
400 * @return The maximum length of the password
402 int GetMaximumLengthOfPassword(void) const;
405 * Gets the maximum length of the account name.
409 * @return The maximum length of the account name
411 int GetMaximumLengthOfAccountName(void) const;
414 * Gets a value that indicates whether the network account is read-only. @n
415 * If it returns @c true, this account is read-only; so any change to this account is not permitted. @n
416 * When it returns @c false, modification is possible.
420 * @return @c true if this account is read only, @n
422 * @exception E_SUCCESS The method is successful.
423 * @remarks The specific error code can be accessed using the GetLastResult() method.
425 bool IsReadOnly(void) const;
428 * Compares the specified instance of %NetAccountInfo with the calling instance.
432 * @return @c true if the values match, @n
434 * @param[in] rhs The other Tizen::Base::Object to compare
435 * @see Tizen::Base::Object::Equals()
437 virtual bool Equals(const Tizen::Base::Object& rhs) const;
440 * Gets the hash value of the current instance.
444 * @return The hash value of the current instance
446 virtual int GetHashCode(void) const;
450 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
452 * @param[in] rhs An instance of %NetAccountInfo
454 NetAccountInfo(const NetAccountInfo& rhs);
457 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
459 * @param[in] rhs An instance of %NetAccountInfo
461 NetAccountInfo& operator =(const NetAccountInfo& rhs);
464 _NetAccountInfoImpl* __pNetAccountInfoImpl;
466 friend class _NetAccountInfoImpl;
471 #endif // _FNET_NET_ACCOUNT_INFO_H_