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 all the 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. For full construction, the Construct() method must be called right after calling this constructor.
63 * @remarks After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
68 * This destructor overrides Tizen::Base::Object::~Object().
72 virtual ~NetAccountInfo(void);
75 * Initializes this instance of %NetAccountInfo with the specified %NetAccountInfo instance. @n
76 * 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.
80 * @return An error code
81 * @param[in] netAccountInfo A %NetAccountInfo instance to initialize the calling instance
82 * @exception E_SUCCESS The method is successful.
83 * @exception E_INVALID_ARG The specified @c netAccountInfo is invalid.
85 result Construct(const NetAccountInfo& netAccountInfo);
88 * Initializes this instance of %NetAccountInfo.
92 * @return An error code
93 * @exception E_SUCCESS The method is successful.
95 result Construct(void);
102 * @return The account ID
103 * @exception E_SUCCESS The method is successful.
104 * @remarks The specific error code can be accessed using the GetLastResult() method.
106 NetAccountId GetAccountId(void) const;
109 * Gets the name of an account.
113 * @return The name of the account, @n
114 * else a null string if the name is not set or not constructed
115 * @exception E_SUCCESS The method is successful.
116 * @remarks The specific error code can be accessed using the GetLastResult() method.
117 * @see SetAccountName()
119 Tizen::Base::String GetAccountName(void) const;
122 * Sets the name of an account. @n
123 * If this method fails, the state of this instance does not change.
127 * @return An error code
128 * @param[in] accountName The name of an account
129 * @exception E_SUCCESS The method is successful.
130 * @see GetAccountName()
132 result SetAccountName(const Tizen::Base::String& accountName);
135 * Gets the protocol type.
139 * @return The type of the protocol
140 * @exception E_SUCCESS The method is successful.
141 * @remarks The specific error code can be accessed using the GetLastResult() method.
142 * @see SetProtocolType()
144 NetProtocolType GetProtocolType(void) const;
147 * Sets the protocol type.
151 * @return An error code
152 * @param[in] netProtocolType The type of the protocol
153 * @exception E_SUCCESS The method is successful.
154 * @remarks If this method fails, the state of this instance does not change.
155 * @see GetProtocolType()
157 result SetProtocolType(NetProtocolType netProtocolType);
160 * Gets an Access Point Name.
164 * @return The Access Point Name, @n
165 * else a null string if the name is not set or the instance is not constructed
166 * @exception E_SUCCESS The method is successful.
167 * @remarks The specific error code can be accessed using the GetLastResult() method.
168 * @see SetAccessPointName()
170 Tizen::Base::String GetAccessPointName(void) const;
173 * Sets the name of the access point. @n
174 * If this method fails, the state of this instance does not change.
178 * @return An error code
179 * @param[in] accessPointName The Access Point Name
180 * @exception E_SUCCESS The method is successful.
181 * @see GetAccessPointName()
183 result SetAccessPointName(const Tizen::Base::String& accessPointName);
186 * Gets the setting for the local address scheme. @n
187 * This scheme can be dynamic or static.
191 * @return The address scheme
192 * @exception E_SUCCESS The method is successful.
193 * @remarks The specific error code can be accessed using the GetLastResult() method.
194 * @see SetLocalAddress()
195 * @see GetLocalAddress()
197 NetAddressScheme GetLocalAddressScheme(void) const;
200 * Gets the local address.
204 * @return The local address, @n
205 * else @c null if an error occurs or the dynamic address scheme is being used
206 * @exception E_SUCCESS The method is successful.
207 * @exception E_INVALID_OPERATION This operation is not allowed in the dynamic address scheme.
208 * @remarks The specific error code can be accessed using the GetLastResult() method.
209 * @see SetLocalAddress()
211 const IpAddress* GetLocalAddress(void) const;
214 * Enables or disables the use of a static local IP address.
218 * @return An error code
219 * @param[in] localAddrScheme An indicator specifying whether to use a static local IP address
220 * @param[in] pLocalAddress The local IP address @n
221 * If @c localAddrScheme is set to NET_ADDRESS_SCHEME_STATIC, the local IP address assigned is static.
222 * If @c localAddrScheme is set to NET_ADDRESS_SCHEME_DYNAMIC or NET_ADDRESS_SCHEME_NONE, this parameter is ignored.
223 * @exception E_SUCCESS The method is successful.
224 * @exception E_INVALID_ARG A specified input parameter is invalid.
225 * @see GetLocalAddress()
227 result SetLocalAddress(NetAddressScheme localAddrScheme, const IpAddress* pLocalAddress);
230 * Gets the setting for the DNS address scheme.
234 * @return The address scheme for the DNS
235 * @exception E_SUCCESS The method is successful.
236 * @remarks The specific error code can be accessed using the GetLastResult() method.
237 * @see GetPrimaryDnsAddress()
238 * @see GetSecondaryDnsAddress()
239 * @see SetDnsAddress()
241 NetAddressScheme GetDnsAddressScheme(void) const;
244 * Gets the setting for the primary DNS address.
248 * @return The IpAddress of primary DNS address, @n
249 * else @c null if an error occurs or the dynamic address scheme is being used
250 * @exception E_SUCCESS The method is successful.
251 * @exception E_INVALID_OPERATION This operation is not allowed in the dynamic address scheme.
252 * @remarks When this instance is got by NetAccountManager::GetNetAccountInfoN(),
253 * - this method returns a statically assigned primary DNS address pointer if the DNS address scheme is NET_ADDRESS_SCHEME_STATIC
254 * - this method returns @n null if the DNS address scheme is @c NET_ADDRESS_SCHEME_DYNAMIC @n
255 * The specific error code can be accessed using the GetLastResult() method.
256 * @see GetSecondaryDnsAddress()
258 const IpAddress* GetPrimaryDnsAddress(void) const;
261 * Gets the setting for the secondary DNS address.
265 * @return The secondary DNS IP address, @n
266 * else @c null if an error occurs or the dynamic address scheme is being used
267 * @exception E_SUCCESS The method is successful.
268 * @exception E_INVALID_OPERATION This operation is not allowed in the dynamic address scheme.
269 * @remarks The specific error code can be accessed using the GetLastResult() method.
270 * @see SetDnsAddress()
272 const IpAddress* GetSecondaryDnsAddress(void) const;
275 * Enables or disables the use of a static DNS address with the specified IpAddress objects. @n
276 * If @c dnsAddrScheme is NET_ADDRESS_SCHEME_DYNAMIC, both @c primaryDnsAddress and @c secondaryDnsAddress are ignored. @n
277 * If @c dnsAddrScheme is NET_ADDRESS_SCHEME_STATIC, @c primaryDnsAddress must be a valid IpAddress.
278 * However, @c pSecondaryDnsAddress can be @c null.
282 * @return An error code
283 * @param[in] dnsAddrScheme An indicator specifying whether or not to use a static DNS address
284 * @param[in] pPrimaryDnsAddress The statically assigned primary DNS address if @c dnsAddrScheme is NET_ADDRESS_SCHEME_STATIC
285 * @param[in] pSecondaryDnsAddress The statically assigned secondary DNS address if @c dnsAddrScheme is NET_ADDRESS_SCHEME_STATIC
286 * @exception E_SUCCESS The method is successful.
287 * @exception E_INVALID_ARG A specified input parameter is invalid.
288 * @see GetPrimaryDnsAddress()
289 * @see GetSecondaryDnsAddress()
291 result SetDnsAddress(NetAddressScheme dnsAddrScheme, const IpAddress* pPrimaryDnsAddress, const IpAddress* pSecondaryDnsAddress);
294 * Gets the proxy address of the network accounts.
298 * @return The proxy address, @n
299 * else @c null if an error occurs or the address is not set
300 * @exception E_SUCCESS The method is successful.
301 * @exception E_UNSUPPORTED_FORMAT The specified address format is not supported.
302 * @remarks The specific error code can be accessed using the GetLastResult() method.
304 const NetEndPoint* GetProxyAddress(void) const;
307 * Sets the proxy address of the network accounts.
311 * @return An error code
312 * @param[in] pProxyEndPoint A pointer to a NetEndPoint instance containing the IP address and port
313 * @exception E_SUCCESS The method is successful.
315 result SetProxyAddress(const NetEndPoint* pProxyEndPoint);
318 * Gets the authentication configuration of network accounts. @n
319 * The user is not provided with read access to the credential information present in the registry if the network account information is extracted from
320 * the registry using @ref NetAccountManager::GetNetAccountInfoN().
324 * @return An error code
325 * @param[out] authenticationType The type of the authentication used
326 * @param[out] id The ID
327 * @param[out] password The password
328 * @exception E_SUCCESS The method is successful.
329 * @exception E_ILLEGAL_ACCESS The user is not provided with read access to the credential information present in the registry, if the network
330 * account information is extracted from the registry using NetAccountManager::GetNetAccountInfoN().
331 * @remarks If this method fails, the state of this instance does not change.
332 * @see SetAuthenticationInfo()
335 result GetAuthenticationInfo(NetNapAuthType& authenticationType, Tizen::Base::String& id, Tizen::Base::String& password) const;
338 * Sets the authentication configuration of the network accounts.
342 * @return An error code
343 * @param[in] authenticationType The type of the authentication used
344 * @param[in] id The ID
345 * @param[in] password The password
346 * @exception E_SUCCESS The method is successful.
347 * @remarks If this method fails, the state of this instance does not change.
348 * @see GetAuthenticationInfo()
351 result SetAuthenticationInfo(NetNapAuthType authenticationType, const Tizen::Base::String& id, const Tizen::Base::String& password);
354 * Gets the operational bearer type of this account.
358 * @return The operational bearer type
359 * @exception E_SUCCESS The method is successful.
360 * @remarks The specific error code can be accessed using the GetLastResult() method.
362 NetBearerType GetBearerType(void) const;
365 * Gets the current URL of a home page.
369 * @return The current URL of a home page
372 Tizen::Base::String GetHomeUrl(void) const;
375 * Sets a URL as a home page.
379 * @param[in] homeUrl The URL to set as a home page
382 void SetHomeUrl(const Tizen::Base::String& homeUrl);
385 * Gets the maximum length of the user name.
389 * @return The maximum length of the user name
391 int GetMaximumLengthOfId(void) const;
394 * Gets the maximum length of the password.
398 * @return The maximum length of the password
400 int GetMaximumLengthOfPassword(void) const;
403 * Gets the maximum length of the account name.
407 * @return The maximum length of the account name
409 int GetMaximumLengthOfAccountName(void) const;
412 * Gets a value that indicates whether the network account is read-only. @n
413 * If it returns @c true, this account is read-only; so any change to this account is not permitted. @n
414 * When it returns @c false, modification is possible.
418 * @return @c true if this account is read only, @n
420 * @exception E_SUCCESS The method is successful.
421 * @remarks The specific error code can be accessed using the GetLastResult() method.
423 bool IsReadOnly(void) const;
426 * Compares the specified instance of %NetAccountInfo with the calling instance.
430 * @return @c true if the values match, @n
432 * @param[in] rhs The other Tizen::Base::Object to compare
433 * @see Tizen::Base::Object::Equals()
435 virtual bool Equals(const Tizen::Base::Object& rhs) const;
438 * Gets the hash value of the current instance.
442 * @return The hash value of the current instance
444 virtual int GetHashCode(void) const;
448 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
450 * @param[in] rhs An instance of %NetAccountInfo
452 NetAccountInfo(const NetAccountInfo& rhs);
455 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
457 * @param[in] rhs An instance of %NetAccountInfo
459 NetAccountInfo& operator =(const NetAccountInfo& rhs);
462 _NetAccountInfoImpl* __pNetAccountInfoImpl;
464 friend class _NetAccountInfoImpl;
469 #endif // _FNET_NET_ACCOUNT_INFO_H_