// $Id$
//
-// Copyright (C) 2006
+// Copyright (C) 2006
// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
#include "ParserBase.ih"
///////////////////////////////hh.p////////////////////////////////////////
-namespace satcom {
-namespace pkf {
-
+namespace senf {
+
+
namespace impl { struct ParserBase; }
- struct nil
- : public boost::iterator_facade<nil,char,boost::random_access_traversal_tag>
+ struct nil
+ : public boost::iterator_facade<nil,char,boost::random_access_traversal_tag>
{
- // Theese are declared to make nil a valid iterator. All
- // access to an instance of this iterator however is invalid
- // (these members are not implemented only declared)
- char & dereference() const;
- bool equal(nil other) const;
- void increment();
- void decrement();
- void advance(int n);
- int distance_to(nil other) const;
+ // Theese are declared to make nil a valid iterator. All
+ // access to an instance of this iterator however is invalid
+ // (these members are not implemented only declared)
+ char & dereference() const;
+ bool equal(nil other) const;
+ void increment();
+ void decrement();
+ void advance(int n);
+ int distance_to(nil other) const;
};
/** \brief Parser framework
To implement a new parser, write a template implementing the
following members:
-
+
\code
template <class Iterator=nil, class IPacket=nil>
struct Parser_Example
- : protected satcom::pkf::ParserBase<Iterator,IPacket>
+ : protected senf::ParserBase<Iterator,IPacket>
{
// fixed interface of all parser classes
Parse_Example() {}
Parse_Example(Iterator const & i) : ParserBase<Iterator,IPacket>(i) {}
-
+
[static] unsigned bytes()
{
// return the size of the parsed header. This
// return true, if the data in the range [begin,end)
// can be safely interpreted by the parser without
// causing invalid memory access. This means,
- // check, wether the data is truncated
+ // check, whether the data is truncated
return static_cast<unsigned>(end-begin) >= bytes();
}
Parse_Field2 field2() const { return Parse_Field2 (this->i()+2); }
};
\endcode
-
+
Every parser must have some mandatory fixed members which are:
-
+
- struct rebind: This structure allows the parser to be
converted to a parser of the same type but with a different
iterator. Parser may have more than the two standard
parameters must be provided from the outside template
- byte_iterator: A typedef for the Iterator class used
-
+
- Non Iterator constructor: This constructor is only used when
the parser is inherited into a Packet class.
-
+
- Iterator constructor: This constructor must call the
corresponding ParserBase constructor.
///////////////////////////////////////////////////////////////////////////
///\name Structors and default members
///@{
-
+
// default default constructor
// default copy constructor
// default copy assignment
static void init() {};
private:
-
+
};
template <class Iterator>
static void init() {}
template <class SomePacket>
static void init(typename SomePacket::ptr) {}
-
+
private:
Iterator i_;
};
/** \brief Addtiional Parser information
-
- Parser_traits provids abstract information about an unknown
+
+ Parser_traits provides abstract information about an unknown
parser. Besides the information already available within the
Parser it provides an additional 'fixed_sized' member which is
true if and only if the Parser has a static bytes() member.
template <class Parser>
unsigned min_bytes();
-
-}}
+
+}
///////////////////////////////hh.e////////////////////////////////////////
//#include "ParserBase.cci"
\f
// Local Variables:
// mode: c++
-// c-file-style: "satcom"
+// fill-column: 100
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
// End: