OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
|
#include <PPTConnection.h>
Public Member Functions | |
virtual void | brokenPipe () |
virtual void | closeConnection ()=0 |
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 Socket * | getSocket () |
virtual void | initConnection ()=0 |
virtual bool | isConnected () |
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. More... | |
virtual void | sendExtensions (map< string, string > &extensions) |
send the specified extensions More... | |
virtual void | setOutputStream (ostream *strm) |
virtual | ~PPTConnection () |
Protected Member Functions | |
PPTConnection (int timeout) | |
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 | readBufferNonBlocking (char *inBuff, const unsigned 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 |
Definition at line 43 of file PPTConnection.h.
|
inlineprotected |
Definition at line 67 of file PPTConnection.h.
References closeConnection(), initConnection(), read_extensions(), readBufferNonBlocking(), send(), and ~PPTConnection().
|
virtual |
Definition at line 57 of file PPTConnection.cc.
Referenced by PPTConnection().
|
inlinevirtualinherited |
Definition at line 98 of file Connection.h.
References Connection::dump(), Connection::getRecvChunkSize(), and Connection::getSendChunkSize().
Referenced by CmdClient::brokenPipe().
|
pure virtual |
|
virtual |
dumps information about this object
Displays the pointer value of this instance
strm | C++ i/o stream to dump the information to |
Reimplemented from Connection.
Reimplemented in PPTServer, and PPTClient.
Definition at line 502 of file PPTConnection.cc.
References Connection::dump(), BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
Referenced by PPTClient::dump(), PPTServer::dump(), and exit().
|
inlinevirtual |
Implements Connection.
Definition at line 85 of file PPTConnection.h.
References dump(), getRecvChunkSize(), getSendChunkSize(), PPTProtocol::PPT_EXIT_NOW, send(), sendExit(), and sendExtensions().
|
inlinevirtualinherited |
Definition at line 93 of file Connection.h.
References Connection::_out.
|
virtual |
Implements Connection.
Definition at line 484 of file PPTConnection.cc.
References Connection::_mySock, Socket::getRecvBufferSize(), and PPT_CHUNK_HEADER_SPACE.
Referenced by exit().
|
virtual |
Implements Connection.
Definition at line 490 of file PPTConnection.cc.
References Connection::_mySock, Socket::getSendBufferSize(), and PPT_CHUNK_HEADER_SPACE.
Referenced by exit().
|
inlinevirtualinherited |
Definition at line 77 of file Connection.h.
References Connection::_mySock.
Referenced by BESServerHandler::handle(), and readBufferNonBlocking().
|
pure virtual |
|
inlinevirtualinherited |
Definition at line 82 of file Connection.h.
References Socket::isConnected().
Referenced by CmdClient::isConnected().
|
protectedvirtual |
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.
extensions | map to store the name/value pairs in |
xstr | string of extensions in the form *(name[=value];) |
Definition at line 388 of file PPTConnection.cc.
Referenced by PPTConnection(), and receive().
|
protectedvirtual |
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.
inBuff | buffer to store the data into |
buffer_size | the size of the passed buffer |
Definition at line 446 of file PPTConnection.cc.
References Connection::getSocket(), and Socket::getSocketDescriptor().
Referenced by PPTServer::closeConnection(), PPTClient::initConnection(), and PPTConnection().
|
virtual |
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.
extensions | map to store the name/value paris into |
strm | output stream to write the received data into |
Implements Connection.
Definition at line 256 of file PPTConnection.cc.
References Connection::_mySock, Connection::_out, BESDEBUG, Socket::getRecvBufferSize(), and read_extensions().
Referenced by CmdClient::executeClientCommand().
|
protectedvirtual |
sends the buffer to the socket
the buffer includes the length, extensions, data, whatever is to be sent
buffer | data buffer to send to the socket |
Implements Connection.
Definition at line 190 of file PPTConnection.cc.
References Connection::_mySock, BESDEBUG, Socket::receive(), Socket::send(), and Socket::sync().
Referenced by PPTServer::closeConnection(), CmdClient::executeClientCommand(), exit(), PPTClient::initConnection(), PPTConnection(), sendExit(), and sendExtensions().
|
virtual |
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:
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
buffer | buffer of data to send |
extensions | list of name/value pairs sent |
Implements Connection.
Definition at line 101 of file PPTConnection.cc.
|
virtual |
Send the exit token as an extension.
Implements Connection.
Definition at line 121 of file PPTConnection.cc.
References PPTProtocol::PPT_EXIT_NOW, send(), and sendExtensions().
Referenced by PPTClient::closeConnection(), and exit().
|
virtual |
send the specified extensions
extensions | name/value paris to be sent |
Implements Connection.
Definition at line 158 of file PPTConnection.cc.
References send().
Referenced by exit(), and sendExit().
|
inlinevirtualinherited |
Definition at line 89 of file Connection.h.
|
protectedinherited |
Definition at line 52 of file Connection.h.
Referenced by PPTClient::closeConnection(), and Connection::dump().
|
protectedinherited |
Definition at line 50 of file Connection.h.
Referenced by PPTClient::closeConnection(), PPTServer::closeConnection(), Connection::dump(), getRecvChunkSize(), getSendChunkSize(), Connection::getSocket(), PPTServer::initConnection(), PPTClient::PPTClient(), receive(), send(), and PPTClient::~PPTClient().
|
protectedinherited |
Definition at line 51 of file Connection.h.
Referenced by Connection::dump(), Connection::getOutputStream(), and receive().