#include <flap.h>
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 |
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.
|
Inspector for the channel ID for the packet in the current buffer.
|
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.
|
Reads length value pair where an eight bit length comes first and then the actual data.
data |
A string object that the data will be stored in
|
|
Reads bytes from the FLAP packet.
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.
|
|
Reads one TLV from the FLAP packet and stores it into a caller allocated buffer.
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.
|
|
Reads one TLV from the FLAP packet and stores it into a 16 bit word.
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.
|
|
Reads one TLV from the FLAP packet and stores it into a string class.
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.
|
|
Waits to receive a FLAP packet from the oscar server.
|
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.
|
Sends the current FLAP packet inside the internal buffer over our file descriptor and to the AOL oscar server.
|
Sets the channel ID of the current FLAP packet.
value |
The new value of the channel ID. For most communications (SNAC), this will be 0x02.
|
|
Sets the file descriptor that all FLAP packets will be sent and received on.
newFd | the new file descriptor |
newClose | if true, the file descriptor will be closed when this FLAP instance is done with it |
|
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.
value | Purpose depends on the value of whence. See detailed description. |
whence |
Set to either FLAP_SEEK_START or FLAP_SEEK_CURRENT
|
|
Moves the internal position marker forward by the ammount specified in value.
If value is negative, the position marker will be moved backwards.
value |
The ammount in bytes to move the position marker.
|
|
Moves the internal position marker past the next TLV in the FLAP packet.
|
Writes an 8 bit value into the FLAP packet.
aByte |
the 8 bit byte to be written into the FLAP packet
|
|
Writes bytes from memory into a FLAP packet.
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
|
|
Writes a 32 bit value into the FLAP packet.
aDword |
the 32 bit double word to be written into the FLAP packet
|
|
Writes a SNAC header into the flap packet.
snac |
A reference to a SNAC structure that holds the fields of the SNAC to be written into the FLAP packet.
|
|
Writes a SNAC header into the FLAP packet.
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
|
|
Takes data in the form of a pointer to memory and writes it as TLV in the FLAP packet.
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
|
|
Takes data in the form of a 16-bit word and writes it as TLV in the FLAP packet.
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
|
|
Takes data in the form of a string class and writes it as TLV in the FLAP packet.
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
|
|
Writes a 16 bit value into the FLAP packet.
aWord |
the 16 bit word to be written into the FLAP packet
|