Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

strmod::strmod::TelnetParser Class Reference

Class for parsing out a stream of characters into telnet protocol elements using the TelnetChunkBuilder class. More...

#include <StrMod/TelnetParser.h>

Inheritance diagram for strmod::strmod::TelnetParser:

Inheritance graph
[legend]
List of all members.

Public Methods

 TelnetParser ()
 Construct a parser in the 'start' state.

virtual ~TelnetParser ()
 Destroy a parser.

virtual int AreYouA (const lcore::ClassIdent &cid) const
 Asks if a class is of a particular type, or publicly derived from that type.

void processData (const void *data, size_t len, TelnetChunkBuilder &builder)
void endOfChunk (TelnetChunkBuilder &builder)
 This function is called when the parent, for various reasons (like getting to the end of the currently processed chunk) wants to wrap up processing and move as much data into the 'parsed' state as possible.

size_t getRegionBegin () const
 Return number of bytes to the beginning of the current region that TelnetParser is not finished parsing yet.

void dropBytes (size_t bytes)
 Move region as if bytes bytes had been chopped off the front.

void reset (TelnetChunkBuilder &builder)
 Reset the parser back to the 'start' state.


Static Public Attributes

const STR_ClassIdent identifier
 Globally unique identifier for this class.


Protected Types

enum  ParserState {
  PS_Normal, PS_Escape, PS_SubNeg, PS_SuboptNum,
  PS_Subopt, PS_SuboptEscape
}
 Describes the current state of the parser. More...


Protected Methods

virtual const lcore::ClassIdent * i_GetIdent () const
 Returns the class identifier for the class the object actually is.


Detailed Description

Class for parsing out a stream of characters into telnet protocol elements using the TelnetChunkBuilder class.

Definition at line 46 of file TelnetParser.h.


Member Enumeration Documentation

enum strmod::strmod::TelnetParser::ParserState [protected]
 

Describes the current state of the parser.

This state is completely determined by the characters fed into processChar().

Enumeration values:
PS_Normal  Starting state. Normal data.
PS_Escape  Saw an IAC character in normal data.
PS_SubNeg  Saw an IAC {WILL,WONT,DO,DONT}, expecting option number.
PS_SuboptNum  Saw an IAC SE and expecting an option number.
PS_Subopt  Between IAC SE <num> and IAC SE.
PS_SuboptEscape  Saw an IAC while in PS_Subopt.

Definition at line 84 of file TelnetParser.h.


Member Function Documentation

int strmod::strmod::TelnetParser::AreYouA const lcore::ClassIdent &    cid const [inline, virtual]
 

Asks if a class is of a particular type, or publicly derived from that type.

Overriden in every derived class (with a static identifier member) to compare against the identifier, then call the AreYouA methods of all the superclasses.

Parameters:
cid Usually <class>::identifier for the class you want to ask if the object is an instance of.

Reimplemented from strmod::lcore::Protocol.

Definition at line 122 of file TelnetParser.h.

void strmod::strmod::TelnetParser::endOfChunk TelnetChunkBuilder   builder
 

This function is called when the parent, for various reasons (like getting to the end of the currently processed chunk) wants to wrap up processing and move as much data into the 'parsed' state as possible.

This is needed because data block telnet sections can be of arbitrary length and have no 'end' delimeter as such. They need to be processed as they come, not in big blobs of 'all the data between telnet commands'.

Parameters:
builder The builder to stuff any pending data chunks into.

Definition at line 294 of file TelnetParser.cxx.

virtual const lcore::ClassIdent* strmod::strmod::TelnetParser::i_GetIdent   const [inline, protected, virtual]
 

Returns the class identifier for the class the object actually is.

Should always be overridden in any class that has a static identifier member.

Reimplemented from strmod::lcore::Protocol.

Definition at line 93 of file TelnetParser.h.

void strmod::strmod::TelnetParser::processData const void *    data,
size_t    len,
TelnetChunkBuilder   builder
 

Parameters:
data The data buffer to be stuffed into the state machine.
len The number of bytes in the data buffer.
builder The TelnetChunkBuilder to use to build the parsed objects.
Run the internal state machine on a buffer of characters. The internal state machine will call the appropriate TelnetChunkBuilder methods.

This allows the internal state machine to only pay attention to the character sequence and be largely divorced from how the characters are actually sliced and diced.

As a courtesy to slicers and dicers, it will keep track of a region, and details about certain kinds of parsed objects.

Definition at line 236 of file TelnetParser.cxx.


Member Data Documentation

const STR_ClassIdent strmod::strmod::TelnetParser::identifier [static]
 

Globally unique identifier for this class.

Every class that might need to be identified should have a public static const identifier object in it.

Reimplemented from strmod::lcore::Protocol.


The documentation for this class was generated from the following files:
Generated on Wed Jan 29 00:32:56 2003 for libNet by doxygen1.3-rc1