Skip to content
Snippets Groups Projects
Commit 59c539eb authored by tho's avatar tho
Browse files

removed .toString() members from address classes; use senf::str() instead

parent bcf519cf
No related branches found
No related tags found
No related merge requests found
......@@ -89,15 +89,6 @@ prefix_ senf::INet4Address senf::INet4Address::from_string(std::string const & s
reinterpret_cast<in_addr*>(*(ent->h_addr_list))->s_addr);
}
prefix_ std::string senf::INet4Address::toString() const {
char buffer[4*4];
::in_addr ina;
ina.s_addr = (*this).inaddr();
::inet_ntop(AF_INET, & ina , buffer, sizeof(buffer));
buffer[sizeof(buffer)-1] = 0;
return buffer;
}
prefix_ bool senf::INet4Address::local()
const
{
......
......@@ -159,9 +159,6 @@ namespace senf {
/**< This member returns the address as an integer number in
host byte order. This representation allows simple
network math operations. */
std::string toString() const;
///< get the string representation of this INet4Address
////@}
private:
......
......@@ -91,17 +91,14 @@ prefix_ in6_addr senf:: INet6Address::toin6_addr() const {
return ina;
}
prefix_ std::string senf::INet6Address::toString() const {
char buffer[5*8];
::in6_addr ina = (*this).toin6_addr();
::inet_ntop(AF_INET6, & ina , buffer, sizeof(buffer));
buffer[sizeof(buffer)-1] = 0;
return buffer;
}
prefix_ std::ostream & senf::operator<<(std::ostream & os, INet6Address const & addr)
{
os << addr.toString();
::in6_addr ina;
char buffer[5*8];
std::copy(addr.begin(),addr.end(),&ina.s6_addr[0]);
::inet_ntop(AF_INET6,&ina,buffer,sizeof(buffer));
buffer[sizeof(buffer)-1] = 0;
os << buffer;
return os;
}
......@@ -147,7 +144,7 @@ prefix_ senf::INet6Network::INet6Network(std::string s)
#undef prefix_
//#include "INet6Address.mpp"
// Local Variables:
// mode: c++
// fill-column: 100
......
......@@ -203,11 +203,7 @@ namespace senf {
\par
INet4 compatible INet6 addresses are not directly
supported, they are deprecated in the RFC. */
std::string toString() const;
///< get the string representation of this INet6Address
in6_addr toin6_addr() const;
///< get the linux in6_addr struct (convinience only)
in6_addr toin6_addr() const; ///< get the linux in6_addr struct (convinience only)
///@}
///////////////////////////////////////////////////////////////////////////
......@@ -393,7 +389,7 @@ namespace senf {
#include "INet6Address.cti"
#endif
// Local Variables:
// mode: c++
// fill-column: 100
......
......@@ -57,7 +57,7 @@ namespace {
else
throw senf::AddressSyntaxException();
}
template <class Range>
boost::uint8_t hexToByte(Range const & range)
{
......@@ -107,11 +107,6 @@ prefix_ senf::MACAddress senf::MACAddress::from_eui64(boost::uint64_t v)
senf::MACAddress const senf::MACAddress::Broadcast = senf::MACAddress(0xFFFFFFFFFFFFull);
senf::MACAddress const senf::MACAddress::None;
prefix_ std::string senf::MACAddress::toString() const {
std::ostringstream tmp;
tmp << (*this);
return tmp.str();
}
///////////////////////////////////////////////////////////////////////////
// namespace members
......@@ -146,7 +141,7 @@ prefix_ std::istream & senf::operator>>(std::istream & is, MACAddress & mac)
#undef prefix_
//#include "MACAddress.mpp"
// Local Variables:
// mode: c++
// fill-column: 100
......
......@@ -42,7 +42,7 @@
namespace senf {
/** \brief Ethernet MAC address
The Ethernet MAC is modelled as a fixed-size container/sequence of 6 bytes.
The following statements all create the same MAC address <code>00:1A:2B:3C:4D:5F</code>
......@@ -85,7 +85,7 @@ namespace senf {
\ingroup addr_group
*/
struct MACAddress
: public boost::array<boost::uint8_t,6>,
: public boost::array<boost::uint8_t,6>,
public comparable_safe_bool<MACAddress>
{
static MACAddress const Broadcast; ///< The broadcast address
......@@ -103,7 +103,7 @@ namespace senf {
accepted as a delimiter.
\throws AddressSyntaxException */
template <class InputIterator>
template <class InputIterator>
static MACAddress from_data(InputIterator i);
///< Construct address from raw data
/**< Copies the data from \a i into the MAC address.
......@@ -126,12 +126,9 @@ namespace senf {
boost::uint32_t oui() const; ///< Return first 3 bytes of the address
boost::uint32_t nic() const; ///< Return last 3 bytes of the address
boost::uint64_t eui64() const; ///< Build EUI-64 from the MAC address
boost::uint64_t uint64() const; ///< Return MAC address as uint64 value
std::string toString() const; ///< Return string representation of MAC address like 12:34:56:78:90:ab
boost::uint64_t eui64() const; ///< Build EUI-64 from the MAC address
boost::uint64_t uint64() const; ///< Return MAC address as uint64 value
};
/** \brief Output MAC instance as it's string representation
......@@ -153,7 +150,7 @@ namespace senf {
//#include "MACAddress.cti"
#endif
// Local Variables:
// mode: c++
// fill-column: 100
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment