#include <exception>
#include <netinet/in.h>
#include <boost/operators.hpp>
-#include "Socket/SocketPolicy.hh"
-#include "Socket/ClientSocketHandle.hh"
-#include "Socket/CommunicationPolicy.hh"
-#include "Socket/Protocols/GenericAddressingPolicy.hh"
+#include "../../../Socket/SocketPolicy.hh"
+#include "../../../Socket/ClientSocketHandle.hh"
+#include "../../../Socket/CommunicationPolicy.hh"
+#include "../../../Socket/Protocols/GenericAddressingPolicy.hh"
+#include "../../../Utils/safe_bool.hh"
#include "INet4Address.hh"
#include "INet6Address.hh"
*/
class INet4SocketAddress
: public boost::equality_comparable<INet4SocketAddress>,
- public senf::ComparableSafeBool<INet4SocketAddress>
+ public senf::comparable_safe_bool<INet4SocketAddress>
{
public:
INet4SocketAddress();
- explicit INet4SocketAddress(std::string const & address); ///< Set address and port
+ explicit INet4SocketAddress(std::string const & addr); ///< Set address and port
/**< This constructor expects a string of the form
'host:port'. The constructor will use this value to
initialize the host and port members. Since it uses the
INet4Address::from_string constructor, this call may
block while waiting for the resolver.
- \throws SyntaxException if the 'host:port' syntax is
- not obeyed.
- \throws INet4Address::SyntaxException if the host part
- cannot be converted to an IP address. */
+ \throws SyntaxException if the address syntax is
+ invalid
+ \throws INet4Address::UnknownHostnameException if the
+ address cannot be resolved. */
INet4SocketAddress(INet4Address const & addr, unsigned port);
///< Set address and port explicitly
///@{
INet6SocketAddress(); ///< Create empty instance
- explicit INet6SocketAddress(std::string const & addr);
+ explicit INet6SocketAddress(std::string const & addr,
+ INet6Address::Resolve_t resolve = INet6Address::ResolveINet6);
///< Initialize/convert from string representation
+ /**< \throws SyntaxException if the address syntax is
+ invalid
+ \throws INet6Address::UnknownHostnameException if the
+ address cannot be resolved.
+ \param[in] addr Address to parse
+ \param[in] resolve If this is
+ INet6Address::ResolveINet4, support IpV4
+ addresses. See INet6Address. */
INet6SocketAddress(INet6Address const & addr, unsigned port);
///< Initialize from address and port
INet6SocketAddress(INet6Address const & addr, unsigned port, std::string const & iface);
///< Initialize explicitly from given parameters
- INet6SocketAddress(std::string const & addr, std::string const & iface);
- ///< Initialize from URL representation and explit interface
///@}
///////////////////////////////////////////////////////////////////////////
protected:
private:
- void assignAddr(std::string const & addr);
void assignIface(std::string const & iface);
struct sockaddr_in6 sockaddr_;