00001 // $Id: LlcSnapPacket.hh 1754 2010-12-09 15:45:42Z tho $ 00002 // 00003 // Copyright (C) 2007 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Thorsten Horstmann <tho@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_Packets_DefaultBundle_LlcSnapPacket_ 00027 #define HH_SENF_Packets_DefaultBundle_LlcSnapPacket_ 1 00028 00029 // Custom includes 00030 #include "EthernetPacket.hh" 00031 00032 //#include "LlcSnapPacket.mpp" 00033 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00034 00035 namespace senf { 00036 00042 struct LlcSnapPacketParser : public PacketParserBase 00043 { 00044 # include SENF_FIXED_PARSER() 00045 00046 SENF_PARSER_FIELD( dsap, UInt8Parser ); 00047 SENF_PARSER_FIELD( ssap, UInt8Parser ); 00048 SENF_PARSER_FIELD( ctrl, UInt8Parser ); 00049 00050 SENF_PARSER_FIELD( protocolId, UInt24Parser ); 00051 SENF_PARSER_FIELD( type_length, UInt16Parser ); 00052 00053 SENF_PARSER_FINALIZE(LlcSnapPacketParser); 00054 00055 SENF_PARSER_INIT() { 00056 dsap() = 0xaa; 00057 ssap() = 0xaa; 00058 ctrl() = 0x03; 00059 protocolId() = 0x000000; 00060 } 00061 }; 00062 00081 struct LlcSnapPacketType 00082 : public PacketTypeBase, 00083 public PacketTypeMixin<LlcSnapPacketType, EtherTypes> 00084 { 00085 #ifndef DOXYGEN 00086 typedef PacketTypeMixin<LlcSnapPacketType, EtherTypes> mixin; 00087 #endif 00088 typedef ConcretePacket<LlcSnapPacketType> packet; 00089 typedef LlcSnapPacketParser parser; 00090 00091 using mixin::nextPacketRange; 00092 using mixin::initSize; 00093 using mixin::init; 00094 00095 static factory_t nextPacketType(packet p); 00097 static void dump(packet p, std::ostream & os); 00098 static void finalize(packet p); 00099 }; 00100 00104 typedef ConcretePacket<LlcSnapPacketType> LlcSnapPacket; 00105 } 00106 00107 00108 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00109 //#include "LlcSnapPacket.cci" 00110 //#include "LlcSnapPacket.ct" 00111 //#include "LlcSnapPacket.cti" 00112 #endif 00113 00114 00115 // Local Variables: 00116 // mode: c++ 00117 // fill-column: 100 00118 // c-file-style: "senf" 00119 // indent-tabs-mode: nil 00120 // ispell-local-dictionary: "american" 00121 // compile-command: "scons -u test" 00122 // comment-column: 40 00123 // End: