Main Page   Class Hierarchy   Compound List   File List   Compound Members  

FLAP Class Reference

This class acts as a layer for communicating with the FLAP protocol over a unix file descriptor. More...

#include <flap.h>

List of all members.

Public Methods

FLAP& resetData ( )
 Clears the interneral FLAP packet and sets the internal read/write pointers back to zero. More...

FLAP& writeData ( const void *newData, int length )
 Writes bytes from memory into a FLAP packet. More...

FLAP& writeTLV ( word type, const string &data )
 Takes data in the form of a string class and writes it as TLV in the FLAP packet. More...

FLAP& writeTLV ( word type, word data )
 Takes data in the form of a 16-bit word and writes it as TLV in the FLAP packet. More...

FLAP& writeTLV ( word type, const void* data, int length )
 Takes data in the form of a pointer to memory and writes it as TLV in the FLAP packet. More...

FLAP& writeSNAC ( word familyID, word subTypeID, byte flags1, byte flags2, dword requestID )
 Writes a SNAC header into the FLAP packet. More...

FLAP& writeSNAC ( const SNAC& snac )
 Writes a SNAC header into the flap packet. More...

FLAP& writeByte ( byte aByte )
 Writes an 8 bit value into the FLAP packet. More...

FLAP& writeWord ( word aWord )
 Writes a 16 bit value into the FLAP packet. More...

FLAP& writeDword ( dword aDword )
 Writes a 32 bit value into the FLAP packet. More...

FLAP& readData ( void *buffer, int length )
 Reads bytes from the FLAP packet. More...

FLAP& read8LV ( string& data )
 Reads length value pair where an eight bit length comes first and then the actual data. More...

FLAP& readTLV ( word &type, string &data )
 Reads one TLV from the FLAP packet and stores it into a string class. More...

FLAP& readTLV ( word &type, word &data )
 Reads one TLV from the FLAP packet and stores it into a 16 bit word. More...

FLAP& readTLV ( word &type, void* data, int length, int& bytesWriten )
 Reads one TLV from the FLAP packet and stores it into a caller allocated buffer. More...

FLAP& readSNAC ( word& familyID, word& subTypeID, byte& flags1, byte& flags2, dword& requestID )
FLAP& readSNAC ( SNAC& snac )
FLAP& readByte ( byte& aByte )
FLAP& readWord ( word& aWord )
FLAP& peekTLVType ( word& type )
FLAP& setChannelID ( int value )
 Sets the channel ID of the current FLAP packet. More...

FLAP& setSeek ( int value, int whence = 0 )
 Adjusts the internal position marker. More...

FLAP& skipBytes ( int value )
 Moves the internal position marker forward by the ammount specified in value. More...

FLAP& skipTLV ( )
 Moves the internal position marker past the next TLV in the FLAP packet. More...

FLAP& setFileDescriptor ( int newFd, bool newClose)
 Sets the file descriptor that all FLAP packets will be sent and received on. More...

int getChannelID ( void ) const
 Inspector for the channel ID for the packet in the current buffer. More...

int getSequenceNumber ( void ) const
 Inspector for the current FLAP packets sequence number. More...

int getDataFieldLength ( void ) const
const byte* getDataField ( void ) const
 FLAP ()
 ~FLAP ()
bool receive ()
 Waits to receive a FLAP packet from the oscar server. More...

bool send ()
 Sends the current FLAP packet inside the internal buffer over our file descriptor and to the AOL oscar server. More...


Public Attributes

const int FLAP_SEEK_CURRENT = 1

Static Public Attributes

const int FLAP_SEEK_START = 0


Detailed Description

This class acts as a layer for communicating with the FLAP protocol over a unix file descriptor.

It contains an internal buffer which holds one FLAP packet. This packet can be send and received over the file decriptor using the send() and receive methods, respectily. There are various read and write methods which are used to parse an incomming flap packet and too create a new flap packet. Both the read and write methods use an internal position marker which is updated after each call to read or write. Because of this, you don't have to worry about which offset you are reading and writing to if you know that the data will be in a sequential order.

Author(s):
Jonathan Baudanza


Member Function Documentation

int FLAP::getChannelID ( void ) const

Inspector for the channel ID for the packet in the current buffer.

Returns:
The current channel ID

int FLAP::getSequenceNumber ( void ) const

Inspector for the current FLAP packets sequence number.

Each FLAP packet is sent with a sequence number that is one greater then the previous packet sent. An instance of FLAP automatically maintains this number internally. This method should not be very useful other then for debugging issues.

Returns:
The sequence number of the current packet.

FLAP & FLAP::read8LV ( string & data )

Reads length value pair where an eight bit length comes first and then the actual data.

Parameters:
data   A string object that the data will be stored in

Returns:
Referecne to this FLAP instance

FLAP & FLAP::readData ( void * buffer,
int length )

Reads bytes from the FLAP packet.

Parameters:
buffer   Pointer to a user allocated buffer which the data from the flap packet will be stored in.
length   The length in bytes to copy into the caller's buffer. No bounds checking is done, so make sure you have allocated enough room in your buffer.

Returns:
Reference to this FLAP instance

FLAP & FLAP::readTLV ( word & type,
void * data,
int length,
int & bytesWriten )

Reads one TLV from the FLAP packet and stores it into a caller allocated buffer.

Parameters:
type   Reference to a 16 bit word into which the TLV's type field will be stored.
data   Pointer a user allocated buffer which will store the TLV's value field.
length   The largest length in bytes that this method will write into the caller's buffer
bytesWriten   On return, this integer will store the number of bytes that were written into the caller's buffer.

Returns:
Reference to this FLAP instance

FLAP & FLAP::readTLV ( word & type,
word & data )

Reads one TLV from the FLAP packet and stores it into a 16 bit word.

Parameters:
type   Reference to a 16 bit word into which the TLV's type field will be stored.
data   Reference to a 16 bit word into which the TLV's value field will be stored.

Returns:
Reference to this FLAP instance

FLAP & FLAP::readTLV ( word & type,
string & data )

Reads one TLV from the FLAP packet and stores it into a string class.

Parameters:
type   Reference to a 16 bit word into which the TLV's type field will be stored.
data   Reference to a string class that the TLV's value will be stored.

Returns:
Reference to this FLAP instance

bool FLAP::receive ( )

Waits to receive a FLAP packet from the oscar server.

Returns:
true on sucess, false on failure

FLAP & FLAP::resetData ( )

Clears the interneral FLAP packet and sets the internal read/write pointers back to zero.

This method should be called before you start constructing a new FLAP packet.

Returns:
Reference to this FLAP instance

bool FLAP::send ( )

Sends the current FLAP packet inside the internal buffer over our file descriptor and to the AOL oscar server.

Returns:
true on success, false on failure

FLAP & FLAP::setChannelID ( int value )

Sets the channel ID of the current FLAP packet.

Parameters:
value   The new value of the channel ID. For most communications (SNAC), this will be 0x02.

Returns:
Reference to this FLAP instance

FLAP & FLAP::setFileDescriptor ( int newFd,
bool newClose )

Sets the file descriptor that all FLAP packets will be sent and received on.

Parameters:
newFd   the new file descriptor
newClose   if true, the file descriptor will be closed when this FLAP instance is done with it

FLAP & FLAP::setSeek ( int value,
int whence = 0 )

Adjusts the internal position marker.

This method works in two ways, depending on how whence is set. If it is set to FLAP_SEEK_START, then the position is set to the number specified in value. If whence is set to FLAP_SEEK_CURRENT, the position marker is moved by the ammount specified in value. This value can be positive or negative.

Parameters:
value   Purpose depends on the value of whence. See detailed description.
whence   Set to either FLAP_SEEK_START or FLAP_SEEK_CURRENT

Returns:
Reference to this FLAP instance.

FLAP & FLAP::skipBytes ( int value ) [inline]

Moves the internal position marker forward by the ammount specified in value.

If value is negative, the position marker will be moved backwards.

Parameters:
value   The ammount in bytes to move the position marker.

Returns:
Reference to this FLAP instance.

FLAP & FLAP::skipTLV ( )

Moves the internal position marker past the next TLV in the FLAP packet.

Returns:
Reference to this FLAP instance

FLAP & FLAP::writeByte ( byte aByte )

Writes an 8 bit value into the FLAP packet.

Parameters:
aByte   the 8 bit byte to be written into the FLAP packet

Returns:
Reference to this FLAP instance

FLAP & FLAP::writeData ( const void * newData,
int length )

Writes bytes from memory into a FLAP packet.

Parameters:
newData   pointer to the first byte in memory to be written into the FLAP packet
length   the size in bytes of the new data to add

Returns:
Reference to this FLAP instance

FLAP & FLAP::writeDword ( dword aDword )

Writes a 32 bit value into the FLAP packet.

Parameters:
aDword   the 32 bit double word to be written into the FLAP packet

Returns:
Reference to this FLAP instance

FLAP & FLAP::writeSNAC ( const SNAC & snac )

Writes a SNAC header into the flap packet.

Parameters:
snac   A reference to a SNAC structure that holds the fields of the SNAC to be written into the FLAP packet.

Returns:
Reference to this FLAP instance

FLAP & FLAP::writeSNAC ( word familyID,
word subTypeID,
byte flags1,
byte flags2,
dword requestID )

Writes a SNAC header into the FLAP packet.

Parameters:
familyID   16 bit value that specifies this SNAC's family
subTypeID   16 bit value that specifies this SNAC's sub type ID
flags1   8 bit mask of flags. Usually 0
flags2   8 bit mask of flags. Usually 0
requestID   32 bit value for this SNAC's request ID

Returns:
Reference to this FLAP instance

FLAP & FLAP::writeTLV ( word type,
const void * data,
int length )

Takes data in the form of a pointer to memory and writes it as TLV in the FLAP packet.

Parameters:
type   the 16-bit value which identifies the type of this TLV
data   pointer to the first byte in memory to be written as a TLV into the FLAP packet
length   The length of bytes of the memory starting at the address pointed to by data that will be written into the TLV

Returns:
Reference to this FLAP instance

FLAP & FLAP::writeTLV ( word type,
word data )

Takes data in the form of a 16-bit word and writes it as TLV in the FLAP packet.

Parameters:
type   the 16-bit value which identifies the type of this TLV
data   1 16 bit word that will be written as a TLV into the FLAP packet

Returns:
Reference to this FLAP instance

FLAP & FLAP::writeTLV ( word type,
const string & data )

Takes data in the form of a string class and writes it as TLV in the FLAP packet.

Parameters:
type   the 16-bit value which identifies the type of this TLV
data   a reference to the string class which will be written as a TLV into the FLAP packet

Returns:
Reference to this FLAP instance

FLAP & FLAP::writeWord ( word aWord )

Writes a 16 bit value into the FLAP packet.

Parameters:
aWord   the 16 bit word to be written into the FLAP packet

Returns:
Reference to this FLAP instance

The documentation for this class was generated from the following file:
Generated at Mon Oct 16 20:29:57 2000 for libaim by doxygen 1.1.3 written by Dimitri van Heesch, © 1997-2000