removed some useless spaces; not very important, I know :)
[senf.git] / Packets / DefaultBundle / LlcSnapPacket.hh
1 // $Id$
2 //
3 // Copyright (C) 2007
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 LLC/SNAP public header */
25
26 #ifndef HH_LlcSnapPacket_
27 #define HH_LlcSnapPacket_ 1
28
29 // Custom includes
30 #include <algorithm>
31 #include "EthernetPacket.hh"
32 #include "../../Packets/Packets.hh"
33
34 //#include "LlcSnapPacket.mpp"
35 ///////////////////////////////hh.p////////////////////////////////////////
36
37 namespace senf {
38
39     /** \brief Parse a LLC/SNAP header
40         
41         \todo document me
42      */
43     struct LlcSnapPacketParser : public PacketParserBase
44     {
45 #       include SENF_FIXED_PARSER()
46
47         SENF_PARSER_FIELD( dsap, UInt8Parser );
48         SENF_PARSER_FIELD( ssap, UInt8Parser );
49         SENF_PARSER_FIELD( ctrl, UInt8Parser );
50
51         SENF_PARSER_FIELD( protocolId, UInt24Parser );
52         SENF_PARSER_FIELD( type_length, UInt16Parser );
53
54         SENF_PARSER_FINALIZE(LlcSnapPacketParser);
55         
56         SENF_PARSER_INIT() {
57             dsap() = 0xaa;
58             ssap() = 0xaa;
59             ctrl() = 0x03;
60             protocolId() = 0x000000;
61         }
62     };
63
64     /** \brief LLC/SNAP header
65
66         \todo document me
67
68         \par Packet type (typedef):
69             \ref LlcSnapPacketType
70
71         \par Fields:
72             \ref LlcSnapPacketParser
73
74         \par Associated registries:
75             \ref EtherTypes
76
77         \par Finalize action:
78             XXXX
79
80         \ingroup protocolbundle_default
81      */
82     struct LlcSnapPacketType
83         : public PacketTypeBase, 
84           public PacketTypeMixin<LlcSnapPacketType, EtherTypes>
85     {
86 #ifndef DOXYGEN
87         typedef PacketTypeMixin<LlcSnapPacketType, EtherTypes> mixin;
88         typedef ConcretePacket<LlcSnapPacketType> packet;
89         typedef LlcSnapPacketParser parser;
90 #endif
91         using mixin::nextPacketRange;
92         using mixin::initSize;
93         using mixin::init;
94         
95         static factory_t nextPacketType(packet p);
96         static void dump(packet p, std::ostream & os);
97         static void finalize(packet p);
98     };
99
100     typedef ConcretePacket<LlcSnapPacketType> LlcSnapPacket;
101 }
102
103
104 ///////////////////////////////hh.e////////////////////////////////////////
105 #endif
106 #ifndef SENF_PACKETS_DECL_ONLY
107 //#include "LlcSnapPacket.cci"
108 //#include "LlcSnapPacket.ct"
109 //#include "LlcSnapPacket.cti"
110 #endif
111
112 \f
113 // Local Variables:
114 // mode: c++
115 // fill-column: 100
116 // c-file-style: "senf"
117 // indent-tabs-mode: nil
118 // ispell-local-dictionary: "american"
119 // compile-command: "scons -u test"
120 // comment-column: 40
121 // End: