Socket/Protocols/INet: Change INet4Address to use a boost::array for storage
g0dil [Fri, 27 Jul 2007 12:14:51 +0000 (12:14 +0000)]
Socket/Protocols/INet: Add INet4Address documentation
Fix some missed INet4Address -> INet4SocketAddress renames
Fixed several std:string arguments to use std::string const &

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@358 270642c3-0616-0410-b53a-bc976706d245

25 files changed:
Examples/MCSniffer/MCSniffer.cc
Examples/TCPClientServer/client.cc
Examples/TCPClientServer/server.cc
Packets/DataPacket.hh
SConstruct
Scheduler/WriteHelper.ct
Scheduler/WriteHelper.cti
Scheduler/WriteHelper.hh
Socket/Doxyfile
Socket/FileHandle.test.cc
Socket/Protocols/INet/INet4Address.cc
Socket/Protocols/INet/INet4Address.cci
Socket/Protocols/INet/INet4Address.ct [moved from Socket/Protocols/INet/INet4Address.cti with 77% similarity]
Socket/Protocols/INet/INet4Address.hh
Socket/Protocols/INet/INet4Address.test.cc
Socket/Protocols/INet/INetAddressing.cc
Socket/Protocols/INet/INetAddressing.cci
Socket/Protocols/INet/INetAddressing.hh
Socket/Protocols/INet/UDPProtocol.cc
Socket/Protocols/INet/UDPProtocol.hh
Socket/Protocols/Raw/LLAddressing.cc
Socket/Protocols/Raw/LLAddressing.hh
Socket/Protocols/Raw/MACAddress.ct
Socket/Protocols/Raw/PacketSocketHandle.cc
senf.dict

index 2cbb2a3..8976c3d 100644 (file)
@@ -86,7 +86,7 @@ class MCSniffer
     std::ostream& stream;
 
 public:
-    MCSniffer(senf::INet4Address addr, std::ostream& s)
+    MCSniffer(senf::INet4SocketAddress addr, std::ostream& s)
         : stream(s)
     {
         sock.protocol().bind(addr);
@@ -118,9 +118,9 @@ int main(int argc, char const * argv[])
         std::ofstream f2 ("233.132.152.2.txt");
         
         MCSniffer sniffer1 (
-            senf::INet4Address::INet4Address("233.132.152.1:22344"), f1);
+            senf::INet4SocketAddress("233.132.152.1:22344"), f1);
         MCSniffer sniffer2 (
-            senf::INet4Address::INet4Address("233.132.152.2:22344"), f2);
+            senf::INet4SocketAddress("233.132.152.2:22344"), f2);
             
         senf::Scheduler::instance().process();
     }
index b3b65e7..12fb87a 100644 (file)
 #include "Socket/Protocols/INet/TCPSocketHandle.hh"
 #include "Socket/Protocols/INet/INetAddressing.hh"
 
-
 int main(int argc, char const * argv[])
 {
     try {
         for (int i=0; i<=1000; i++) {
             senf::TCPv4ClientSocketHandle sock;
-            sock.connect(senf::INet4Address("127.0.0.1", 4243));
+            sock.connect(senf::INet4SocketAddress("127.0.0.1", 4243));
             sock.protocol().linger(true);
             
             std::stringstream s;
@@ -50,3 +49,14 @@ int main(int argc, char const * argv[])
     
     return 0;
 }
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u"
+// comment-column: 40
+// End:
index aba64d0..dc53e5e 100644 (file)
@@ -39,7 +39,7 @@ class Server
 
 public:
     Server(std::string const & host, unsigned int port)
-        : serverSock(senf::INet4Address(host, port)) {}
+        : serverSock(senf::INet4SocketAddress(host, port)) {}
     
     void run() 
     {
@@ -83,3 +83,14 @@ int main(int argc, char const * argv[])
     }
     return 0;
 }
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u"
+// comment-column: 40
+// End:
index 33c2d63..62e1200 100644 (file)
 
 namespace senf {
 
-    /** \brief Internal: Packet type of DataPacket
-
-        \internal
-     */
-    struct DataPacketType : public PacketTypeBase
-    {};
+    /** \brief Generic payload-only packet
 
+        \par Packet type (typedef):
+            \ref DataPacket
 
-    /** \brief Generic payload-only packet
-        
         DataPacket is a simple generic packet with just a payload of uninterpreted data. This is the
         packet used whenever no more specific packet type can be found for a sub-packet (e.g. as the
         payload data of a UDP packet)
 
         \ingroup packet_module
      */
+    struct DataPacketType : public PacketTypeBase
+    {};
+
+    /** \brief Generic payload-only packet typedef */
     typedef ConcretePacket<DataPacketType> DataPacket;
 }
 
index 7d09e74..6a98c7d 100644 (file)
@@ -6,13 +6,6 @@ import SENFSCons
 
 ###########################################################################
 
-# Load subversion information
-svninfo = dict(
-    [ map(lambda y:y.strip(),x.split(":",1))
-      for x in os.popen("svn info").read().split("\n")
-      if ':' in x ] )
-svninfo['commited'] = not(os.popen("svn status -q").read())
-
 # Load utilities and setup libraries
 SENFSCons.UseBoost()
 SENFSCons.UseSTLPort()
@@ -25,7 +18,7 @@ env.Append(
    DOXY_XREF_TYPES = [ 'bug', 'fixme', 'todo', 'idea' ],
    DOXY_HTML_XSL = '#/doclib/html-munge.xsl',
    ENV = { 'TODAY' : str(datetime.date.today()),
-           'REVISION' : svninfo['Revision'] + (not(svninfo['commited']) and " + local changes" or ""),
+           'REVISION' : os.popen("svnversion").read().strip()
            },
 )
 
index 0b18fcc..758d8b5 100644 (file)
@@ -32,7 +32,7 @@
 ///////////////////////////////ct.p////////////////////////////////////////
 
 template <class Handle>
-prefix_ senf::WriteHelper<Handle>::WriteHelper(Handle handle, std::string data,
+prefix_ senf::WriteHelper<Handle>::WriteHelper(Handle handle, std::string const & data,
                                                       Callback callback)
     : handle_(handle), data_(data), callback_(callback),
       offset_(data_.begin()), errno_(0)
index 12e7e0f..e57f0e5 100644 (file)
@@ -31,7 +31,7 @@
 
 template <class Handle>
 prefix_ typename senf::WriteHelper<Handle>::ptr
-senf::WriteHelper<Handle>::dispatch(Handle handle, std::string data, Callback callback)
+senf::WriteHelper<Handle>::dispatch(Handle handle, std::string const & data, Callback callback)
 {
     return ptr(new WriteHelper(handle, data, callback));
 }
index 65b58a8..4fa3162 100644 (file)
@@ -65,7 +65,7 @@ namespace senf {
         ///\name Structors and default members
         ///@{
 
-        static ptr dispatch(Handle handle, std::string data, Callback callback);
+        static ptr dispatch(Handle handle, std::string const & data, Callback callback);
                                         ///< Register new WriteHelper instance
                                         /**< The registered callback will be called after all \a
                                              data has been sent or when some error condition is
@@ -95,7 +95,7 @@ namespace senf {
     protected:
 
     private:
-        WriteHelper(Handle handle, std::string data, Callback callback);
+        WriteHelper(Handle handle, std::string const & data, Callback callback);
 
         static void dispatchProcess(ptr helper, Handle handle, senf::Scheduler::EventId event);
         void process(Handle handle, senf::Scheduler::EventId event);
index 9a93817..529749f 100644 (file)
@@ -4,4 +4,4 @@ PROJECT_NAME = libSocket
 TAGFILES = "$(TOPDIR)/Utils/doc/Utils.tag"
 GENERATE_TAGFILE = doc/Socket.tag
 RECURSIVE = Yes
-
+SHOW_DIRECTORIES = Yes
index 21b3708..f4dac9d 100644 (file)
@@ -45,7 +45,7 @@ namespace {
         FHandle(int fd)
             : senf::FileHandle(std::auto_ptr<senf::FileBody>(
                                           new senf::FileBody(fd))) {}
-        FHandle(std::string name)
+        FHandle(std::string const & name)
             : senf::FileHandle(std::auto_ptr<senf::FileBody>(
                                           new senf::FileBody()))
             {
index 2833d57..5495e32 100644 (file)
 // senf::INet4Address::INet4Address
 
 prefix_ senf::INet4Address::INet4Address(address_type value)
-    : addr_(htonl(value))
-{}
+{
+    iref() = htonl(value);
+}
 
 prefix_ senf::INet4Address senf::INet4Address::from_string(std::string const & s)
 {
-    ::in_addr ina;
+    struct in_addr ina;
     if (::inet_pton(AF_INET,s.c_str(),&ina) > 0)
         return senf::INet4Address::from_inaddr(ina.s_addr);
+    int herr (0);
+
+    // If available, we use the reentrant GNU variant. This has the additional advantage, that we
+    // can explicitly ask for IpV4 addresses
+
+#   ifdef __GLIBC__
+
+    struct hostent entbuf;
+    char buffer[4096];
+    struct hostent * ent (0);
+    ::gethostbyname2_r(s.c_str(), AF_INET, &entbuf, buffer, sizeof(buffer), &ent, &herr);
+
+#   else // ! __GLIBC__
+
 #   ifdef _REENTRANT
     static boost::mutex mutex;
     boost::mutex::scoped_lock lock(mutex);
 #   endif
-    ::hostent * ent (::gethostbyname(s.c_str()));
+    struct hostent * ent (::gethostbyname(s.c_str()));
+    herr = h_errno;
+
+#   endif // __GLIBC__
+
     if (!ent)
         ///\fixme Need to give better exception here
         throw SyntaxException(); 
     if (ent->h_addrtype != AF_INET)
         throw SyntaxException();    
+
     // We are only interested in the first address ...
     return senf::INet4Address::from_inaddr(
         reinterpret_cast<in_addr*>(*(ent->h_addr_list))->s_addr);
@@ -66,7 +86,7 @@ prefix_ senf::INet4Address senf::INet4Address::from_string(std::string const & s
 prefix_ bool senf::INet4Address::local()
     const
 {
-    address_type l (ntohl(addr_));
+    address_type l (address());
     return 
         (l & 0xFF000000u) == 0x0A000000u ||
         (l & 0xFFF00000u) == 0xAC100000u ||
@@ -77,13 +97,19 @@ prefix_ bool senf::INet4Address::local()
 prefix_ bool senf::INet4Address::loopback()
     const
 {
-    return (ntohl(addr_) & 0xFF000000u) == 0x7F000000u;
+    return (address() & 0xFF000000u) == 0x7F000000u;
 }
 
 prefix_ bool senf::INet4Address::multicast()
     const
 {
-    return (ntohl(addr_) & 0xF0000000u) == 0xE0000000u;
+    return (address() & 0xF0000000u) == 0xE0000000u;
+}
+
+prefix_ senf::INet4Address::address_type senf::INet4Address::address()
+    const
+{
+    return ntohl(iref());
 }
 
 senf::INet4Address const senf::INet4Address::None;
@@ -98,7 +124,7 @@ prefix_ std::ostream & senf::operator<<(std::ostream & os, INet4Address const &
 {
     ::in_addr ina;
     char buffer[16];
-    ina.s_addr = addr.raw();
+    ina.s_addr = addr.inaddr();
     ::inet_ntop(AF_INET,&ina,buffer,16);
     buffer[15] = 0; 
     os << buffer;
index bf593e0..0f9e232 100644 (file)
 // senf::INet4Address
 
 prefix_ senf::INet4Address::INet4Address()
-    : addr_()
+{
+    std::fill(begin(), end(), 0u);
+}
+
+prefix_ senf::INet4Address::INet4Address(NoInit_t)
 {}
 
-prefix_ senf::INet4Address senf::INet4Address::from_inaddr(unsigned long v)
+prefix_ senf::INet4Address senf::INet4Address::from_inaddr(inaddr_type v)
 {
-    INet4Address addr;
-    addr.addr_ = v;
-    return addr;
+    return INet4Address(v,IsInAddr);
+}
+
+prefix_ senf::INet4Address::INet4Address(inaddr_type addr, InAddr_t)
+{
+    iref() = addr;
 }
 
 prefix_ bool senf::INet4Address::broadcast()
     const
 {
-    return addr_ == 0xFFFFFFFFu;
+    return inaddr() == 0xFFFFFFFFu;
 }
 
 prefix_ bool senf::INet4Address::boolean_test()
     const
 {
-    return addr_;
+    return inaddr();
+}
+
+prefix_ senf::INet4Address::inaddr_type senf::INet4Address::inaddr()
+    const
+{
+    return iref();
+}
+
+prefix_ senf::INet4Address::inaddr_type & senf::INet4Address::iref()
+{
+    return *reinterpret_cast<inaddr_type *>(&(*this)[0]);
 }
 
-prefix_ unsigned long senf::INet4Address::raw()
+prefix_ senf::INet4Address::inaddr_type senf::INet4Address::iref()
     const
 {
-    return addr_;
+    return *reinterpret_cast<inaddr_type const *>(&(*this)[0]);
 }
 
 ///////////////////////////////cci.e///////////////////////////////////////
similarity index 77%
rename from Socket/Protocols/INet/INet4Address.cti
rename to Socket/Protocols/INet/INet4Address.ct
index e13fdbb..0dd4857 100644 (file)
 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 /** \file
-    \brief INet4Address inline template implementation */
+    \brief INet4Address non-inline template implementation  */
 
 //#include "INet4Address.ih"
 
 // Custom includes
 
-#define prefix_ inline
-///////////////////////////////cti.p///////////////////////////////////////
+#define prefix_
+///////////////////////////////ct.p////////////////////////////////////////
 
 ///////////////////////////////////////////////////////////////////////////
 // senf::INet4Address
 template <class InputIterator>
 prefix_ senf::INet4Address senf::INet4Address::from_data(InputIterator i)
 {
-    address_type v ((address_type(*i)&0xFF) << 24);
-    v |= (address_type(*++i)&0xFF) << 16;
-    v |= (address_type(*++i)&0xFF) <<  8;
-    v |= (address_type(*++i)&0xFF);
-    return senf::INet4Address(v);
+    INet4Address addr (INet4Address::noinit);
+    iterator j (addr.begin());
+    iterator const j_end (addr.end());
+    for (;j!=j_end;++j,++i)
+        *j = *i;
+    return addr;
 }
 
-///////////////////////////////cti.e///////////////////////////////////////
+///////////////////////////////ct.e////////////////////////////////////////
 #undef prefix_
 
 \f
index 303ea4b..f075555 100644 (file)
@@ -28,6 +28,8 @@
 #include <iostream>
 #include <string>
 #include <boost/cstdint.hpp>
+#include <boost/function.hpp>
+#include <boost/array.hpp>
 #include "Utils/SafeBool.hh"
 
 //#include "INet4Address.mpp"
 
 namespace senf {
     
-    /** \brief
+    /** \brief IpV4 Internet address
+        
+        INet4Address represents a simple IP address. It is modelled as a fixed-size
+        container/sequence of 4 bytes.
+
+        \todo Add additional classes for CIDR addresses and networks and network math.
       */
     class INet4Address
-        : public ComparableSafeBool<INet4Address>
+        : public boost::array<boost::uint8_t,4>, 
+          public ComparableSafeBool<INet4Address>
+
     {
     public:
-        typedef uint32_t address_type;
+        typedef uint32_t address_type;  ///< Address representation as number in host byte order
+        typedef uint32_t inaddr_type;   ///< Legacy address representation in network byte order
+        typedef boost::function<void (INet4Address const &)> Callback;
+                                        ///< Callback for asynchronous from_string call
+
+        static INet4Address const None; ///< The empty (0) address
+        static INet4Address const Loopback; ///< The loopback (127.0.0.1) address
+        static INet4Address const Broadcast; ////< The global broadcast (255.255.255.255) address
 
-        static INet4Address const None;
-        static INet4Address const Loopback;
-        static INet4Address const Broadcast;
+        enum NoInit_t { noinit };
 
-        INet4Address();
+        INet4Address();                 ///< Construct an empty address
+        INet4Address(NoInit_t);         ///< Construct uninitialized (!) address
         explicit INet4Address(address_type value);
+                                        ///< Construct an address constant
 
         static INet4Address from_string(std::string const & s);
+                                        ///< Convert string to address
+                                        /**< This member will try to convert the given string into
+                                             an IP address. from_string() supports all standard IP
+                                             literal representations as well es hostnames.
+                                             \attention This call may block if \a s represents a
+                                                 hostname which must be looked up via some network
+                                                 protocol like DNS or NIS
+                                             \throws SyntaxException if the address cannot be
+                                                 converted for some reason
+                                             \param[in] s Address literal or hostname */
+        
+        static void from_string(std::string const & s, Callback const & cb);
+                                        ///< Convert string to address (async/non-blocking)
+                                        /**< This member works like
+                                             from_string(std::string const &). However unlike
+                                             from_string(std::string const &), this call will not
+                                             block. Instead it will call \a cb passing the
+                                             INet4Address instance as soon as the address has been
+                                             resolved (which may be immediate if the address
+                                             represents an IP literal). \par
+                                             On error, the address passed to \a cb will be empty.
+                                             \param[in] s Address literal or hostname
+                                             \param[in] cb Callback to pass the address to 
+                                             \fixme Implement */
+
         template <class InputIterator> 
         static INet4Address from_data(InputIterator i);
-        static INet4Address from_inaddr(unsigned long v);
-
-        bool local() const;
-        bool loopback() const;
-        bool multicast() const;
-        bool broadcast() const;
-        bool boolean_test() const;
-
-        unsigned long raw() const;
+                                        ///< Construct address from 4 bytes of raw data
+                                        /**< from_data will build an address from 4 bytes of raw
+                                             data as accessed by the iterator. The data must be in
+                                             network byte order. */
+        static INet4Address from_inaddr(inaddr_type v);
+                                        ///< Construct address from integer in network byte order
+                                        /**< This call is used when interfacing with other legacy
+                                             code to convert a network byte order address in an
+                                             integer number into an INet4Address. */
+
+        bool local() const;             ///< \c true, if address is locally administered
+                                        /**< This call checks, if the address is within one of the
+                                             IANA private ranges. */
+        bool loopback() const;          ///< \c true, if address is within the loopback network
+                                        /**< Checks, whether the address is in the IANA loopback
+                                             network 10.0.0.0/8 */
+        bool multicast() const;         ///< \c true, if address is a multicast address
+                                        /**< Checks, whether the address is in the 224.0.0.0/4
+                                             network reserved for multicast addresses by the
+                                             IANA. */
+        bool broadcast() const;         ///< \c true, if address is 255.255.255.255
+        bool boolean_test() const;      ///< \c true, if address is non-empty (!= 0.0.0.0)
+
+        inaddr_type inaddr() const;     ///< Return the raw network byte order address
+                                        /**< This member is used to interact with legacy code. 
+                                             \return */
+        address_type address() const;   ///< Return address represented as integer number
+                                        /**< This member returns the address as an integer number in
+                                             host byte order. This representation allows simple
+                                             network math operations. */
 
         struct SyntaxException : public std::exception
         { virtual char const * what() const throw() { return "invalid INet4 address syntax"; } };
 
     private:
-        // Hmm ... address_type or unsigned long? I'd use address_type but the man pages for in_addr
-        // have sa_addr as unsigned long
-        unsigned long addr_;
+        enum InAddr_t { IsInAddr };
+        INet4Address(inaddr_type addr, InAddr_t);
+        inaddr_type & iref();
+        inaddr_type iref() const;
     };
 
     std::ostream & operator<<(std::ostream & os, INet4Address const & addr);
@@ -78,8 +141,8 @@ namespace senf {
 
 ///////////////////////////////hh.e////////////////////////////////////////
 #include "INet4Address.cci"
-//#include "INet4Address.ct"
-#include "INet4Address.cti"
+#include "INet4Address.ct"
+//#include "INet4Address.cti"
 #endif
 
 \f
index e4d92de..186202f 100644 (file)
@@ -37,7 +37,7 @@
 
 BOOST_AUTO_UNIT_TEST(inet4Address)
 {
-    senf::INet4Address addr  (senf::INet4Address::from_string("127.0.0.1"));
+    senf::INet4Address addr (senf::INet4Address::from_string("127.0.0.1"));
     BOOST_CHECK_EQUAL( addr, senf::INet4Address::Loopback );
 
     addr = senf::INet4Address::from_string("localhost");
@@ -47,7 +47,8 @@ BOOST_AUTO_UNIT_TEST(inet4Address)
     char data[] = { 128, 129, 130, 131 };
     addr = senf::INet4Address::from_data(data);
     BOOST_CHECK_EQUAL( addr, senf::INet4Address::from_string("128.129.130.131") );
-    BOOST_CHECK_EQUAL( addr.raw(), htonl(0x80818283u) );
+    BOOST_CHECK_EQUAL( addr.inaddr(), htonl(0x80818283u) );
+    BOOST_CHECK_EQUAL( addr.address(), 0x80818283u );
 
     BOOST_CHECK( ! addr.loopback() );
     BOOST_CHECK( ! addr.local() );
index 519a202..5f58af8 100644 (file)
@@ -43,7 +43,7 @@
 ///////////////////////////////////////////////////////////////////////////
 // senf::INet4Address
 
-prefix_ senf::INet4SocketAddress::INet4SocketAddress(std::string host, unsigned port)
+prefix_ senf::INet4SocketAddress::INet4SocketAddress(std::string const & host, unsigned port)
 {
     clear();
     /** \todo  gethostbyname support */
@@ -66,7 +66,7 @@ prefix_ void senf::INet4SocketAddress::clear()
     addr_.sin_family = AF_INET;
 }
 
-prefix_ void senf::INet4SocketAddress::assignString(std::string address)
+prefix_ void senf::INet4SocketAddress::assignString(std::string const & address)
 {
     clear();
     unsigned i = address.find(':');
index 8c399f6..4b28057 100644 (file)
@@ -43,7 +43,7 @@ prefix_ senf::INet4SocketAddress::INet4SocketAddress(char const * address)
     assignString(address);
 }
 
-prefix_ senf::INet4SocketAddress::INet4SocketAddress(std::string address)
+prefix_ senf::INet4SocketAddress::INet4SocketAddress(std::string const & address)
 {
     assignString(address);
 }
index 72b9088..e235cd4 100644 (file)
@@ -60,7 +60,7 @@ namespace senf {
         INet4SocketAddress(char const * address); ///< Set address and port
                                         /**< See INet4SocketAddress(std::string)
                                              \throws InvalidINetAddressException */
-        INet4SocketAddress(std::string address); ///< Set address and port
+        INet4SocketAddress(std::string const & address); ///< Set address and port
                                         /**< This constructor expects a string of the form
                                              'xxx.xxx.xxx.xxx:pppp'. The constructor will use this
                                              value to initialize the host and port members. This
@@ -68,7 +68,8 @@ namespace senf {
                                              not hostnames
                                              \param[in] address Address and port
                                              \throws InvalidINetAddressException */
-        INet4SocketAddress(std::string host, unsigned port); ///< Set address and port explicitly
+        INet4SocketAddress(std::string const & host, unsigned port); 
+                                        ///< Set address and port explicitly
                                         /**< \param[in] host ip address in dotted-quad notation
                                              \param[in] port port number
                                              \throws InvalidINetAddressException */
@@ -93,7 +94,7 @@ namespace senf {
         /// @}
 
     private:
-        void assignString(std::string addr);
+        void assignString(std::string const & addr);
 
         struct ::sockaddr_in addr_;
     };
index a107916..66b15ac 100644 (file)
@@ -119,7 +119,7 @@ prefix_ void senf::UDPProtocol::mcDropMembership(INet4SocketAddress const & mcAd
         throw SystemException(errno);
 }
 
-prefix_ void senf::UDPProtocol::mcIface(std::string iface)
+prefix_ void senf::UDPProtocol::mcIface(std::string const & iface)
     const
 {
     struct ip_mreqn mreqn;
index a94668e..a39f5fc 100644 (file)
@@ -92,7 +92,7 @@ namespace senf {
                                              \todo fix this as soon as we have a real address class
                                                  (different from the sockaddress class */
 
-        void mcIface(std::string iface = std::string()) const;
+        void mcIface(std::string const & iface = std::string()) const;
                                         ///< set default multicast interface of the socket
                                         /**< \param[in] iface name of interface */
     
index 13038c3..c31b99d 100644 (file)
@@ -51,7 +51,7 @@ prefix_ std::string senf::LLSocketAddress::interface()
     return std::string(name);
 }
 
-prefix_ void senf::LLSocketAddress::interface(std::string iface)
+prefix_ void senf::LLSocketAddress::interface(std::string const & iface)
 {
     if (iface.empty()) 
         addr_.sll_ifindex = 0;
index bed2c13..0a36fbe 100644 (file)
@@ -102,7 +102,7 @@ namespace senf {
         // changing those members, which are sensible to be changed.
 
         void address(MACAddress const & addr); ///< Change address
-        void interface(std::string iface); ///< Change interface
+        void interface(std::string const & iface); ///< Change interface
         void protocol(unsigned prot);   ///< Change protocol
 
         ///\name Generic SocketAddress interface
index 3c5f655..955239c 100644 (file)
@@ -36,7 +36,7 @@ prefix_ senf::MACAddress::MACAddress senf::MACAddress::from_data(InputIterator i
 {
     MACAddress mac (MACAddress::noinit);
     iterator j (mac.begin());
-    iterator j_end (mac.end());
+    iterator const j_end (mac.end());
     for (;j!=j_end;++j,++i)
         *j = *i;
     return mac;
index 45473d9..8027f52 100644 (file)
@@ -79,7 +79,7 @@ prefix_ bool senf::PacketProtocol::eof()
 
 namespace {
     
-    void do_mc(int fd, std::string interface, senf::MACAddress address, bool add)
+    void do_mc(int fd, std::string const & interface, senf::MACAddress address, bool add)
     {
         struct packet_mreq mreq;
         mreq.mr_ifindex = ::if_nametoindex(interface.c_str());
index 2cd85e5..2d56094 100644 (file)
--- a/senf.dict
+++ b/senf.dict
@@ -6,14 +6,18 @@ AddressingPolicyBase
 addtogroup
 aListCollection
 alloc
+async
 aVectorCollection
 BaseParser
 berlios
 bitfield
 bund
+Callback
 callbacks
+cb
 cerr
 cfi
+CIDR
 ClientSocketHandle
 CommunicationPolicy
 CommunicationPolicyBase
@@ -29,6 +33,7 @@ DefaultBundle
 defaultInit
 defgroup
 dil
+DNS
 dontinclude
 ElementParser
 endcode
@@ -57,10 +62,13 @@ fuer
 hh
 hideinitializer
 Hmm
+hostname
+hostnames
 href
 htm
 html
 http
+IANA
 ih
 impl
 INet
@@ -83,6 +91,7 @@ li
 ListB
 ListN
 ListPolicy
+loopback
 MACAddress
 mainpage
 mixin
@@ -94,6 +103,7 @@ NextPacket
 nextPacketKey
 nextPacketRange
 nextPacketType
+NIS
 NoAddressingPolicy
 noinit
 nothrow