Socket: Add additional port-only constructor for INet[46]SocketAddress
[senf.git] / Socket / Protocols / INet / INetAddressing.hh
index 9a30aff..57efbe4 100644 (file)
@@ -60,6 +60,10 @@ namespace senf {
           public senf::comparable_safe_bool<INet4SocketAddress>
     {
     public:
+        ///////////////////////////////////////////////////////////////////////////
+        ///\name Structors and default members
+        ///@{
+
         INet4SocketAddress();
         explicit INet4SocketAddress(std::string const & addr); ///< Set address and port
                                         /**< This constructor expects a string of the form
@@ -77,6 +81,13 @@ namespace senf {
                                         /**< \param[in] addr IP address
                                              \param[in] port port number */
 
+        explicit INet4SocketAddress(unsigned port);
+                                        ///< Set port, address is set to 0.0.0.0
+                                        /**< \param[in] port port number */
+
+        ///@}
+        ///////////////////////////////////////////////////////////////////////////
+
         bool operator==(INet4SocketAddress const & other) const;
                                         ///< Check INet4SocketAddress for equality
 
@@ -141,12 +152,11 @@ namespace senf {
         \ingroup addr_group
      */
     class INet6SocketAddress
+        : public boost::equality_comparable<INet6SocketAddress>, 
+          public senf::comparable_safe_bool<INet6SocketAddress>
     {
     public:
         ///////////////////////////////////////////////////////////////////////////
-        // Types
-
-        ///////////////////////////////////////////////////////////////////////////
         ///\name Structors and default members
         ///@{
 
@@ -166,12 +176,15 @@ namespace senf {
                                         ///< Initialize from address and port
         INet6SocketAddress(INet6Address const & addr, unsigned port, std::string const & iface);
                                         ///< Initialize explicitly from given parameters
+        explicit INet6SocketAddress(unsigned port);
+                                        ///< Initialize from port and set to 'unspecified' addr
+                                        /**< The address is set to [::]
+                                             \param[in] port port number  */
 
         ///@}
         ///////////////////////////////////////////////////////////////////////////
 
         bool operator==(INet6SocketAddress const & other) const; ///< Check addresses for equality
-        bool operator!=(INet6SocketAddress const & other) const; ///< Inverse of above
 
         void clear();                   ///< Clear socket address
 
@@ -185,6 +198,8 @@ namespace senf {
         std::string iface() const;      ///< Get interface name
         void iface(std::string const & iface); ///< Change interface
 
+        bool boolean_test() const;      ///< \c true, if address is not empty (i.e. [::]:0)
+
         ///\name Generic SocketAddress interface
         ///@{
 
@@ -213,7 +228,7 @@ namespace senf {
     /** \brief Addressing policy supporting IPv4 addressing
 
         \par Address Type:
-            INet4Address
+            INet4SocketAddress
 
         This addressing policy implements addressing using Internet V4
         addresses.