Complete Socket library documentation
[senf.git] / Socket / INetAddressing.cc
index 013704d..d96bd93 100644 (file)
@@ -20,7 +20,9 @@
 // Free Software Foundation, Inc.,
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-// Definition of non-inline non-template functions
+/** \file
+    \brief INet[46]Address and INet[46]AddressingPolicy non-inline non-template implementation
+ */
 
 #include "INetAddressing.hh"
 //#include "INetAddressing.ih"
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-prefix_ satcom::lib::INet4Address::INet4Address(std::string host, unsigned port)
+prefix_ senf::INet4Address::INet4Address(std::string host, unsigned port)
 {
     clear();
-    // TODO: gethostbyname einbauen
+    /** \todo  gethostbyname support */
     if (::inet_aton(host.c_str(), &addr_.sin_addr) == 0)
         throw InvalidINetAddressException();
     addr_.sin_port = htons(port);
 }
 
-prefix_ std::string satcom::lib::INet4Address::str()
+prefix_ std::string senf::INet4Address::str()
     const
 {
     std::stringstream s;
@@ -52,26 +54,27 @@ prefix_ std::string satcom::lib::INet4Address::str()
     return s.str();
 }
 
-prefix_ void satcom::lib::INet4Address::clear()
+prefix_ void senf::INet4Address::clear()
 {
     ::memset(&addr_,0,sizeof(addr_));
     addr_.sin_family = AF_INET;
 }
 
-prefix_ void satcom::lib::INet4Address::assignString(std::string address)
+prefix_ void senf::INet4Address::assignString(std::string address)
 {
     clear();
-    // TODO: gethostbyname einbauen
     unsigned i = address.find(':');
     if (i == std::string::npos)
         throw InvalidINetAddressException();
+    // The temporary string in the next expr is guaranteed to live
+    // until end-of-statement
     if (::inet_aton(std::string(address,0,i).c_str(), &addr_.sin_addr) == 0)
         throw InvalidINetAddressException();
     try {
         // Replace lexical_cast with strtoul ?
         addr_.sin_port = htons(boost::lexical_cast< ::u_int16_t >(std::string(address,i+1)));
     } 
-    catch (boost::bad_lexical_cast const & ex) {
+    catch (boost::bad_lexical_cast const &) {
         throw InvalidINetAddressException();
     }
 }
@@ -83,5 +86,5 @@ prefix_ void satcom::lib::INet4Address::assignString(std::string address)
 \f
 // Local Variables:
 // mode: c++
-// c-file-style: "satcom"
+// c-file-style: "senf"
 // End: