EUI64.hh

Go to the documentation of this file.
00001 // $Id: EUI64.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2009
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 #ifndef HH_SENF_Socket_Protocols_Raw_EUI64_
00027 #define HH_SENF_Socket_Protocols_Raw_EUI64_ 1
00028 
00029 // Custom includes
00030 #include <iostream>
00031 #include <boost/cstdint.hpp>
00032 #include <boost/array.hpp>
00033 #include <senf/Utils/Tags.hh>
00034 #include <senf/Utils/safe_bool.hh>
00035 
00036 //#include "EUI64.mpp"
00037 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00038 
00039 namespace senf {
00040 
00041     class MACAddress;
00042 
00076     class EUI64
00077         : public boost::array<boost::uint8_t,8>,
00078           public senf::comparable_safe_bool<EUI64>
00079     {
00080     public:
00081         //-////////////////////////////////////////////////////////////////////////
00083         //\{
00084 
00085         static EUI64 const None;        
00086 
00087         // default copy constructor
00088         // default copy assignment
00089         // default destructor
00090         // no conversion constructors
00091 
00092         explicit EUI64(boost::uint64_t v=0u); 
00093         explicit EUI64(senf::NoInit_t);       
00094 
00095         static EUI64 from_mac(MACAddress const & mac);
00097         static EUI64 from_string(std::string const & s);
00099 
00102         template <class InputIterator>
00103         static EUI64 from_data(InputIterator i);
00105 
00108         //\}
00109         //-////////////////////////////////////////////////////////////////////////
00110 
00111         bool isMACCompatible() const;   
00112 
00114         bool local() const;             
00115 
00118         bool group() const;             
00119 
00121         bool boolean_test() const;      
00122         boost::uint64_t uint64() const; 
00123     };
00124 
00128     std::ostream & operator<<(std::ostream & os, EUI64 const & v);
00129 
00133     std::istream & operator>>(std::istream & is, EUI64 & v);
00134 
00135 }
00136 
00137 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00138 #include "EUI64.cci"
00139 //#include "EUI64.ct"
00140 #include "EUI64.cti"
00141 #endif
00142 
00143 
00144 // Local Variables:
00145 // mode: c++
00146 // fill-column: 100
00147 // comment-column: 40
00148 // c-file-style: "senf"
00149 // indent-tabs-mode: nil
00150 // ispell-local-dictionary: "american"
00151 // compile-command: "scons -u test"
00152 // End: