removed some useless spaces; not very important, I know :)
[senf.git] / Socket / Protocols / Raw / LLAddressing.cc
index c5d5c00..d1cc710 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 //
 // Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-//     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// 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
 // it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
  */
 
 #include "LLAddressing.hh"
-#include "LLAddressing.ih"
+//#include "LLAddressing.ih"
 
 // Custom includes
 #include <net/if.h>
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string/finder.hpp>
 
-#include "Utils/Exception.hh"
+#include "../../../Utils/Exception.hh"
 
 //#include "LLAddressing.mpp"
 #define prefix_
 ///////////////////////////////cc.p////////////////////////////////////////
 
-prefix_ unsigned char senf::detail::hexnibble(char c)
-{
-    if (c>='0' && c<='9')
-        return c - '0';
-    if (c>='A' && c<='F')
-        return c - 'A' + 10;
-    if (c>='a' && c<='f')
-        return c - 'a' + 10;
-    throw InvalidLLSocketAddressException();
-}
-
 prefix_ std::string senf::LLSocketAddress::interface()
     const
 {
@@ -62,63 +51,17 @@ prefix_ std::string senf::LLSocketAddress::interface()
     return std::string(name);
 }
 
-/*
-{
-    if (addr_.sll_halen == 0)
-        return std::string();
-    std::stringstream s;
-
-    unsigned char const * i = &addr_.sll_addr[0];
-    while (1) {
-        s << std::hex << std::setw(2) << std::setfill('0') << unsigned(*i);
-        ++i;
-        if (i == &addr_.sll_addr[addr_.sll_halen]) break;
-        s << '-';
-    }
-    return s.str();
-}
-*/
-
-
-/*
-prefix_ void senf::LLSocketAddress::address(std::string address)
-{
-    typedef boost::split_iterator<std::string::iterator> StringSplitIterator;
-    StringSplitIterator i = boost::make_split_iterator(address, boost::token_finder(boost::is_any_of("-: ")));
-    unsigned char * j = &addr_.sll_addr[0];
-    for (; ! i.eof() && addr_.sll_halen<8; ++i, ++j, ++addr_.sll_halen) {
-        if ( i->size() != 2 || ! boost::all(*i, boost::is_xdigit()) )
-            throw InvalidLLSocketAddressException();
-        *j = hex(*i);
-    }
-    if (! i.eof())
-        throw InvalidLLSocketAddressException();
-}
-*/
-
-prefix_ void senf::LLSocketAddress::interface(std::string interface)
+prefix_ void senf::LLSocketAddress::interface(std::string const & iface)
 {
-    if (! interface.empty()) {
-        addr_.sll_ifindex = if_nametoindex(interface.c_str());
+    if (iface.empty()) 
+        addr_.sll_ifindex = 0;
+    else {
+        addr_.sll_ifindex = if_nametoindex(iface.c_str());
         if (addr_.sll_ifindex == 0)
             throw InvalidLLSocketAddressException();
     }
 }
 
-
-prefix_ senf::detail::LLAddressFromStringRange
-senf::llAddress(std::string address)
-{
-    detail::StringSplitIterator i =
-        boost::make_split_iterator(address, boost::token_finder(boost::is_any_of("-: ")));
-    detail::StringSplitIterator i_end;
-
-    detail::HexSplitIterator j (i,detail::HexConverter());
-    detail::HexSplitIterator j_end (i_end);
-
-    return detail::LLAddressFromStringRange(j,j_end);
-}
-
 ///////////////////////////////cc.e////////////////////////////////////////
 #undef prefix_
 //#include "LLAddressing.mpp"