From: g0dil Date: Fri, 27 Jul 2007 12:14:51 +0000 (+0000) Subject: Socket/Protocols/INet: Change INet4Address to use a boost::array for storage X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=fb08e3defcfb7cd8851ede0fab6cad424d168485;p=senf.git Socket/Protocols/INet: Change INet4Address to use a boost::array for storage 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 --- diff --git a/Examples/MCSniffer/MCSniffer.cc b/Examples/MCSniffer/MCSniffer.cc index 2cbb2a3..8976c3d 100644 --- a/Examples/MCSniffer/MCSniffer.cc +++ b/Examples/MCSniffer/MCSniffer.cc @@ -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(); } diff --git a/Examples/TCPClientServer/client.cc b/Examples/TCPClientServer/client.cc index b3b65e7..12fb87a 100644 --- a/Examples/TCPClientServer/client.cc +++ b/Examples/TCPClientServer/client.cc @@ -26,13 +26,12 @@ #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; } + + +// 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: diff --git a/Examples/TCPClientServer/server.cc b/Examples/TCPClientServer/server.cc index aba64d0..dc53e5e 100644 --- a/Examples/TCPClientServer/server.cc +++ b/Examples/TCPClientServer/server.cc @@ -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; } + + +// 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: diff --git a/Packets/DataPacket.hh b/Packets/DataPacket.hh index 33c2d63..62e1200 100644 --- a/Packets/DataPacket.hh +++ b/Packets/DataPacket.hh @@ -33,22 +33,21 @@ 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 DataPacket; } diff --git a/SConstruct b/SConstruct index 7d09e74..6a98c7d 100644 --- a/SConstruct +++ b/SConstruct @@ -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() }, ) diff --git a/Scheduler/WriteHelper.ct b/Scheduler/WriteHelper.ct index 0b18fcc..758d8b5 100644 --- a/Scheduler/WriteHelper.ct +++ b/Scheduler/WriteHelper.ct @@ -32,7 +32,7 @@ ///////////////////////////////ct.p//////////////////////////////////////// template -prefix_ senf::WriteHelper::WriteHelper(Handle handle, std::string data, +prefix_ senf::WriteHelper::WriteHelper(Handle handle, std::string const & data, Callback callback) : handle_(handle), data_(data), callback_(callback), offset_(data_.begin()), errno_(0) diff --git a/Scheduler/WriteHelper.cti b/Scheduler/WriteHelper.cti index 12e7e0f..e57f0e5 100644 --- a/Scheduler/WriteHelper.cti +++ b/Scheduler/WriteHelper.cti @@ -31,7 +31,7 @@ template prefix_ typename senf::WriteHelper::ptr -senf::WriteHelper::dispatch(Handle handle, std::string data, Callback callback) +senf::WriteHelper::dispatch(Handle handle, std::string const & data, Callback callback) { return ptr(new WriteHelper(handle, data, callback)); } diff --git a/Scheduler/WriteHelper.hh b/Scheduler/WriteHelper.hh index 65b58a8..4fa3162 100644 --- a/Scheduler/WriteHelper.hh +++ b/Scheduler/WriteHelper.hh @@ -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); diff --git a/Socket/Doxyfile b/Socket/Doxyfile index 9a93817..529749f 100644 --- a/Socket/Doxyfile +++ b/Socket/Doxyfile @@ -4,4 +4,4 @@ PROJECT_NAME = libSocket TAGFILES = "$(TOPDIR)/Utils/doc/Utils.tag" GENERATE_TAGFILE = doc/Socket.tag RECURSIVE = Yes - +SHOW_DIRECTORIES = Yes diff --git a/Socket/FileHandle.test.cc b/Socket/FileHandle.test.cc index 21b3708..f4dac9d 100644 --- a/Socket/FileHandle.test.cc +++ b/Socket/FileHandle.test.cc @@ -45,7 +45,7 @@ namespace { FHandle(int fd) : senf::FileHandle(std::auto_ptr( new senf::FileBody(fd))) {} - FHandle(std::string name) + FHandle(std::string const & name) : senf::FileHandle(std::auto_ptr( new senf::FileBody())) { diff --git a/Socket/Protocols/INet/INet4Address.cc b/Socket/Protocols/INet/INet4Address.cc index 2833d57..5495e32 100644 --- a/Socket/Protocols/INet/INet4Address.cc +++ b/Socket/Protocols/INet/INet4Address.cc @@ -40,24 +40,44 @@ // 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(*(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; diff --git a/Socket/Protocols/INet/INet4Address.cci b/Socket/Protocols/INet/INet4Address.cci index bf593e0..0f9e232 100644 --- a/Socket/Protocols/INet/INet4Address.cci +++ b/Socket/Protocols/INet/INet4Address.cci @@ -30,32 +30,50 @@ // 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(&(*this)[0]); } -prefix_ unsigned long senf::INet4Address::raw() +prefix_ senf::INet4Address::inaddr_type senf::INet4Address::iref() const { - return addr_; + return *reinterpret_cast(&(*this)[0]); } ///////////////////////////////cci.e/////////////////////////////////////// diff --git a/Socket/Protocols/INet/INet4Address.cti b/Socket/Protocols/INet/INet4Address.ct similarity index 77% rename from Socket/Protocols/INet/INet4Address.cti rename to Socket/Protocols/INet/INet4Address.ct index e13fdbb..0dd4857 100644 --- a/Socket/Protocols/INet/INet4Address.cti +++ b/Socket/Protocols/INet/INet4Address.ct @@ -19,14 +19,14 @@ // 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 @@ -34,14 +34,15 @@ template 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_ diff --git a/Socket/Protocols/INet/INet4Address.hh b/Socket/Protocols/INet/INet4Address.hh index 303ea4b..f075555 100644 --- a/Socket/Protocols/INet/INet4Address.hh +++ b/Socket/Protocols/INet/INet4Address.hh @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include "Utils/SafeBool.hh" //#include "INet4Address.mpp" @@ -35,41 +37,102 @@ 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 + : public boost::array, + public ComparableSafeBool + { 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 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 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 diff --git a/Socket/Protocols/INet/INet4Address.test.cc b/Socket/Protocols/INet/INet4Address.test.cc index e4d92de..186202f 100644 --- a/Socket/Protocols/INet/INet4Address.test.cc +++ b/Socket/Protocols/INet/INet4Address.test.cc @@ -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() ); diff --git a/Socket/Protocols/INet/INetAddressing.cc b/Socket/Protocols/INet/INetAddressing.cc index 519a202..5f58af8 100644 --- a/Socket/Protocols/INet/INetAddressing.cc +++ b/Socket/Protocols/INet/INetAddressing.cc @@ -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(':'); diff --git a/Socket/Protocols/INet/INetAddressing.cci b/Socket/Protocols/INet/INetAddressing.cci index 8c399f6..4b28057 100644 --- a/Socket/Protocols/INet/INetAddressing.cci +++ b/Socket/Protocols/INet/INetAddressing.cci @@ -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); } diff --git a/Socket/Protocols/INet/INetAddressing.hh b/Socket/Protocols/INet/INetAddressing.hh index 72b9088..e235cd4 100644 --- a/Socket/Protocols/INet/INetAddressing.hh +++ b/Socket/Protocols/INet/INetAddressing.hh @@ -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_; }; diff --git a/Socket/Protocols/INet/UDPProtocol.cc b/Socket/Protocols/INet/UDPProtocol.cc index a107916..66b15ac 100644 --- a/Socket/Protocols/INet/UDPProtocol.cc +++ b/Socket/Protocols/INet/UDPProtocol.cc @@ -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; diff --git a/Socket/Protocols/INet/UDPProtocol.hh b/Socket/Protocols/INet/UDPProtocol.hh index a94668e..a39f5fc 100644 --- a/Socket/Protocols/INet/UDPProtocol.hh +++ b/Socket/Protocols/INet/UDPProtocol.hh @@ -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 */ diff --git a/Socket/Protocols/Raw/LLAddressing.cc b/Socket/Protocols/Raw/LLAddressing.cc index 13038c3..c31b99d 100644 --- a/Socket/Protocols/Raw/LLAddressing.cc +++ b/Socket/Protocols/Raw/LLAddressing.cc @@ -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; diff --git a/Socket/Protocols/Raw/LLAddressing.hh b/Socket/Protocols/Raw/LLAddressing.hh index bed2c13..0a36fbe 100644 --- a/Socket/Protocols/Raw/LLAddressing.hh +++ b/Socket/Protocols/Raw/LLAddressing.hh @@ -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 diff --git a/Socket/Protocols/Raw/MACAddress.ct b/Socket/Protocols/Raw/MACAddress.ct index 3c5f655..955239c 100644 --- a/Socket/Protocols/Raw/MACAddress.ct +++ b/Socket/Protocols/Raw/MACAddress.ct @@ -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; diff --git a/Socket/Protocols/Raw/PacketSocketHandle.cc b/Socket/Protocols/Raw/PacketSocketHandle.cc index 45473d9..8027f52 100644 --- a/Socket/Protocols/Raw/PacketSocketHandle.cc +++ b/Socket/Protocols/Raw/PacketSocketHandle.cc @@ -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()); diff --git a/senf.dict b/senf.dict index 2cd85e5..2d56094 100644 --- 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