OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
PPTServer Class Reference

#include <PPTServer.h>

Inheritance diagram for PPTServer:
Inheritance graph
Collaboration diagram for PPTServer:
Collaboration graph

List of all members.

Public Member Functions

virtual void brokenPipe ()
virtual void closeConnection ()
virtual void dump (ostream &strm) const
 dumps information about this object
virtual string exit ()
virtual ostream * getOutputStream ()
virtual unsigned int getRecvChunkSize ()
virtual unsigned int getSendChunkSize ()
virtual SocketgetSocket ()
virtual void initConnection ()
 Using the info passed into the SocketLister, wait for an inbound request (see SocketListener::accept()).
virtual bool isConnected ()
 PPTServer (ServerHandler *handler, SocketListener *listener, bool isSecure)
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
virtual void send (const string &buffer, map< string, string > &extensions)
 Send a message to the server.
virtual void sendExit ()
 Send the exit token as an extension.
virtual void sendExtensions (map< string, string > &extensions)
 send the specified extensions
virtual void setOutputStream (ostream *strm)
virtual ~PPTServer ()

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
virtual int readBufferNonBlocking (char *inBuff, const int buff_size)
 read a buffer of data from the socket without blocking
virtual void send (const string &buffer)
 sends the buffer to the socket

Protected Attributes

bool _brokenPipe
Socket_mySock
ostream * _out

Detailed Description

Definition at line 42 of file PPTServer.h.


Constructor & Destructor Documentation

PPTServer::PPTServer ( ServerHandler handler,
SocketListener listener,
bool  isSecure 
)

Definition at line 59 of file PPTServer.cc.

PPTServer::~PPTServer ( )
virtual

Definition at line 92 of file PPTServer.cc.


Member Function Documentation

virtual void Connection::brokenPipe ( )
inlinevirtualinherited

Definition at line 98 of file Connection.h.

References Connection::_brokenPipe.

Referenced by CmdClient::brokenPipe().

void PPTServer::closeConnection ( )
virtual

Implements PPTConnection.

Definition at line 171 of file PPTServer.cc.

References Connection::_mySock, and Socket::close().

Referenced by ServerApp::terminate().

Here is the call graph for this function:

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

dumps information about this object

Displays the pointer value of this instance

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

Reimplemented from PPTConnection.

Definition at line 277 of file PPTServer.cc.

References ServerHandler::dump(), SocketListener::dump(), BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().

Referenced by ServerApp::dump().

Here is the call graph for this function:

virtual string PPTConnection::exit ( )
inlinevirtualinherited

Implements Connection.

Definition at line 85 of file PPTConnection.h.

References PPTProtocol::PPT_EXIT_NOW.

virtual ostream* Connection::getOutputStream ( )
inlinevirtualinherited

Definition at line 93 of file Connection.h.

References Connection::_out.

unsigned int PPTConnection::getRecvChunkSize ( )
virtualinherited

Implements Connection.

Definition at line 489 of file PPTConnection.cc.

References Connection::_mySock, Socket::getRecvBufferSize(), and PPT_CHUNK_HEADER_SPACE.

Here is the call graph for this function:

unsigned int PPTConnection::getSendChunkSize ( )
virtualinherited

Implements Connection.

Definition at line 495 of file PPTConnection.cc.

References Connection::_mySock, Socket::getSendBufferSize(), and PPT_CHUNK_HEADER_SPACE.

Here is the call graph for this function:

virtual Socket* Connection::getSocket ( )
inlinevirtualinherited

Definition at line 77 of file Connection.h.

References Connection::_mySock.

Referenced by PPTConnection::readBufferNonBlocking().

void PPTServer::initConnection ( )
virtual

Using the info passed into the SocketLister, wait for an inbound request (see SocketListener::accept()).

When one is found, do the welcome message stuff (welcomeClient()) and then pass this to the handler's handle method. Note that this is a pointer to a PPTServer which is a kind of Connection.

Implements PPTConnection.

Definition at line 146 of file PPTServer.cc.

References Connection::_mySock, SocketListener::accept(), Socket::allowConnection(), Socket::close(), and ServerHandler::handle().

Referenced by ServerApp::run().

Here is the call graph for this function:

virtual bool Connection::isConnected ( )
inlinevirtualinherited

Definition at line 82 of file Connection.h.

References Connection::_mySock, and Socket::isConnected().

Referenced by CmdClient::isConnected().

Here is the call graph for this function:

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

the string passed are extensions, read them and store the name/value pairs into the passed map

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 393 of file PPTConnection.cc.

Referenced by PPTConnection::receive().

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

read a buffer of data from the socket without blocking

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 451 of file PPTConnection.cc.

References Connection::getSocket(), and Socket::getSocketDescriptor().

Referenced by PPTClient::initConnection().

Here is the call graph for this function:

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

receive a chunk of either extensions into the specified map or data into the specified stream

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 261 of file PPTConnection.cc.

References Connection::_mySock, Connection::_out, BESDEBUG, Socket::getRecvBufferSize(), and PPTConnection::read_extensions().

Here is the call graph for this function:

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

sends the buffer to the socket

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 190 of file PPTConnection.cc.

References Connection::_mySock, BESDEBUG, and Socket::send().

Referenced by PPTClient::initConnection(), PPTConnection::sendExit(), and PPTConnection::sendExtensions().

Here is the call graph for this function:

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

Send a message to the server.

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 101 of file PPTConnection.cc.

void PPTConnection::sendExit ( )
virtualinherited

Send the exit token as an extension.

Implements Connection.

Definition at line 121 of file PPTConnection.cc.

References PPTProtocol::PPT_EXIT_NOW, and PPTConnection::send().

Referenced by PPTClient::closeConnection().

Here is the call graph for this function:

void PPTConnection::sendExtensions ( map< string, string > &  extensions)
virtualinherited

send the specified extensions

Parameters:
extensionsname/value paris to be sent

Implements Connection.

Definition at line 158 of file PPTConnection.cc.

References PPTConnection::send().

Here is the call graph for this function:

virtual void Connection::setOutputStream ( ostream *  strm)
inlinevirtualinherited

Definition at line 89 of file Connection.h.

References Connection::_out.


Member Data Documentation

bool Connection::_brokenPipe
protectedinherited
ostream* Connection::_out
protectedinherited

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