4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <stefan.bund@fokus.fraunhofer.de>
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.
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.
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.
24 #define HH_UDPPacket_ 1
28 #include "ParseInt.hh"
29 #include "ParseArray.hh"
30 #include "PacketRegistry.hh"
32 //#include "UDPPacket.mpp"
33 ///////////////////////////////hh.p////////////////////////////////////////
37 template <class Iterator=nil, class IPacket=nil>
38 struct Parse_UDP : public ParserBase<Iterator,IPacket>
40 template <class I, class P=nil>
41 struct rebind { typedef Parse_UDP<I,P> parser; };
42 typedef Iterator byte_iterator;
45 Parse_UDP(Iterator const & i) : ParserBase<Iterator,IPacket>(i) {}
47 static unsigned bytes() { return 8; }
49 ///////////////////////////////////////////////////////////////////////////
51 typedef Parse_UInt16 < Iterator > Parse_16bit;
53 Parse_16bit source() const { return Parse_16bit (this->i() ); }
54 Parse_16bit destination() const { return Parse_16bit (this->i() + 2 ); }
55 Parse_16bit length() const { return Parse_16bit (this->i() + 4 ); }
56 Parse_16bit crc() const { return Parse_16bit (this->i() + 6 ); }
62 public Parse_UDP<Packet::iterator, UDPPacket>
65 ///////////////////////////////////////////////////////////////////////////
68 typedef ptr_t<UDPPacket>::ptr ptr;
70 ///////////////////////////////////////////////////////////////////////////
74 UDPPacket(Arg const & arg);
76 virtual void v_nextInterpreter() const;
77 virtual void v_finalize();
78 virtual void v_dump(std::ostream & os) const;
85 ///////////////////////////////hh.e////////////////////////////////////////
86 //#include UDPPacket.cci"
87 //#include "UDPPacket.ct"
88 #include "UDPPacket.cti"
94 // c-file-style: "senf"