be4be32ce38d3285702deaada8305b80da552663
[senf.git] / senf / Packets / DefaultBundle / EUI64Parser.hh
1 // $Id$
2 //
3 // Copyright (C) 2010
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Thorsten Horstmann <tho@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief EUI64Parser public header */
25
26 #ifndef HH_SENF_Packets_DefaultBundle_EUI64Parser_
27 #define HH_SENF_Packets_DefaultBundle_EUI64Parser_ 1
28
29 // Custom includes
30 #include <senf/Packets.hh>
31 #include <senf/Socket/Protocols/Raw/EUI64.hh>
32
33 ///////////////////////////////hh.p////////////////////////////////////////
34 namespace senf {
35
36     /** \brief Parse an EUI64 address
37
38         The EUI64 address is returned by value as a 8-byte sequence
39
40         \see EUI64
41      */
42     struct EUI64Parser
43         : public ValueParserBase<EUI64Parser, EUI64, 8u>
44     {
45         EUI64Parser(data_iterator i, state_type s) : Base(i,s) {}
46
47         value_type value() const { return value_type::from_data(i()); }
48         void value(value_type const & v) { std::copy(v.begin(), v.end(), i()); }
49
50         using Base::operator=;
51     };
52
53 }
54 //-/////////////////////////////////////////////////////////////////////////////////////////////////
55 //#include "EUI64Parser.cci"
56 //#include "EUI64Parser.ct"
57 //#include "EUI64Parser.cti"
58 #endif