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 FNetNetEndPoint.h
20 * @brief This is the header file for the %NetEndPoint class.
22 * This header file contains the declarations of the %NetEndPoint class.
24 #ifndef _FNET_NET_END_POINT_H_
25 #define _FNET_NET_END_POINT_H_
27 #include <FBaseObject.h>
28 #include <FBaseResult.h>
29 #include <FNetIpAddress.h>
30 #include <FNetSockSocketTypes.h>
32 namespace Tizen { namespace Net
34 class _NetEndPointImpl;
38 * @brief This class identifies the network address.
42 * The %NetEndPoint class provides a base class that represents the network address of a resource or service.
45 class _OSP_EXPORT_ NetEndPoint
46 : public Tizen::Base::Object
50 * This is the default constructor for this class.
57 * Initializes this instance of %NetEndPoint with the specified address and port number.
61 * @param[in] ipAddress The IP address of the target endpoint
62 * @param[in] port The port number
63 * @exception E_SUCCESS The instance is initialized successfully.
64 * @exception E_INVALID_ARG A specified input parameter is invalid.
65 * @remarks The GetLastResult() method is used to check whether the %NetEndPoint instance is created successfully.
67 NetEndPoint(const IpAddress& ipAddress, unsigned short port);
70 * Copying of objects using this copy constructor is allowed.
74 * @param[in] rhs An instance of %NetEndPoint
75 * @exception E_SUCCESS The instance is initialized successfully.
76 * @exception E_INVALID_ARG The specified input parameter is invalid.
77 * @remarks The GetLastResult() method is used to check whether the %NetEndPoint instance is created successfully.
79 NetEndPoint(const NetEndPoint& rhs);
82 * This destructor overrides Tizen::Base::Object::~Object().
86 virtual ~NetEndPoint(void);
89 * Gets the address family to which the calling %NetEndPoint instance belongs.
93 * @return The address family of the calling instance
94 * @exception E_SUCCESS The method is successful.
95 * @exception E_INVALID_STATE This instance is in an invalid state.
97 NetAddressFamily GetNetAddressFamily(void) const;
100 * Gets the port number of the endpoint.
104 * @return The port number of the endpoint
105 * @exception E_SUCCESS The method is successful.
106 * @exception E_INVALID_STATE This instance is in an invalid state.
108 unsigned short GetPort(void) const;
111 * Gets the IP address of the calling instance.
115 * @return The IP address of the endpoint, @n
116 * else @c null if the address information is invalid
117 * @exception E_SUCCESS The method is successful.
118 * @exception E_INVALID_STATE This instance is in an invalid state.
120 IpAddress* GetAddress(void) const;
123 * Gets the current endpoint.
127 * @return The current endpoint, @n
128 * else @c null string if an error occurs
129 * @exception E_SUCCESS The method is successful.
130 * @exception E_INVALID_STATE This instance is in an invalid state.
132 * - The string output of this method is formatted as follows: IPADDRESS:PORT. @n
133 * IPADDRESS is a string representing a number expressed in the Internet Standard "." (dotted) notation (for example, 165.213.173.7). @n
134 * PORT is a string representing a port number in host byte order. For example, 165.213.173.7:2000 is a possible string.
135 * - The specific error code can be accessed using the GetLastResult() method.
137 Tizen::Base::String GetNetEndPoint(void) const;
140 * Copying of objects using this copy assignment operator is allowed.
144 * @return The reference of this instance
145 * @param[in] rhs An instance of %NetEndPoint
146 * @remarks The GetLastResult() method is used to check whether the %NetEndPoint instance is copied successfully.
148 NetEndPoint& operator =(const NetEndPoint& rhs);
151 * Compares the specified instance of %NetEndPoint with the calling instance.
155 * @return @c true if the values match, @n
157 * @param[in] rhs The other Tizen::Base::Object to compare
158 * @see Tizen::Base::Object::Equals()
160 virtual bool Equals(const Tizen::Base::Object& rhs) const;
163 * Gets the hash value of the current instance.
167 * @return The hash value of the current instance
169 virtual int GetHashCode(void) const;
172 _NetEndPointImpl* __pNetEndPointImpl;
174 friend class _NetEndPointImpl;
179 #endif // _FNET_NET_END_POINT_H_