channel Class Reference

Data of and operations on an open connection. More...

#include <channel.h>

List of all members.

Public Member Functions

 channel (int channeltype, long time)
 initiate a new channel, 1=socket based, 2=file based (also give file size), 3=server_socker, 4=import based
void close (void)
 Free the buffers of this channel.
bool next ()
 Scan for the next key in the input.
bool peek (string key)
 Check if the next key in the input is the given key.
void write (const std::string key, const std::string value)
 Write this key to the other side of the connection or the file.
void write (const std::string key, const long value)
 Write this numeric key to the other side of the connection or the file.
void send ()
 Send the finished data to the other side.
void fread (const std::string file)
 Read data from this file.
void fwrite (const std::string file)
 Write the next data to this file.
void finish ()
 Finish writing to the file or close the socket.
void poll (long time)
 Poll for new data, with the current time.
void send_session (long time)
 Send session data to the other party.

Public Attributes

void * payload
 payload of this channel
std::string key
 Pointer to the current key.
std::string value
 Pointer to the current value.
std::string ip
 Ip address of the connected client or the hostname of the server.
int port
 Port number on the server.
unsigned int id
 Unique id for the channel.
connectionstream
bool finished
sigc::signal< void,
channel * > 
handler
 Function to call when new data is ready to read.
int type
 type of the connection (1=client_socket, 2=file, 3=server_socket, 4=import)
class communicatecomm
 related communication record
bool lock
 lock till correct credentials are found


Detailed Description

Data of and operations on an open connection.

Constructor & Destructor Documentation

channel::channel ( int  channeltype,
long  time 
)

initiate a new channel, 1=socket based, 2=file based (also give file size), 3=server_socker, 4=import based


Member Function Documentation

void channel::close ( void   ) 

Free the buffers of this channel.

bool channel::next ( void   ) 

Scan for the next key in the input.

bool channel::peek ( string  key  ) 

Check if the next key in the input is the given key.

void channel::write ( const std::string  key,
const std::string  value 
)

Write this key to the other side of the connection or the file.

void channel::write ( const std::string  key,
const long  value 
)

Write this numeric key to the other side of the connection or the file.

void channel::send (  ) 

Send the finished data to the other side.

void channel::fread ( const std::string  file  ) 

Read data from this file.

void channel::fwrite ( const std::string  file  ) 

Write the next data to this file.

void channel::finish (  ) 

Finish writing to the file or close the socket.

void channel::poll ( long  time  ) 

Poll for new data, with the current time.

Scan this channel for input.

Todo:
Better check on incorrect data
More gracious handling when the number of bytes of the data is no real number
  • dump current data from the stream... so we hope that it cleans the stream for the next data
  • good logging of these type of events... there is always data loss

void channel::send_session ( long  time  ) 

Send session data to the other party.


Member Data Documentation

void* channel::payload

payload of this channel

std::string channel::key

Pointer to the current key.

std::string channel::value

Pointer to the current value.

std::string channel::ip

Ip address of the connected client or the hostname of the server.

int channel::port

Port number on the server.

unsigned int channel::id

Unique id for the channel.

connection* channel::stream

Connection class with read/write/close functions Dont change connection type on a running channel

bool channel::finished

Indication that the channel is finished, only needed for communicate class Use finish() to indicate it is finished

sigc::signal<void, channel*> channel::handler

Function to call when new data is ready to read.

int channel::type

type of the connection (1=client_socket, 2=file, 3=server_socket, 4=import)

class communicate* channel::comm

related communication record

bool channel::lock

lock till correct credentials are found


The documentation for this class was generated from the following files:

Generated on Tue Jan 1 17:30:01 2008 for channel Class Reference by  doxygen   Visit the project page on SourceForge.net Logo