bes  Updated for version 3.17.4
PPTClient Class Reference
Inheritance diagram for PPTClient:
Inheritance graph

Public Member Functions

virtual void brokenPipe ()
 
virtual void closeConnection ()
 
virtual void dump (ostream &strm) const
 dumps information about this object More...
 
virtual string exit ()
 
virtual ostream * getOutputStream ()
 
virtual unsigned int getRecvChunkSize ()
 
virtual unsigned int getSendChunkSize ()
 
virtual SocketgetSocket ()
 
virtual void initConnection ()
 
virtual bool isConnected ()
 
 PPTClient (const string &hostStr, int portVal, int timeout)
 
 PPTClient (const string &unix_socket, int timeout)
 
virtual bool receive (map< string, string > &extensions, ostream *strm=0)
 receive a chunk of either extensions into the specified map or data into the specified stream More...
 
virtual void send (const string &buffer, map< string, string > &extensions)
 Send a message to the server. More...
 
virtual void sendExit ()
 Send the exit token as an extension.
 
virtual void sendExtensions (map< string, string > &extensions)
 send the specified extensions More...
 
virtual void setOutputStream (ostream *strm)
 

Protected Member Functions

virtual void read_extensions (map< string, string > &extensions, const string &xstr)
 the string passed are extensions, read them and store the name/value pairs into the passed map More...
 
virtual int readBuffer (char *inBuff, const unsigned int buff_size)
 read a buffer of data from the socket More...
 
virtual int readBufferNonBlocking (char *inBuff, const int buff_size)
 read a buffer of data from the socket without blocking More...
 
virtual void send (const string &buffer)
 sends the buffer to the socket More...
 

Protected Attributes

bool _brokenPipe
 
Socket_mySock
 
ostream * _out
 

Detailed Description

Definition at line 40 of file PPTClient.h.

Member Function Documentation

◆ dump()

void PPTClient::dump ( ostream &  strm) const
virtual

Displays the pointer value of this instance

Parameters
strmC++ i/o stream to dump the information to

Reimplemented from PPTConnection.

Definition at line 252 of file PPTClient.cc.

References PPTConnection::dump().

◆ read_extensions()

void PPTConnection::read_extensions ( map< string, string > &  extensions,
const string &  xstr 
)
protectedvirtualinherited

It has already been determined that extensions were read in the chunk. Deconstruct the name/value pairs and store them into the map passed. Each extension ends with a semicolon.

Parameters
extensionsmap to store the name/value pairs in
xstrstring of extensions in the form *(name[=value];)

Definition at line 366 of file PPTConnection.cc.

◆ readBuffer()

int PPTConnection::readBuffer ( char *  buffer,
const unsigned int  buffer_size 
)
protectedvirtualinherited
Parameters
bufferbuffer to store the data received from the socket in
buffer_sizemax size of the data to be received
Returns
number of bytes actually read

Definition at line 200 of file PPTConnection.cc.

◆ readBufferNonBlocking()

int PPTConnection::readBufferNonBlocking ( char *  inBuff,
const int  buffer_size 
)
protectedvirtualinherited

Try to read a buffer of data without blocking. We will try _timeout times, waiting 1000 milliseconds between each try. The variable _timeout is passed into the constructor.

Parameters
inBuffbuffer to store the data into
buffer_sizethe size of the passed buffer
Returns
number of bytes read in, -1 if failed to read anything

Definition at line 414 of file PPTConnection.cc.

References PPTConnection::readBuffer().

◆ receive()

bool PPTConnection::receive ( map< string, string > &  extensions,
ostream *  strm = 0 
)
virtualinherited

This receive will read a chunk of information from the socket and determine if what is read are extensions, where they are stored in the extensions map passed, or data, which is written to the specified stream

The first 7 bytes is the length of the information that was passed. The 5th character is either the character 'x', signifying that extensions were sent, or 'd', signifying that data was sent.

Parameters
extensionsmap to store the name/value paris into
strmoutput stream to write the received data into
Returns
true if what was received is the last chunk, false otherwise

Implements Connection.

Definition at line 249 of file PPTConnection.cc.

References PPTConnection::read_extensions().

◆ send() [1/2]

void PPTConnection::send ( const string &  buffer)
protectedvirtualinherited

the buffer includes the length, extensions, data, whatever is to be sent

Parameters
bufferdata buffer to send to the socket

Implements Connection.

Definition at line 180 of file PPTConnection.cc.

◆ send() [2/2]

void PPTConnection::send ( const string &  buffer,
map< string, string > &  extensions 
)
virtualinherited

Sends the specified message buffer to the server followed by a buffer of length 0 to signify the end of the message

A buffer sent to the server will follow the following form:

Chunked-Body = chunk-extensions
chunk
last-chunk
chunk-extensions= chunk-size 'x' *( chunk-ext-name [ "=" chunk-ext-val ] ;
chunk = chunk-size 'd' chunk-data
chunk-size = 8HEX
last-chunk = 7("0") d
chunk-ext-name = token
chunk-ext-val = token | quoted-string
chunk-data = chunk-size(OCTET)

If there are extensions then they are sent first. The length of the extensions is sent first, followed by the character 'x', and then the extensions in the format name[=value];

Then the buffer itself is sent. The length of the buffer is sent followed by the character 'd' signifying data is being transmitted.

if the buffer is empty then this represents the last chunk

Parameters
bufferbuffer of data to send
extensionslist of name/value pairs sent

Implements Connection.

Definition at line 99 of file PPTConnection.cc.

◆ sendExtensions()

void PPTConnection::sendExtensions ( map< string, string > &  extensions)
virtualinherited
Parameters
extensionsname/value paris to be sent

Implements Connection.

Definition at line 152 of file PPTConnection.cc.

References PPTConnection::send().


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