// $Id$
//
// Copyright (C) 2006
-// Fraunhofer Institute for Open Communication Systems (FOKUS)
-// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
#include <boost/algorithm/string/finder.hpp>
#include "../../../Utils/Exception.hh"
+#include "../AddressExceptions.hh"
//#include "LLAddressing.mpp"
#define prefix_
if (addr_.sll_ifindex == 0)
return std::string();
char name[IFNAMSIZ];
+ ::bzero(name, IFNAMSIZ);
if (! ::if_indextoname(addr_.sll_ifindex, name))
- throw InvalidLLSocketAddressException();
+ throw AddressSyntaxException();
return std::string(name);
}
else {
addr_.sll_ifindex = if_nametoindex(iface.c_str());
if (addr_.sll_ifindex == 0)
- throw InvalidLLSocketAddressException();
+ throw AddressSyntaxException();
}
}
+prefix_ std::ostream & senf::operator<<(std::ostream & os, LLSocketAddress const & llAddr)
+{
+ os << "[" << llAddr.address()
+ << '%' << llAddr.interface()
+ << ' ' << llAddr.protocol()
+ << ' ' << llAddr.arptype()
+ << ( llAddr.pkttype() == senf::LLSocketAddress::Host ? " Host" :
+ llAddr.pkttype() == senf::LLSocketAddress::Broadcast ? " Broadcast" :
+ llAddr.pkttype() == senf::LLSocketAddress::Multicast ? " Multicast" :
+ llAddr.pkttype() == senf::LLSocketAddress::OtherHost ? " OtherHost" :
+ llAddr.pkttype() == senf::LLSocketAddress::Outgoing ? " Outgoing" :
+ llAddr.pkttype() == senf::LLSocketAddress::Broadcast ? "Broadcast" : "" )
+ << "]";
+ return os;
+}
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "LLAddressing.mpp"