sends::transaction Class Reference
[Sends Pipeline Stage Classes]

SENDS Transaction structure. More...

#include <transaction.hh>

List of all members.

Public Types

enum  command_code {
  kNoop, kGetStatus, kGetData, kGetServerStatus,
  kGetChannels, kQuit, kCommandCount
}
 Server command ennumeration. More...
typedef chan_list::chan_index chan_index
 Channel index.
typedef unsigned long gps_type
 GPS times.
typedef std::vector< chan_statcinx_vect
typedef seg_db::seg_index seg_index
 Segment list index.
typedef std::vector< seg_indexseg_vect
 Reserved segment list type.

Public Member Functions

 transaction (tran_queue &retQ)
 Transaction constructor.
 ~transaction (void)
long block_seq (void)
 get block sequence number.
void add_channel (chan_index inx)
 Add a channel.
void clear (void)
void clear_channels (void)
 Clear the channel list.
command_code command (void) const
std::ostream & dump (std::ostream &out) const
 Dump out the transaction.
gps_type getChanFill (int i) const
 Get fill point.
chan_index getChanIndex (int i) const
 Get ith channel index.
bool getChanReady (int i) const
 Test if channel is ready.
int getNChan (void) const
 Get number of channels.
long get_stage (void) const
 Get the last stage to have processed this transaction.
gps_type getStartGPS (void) const
 Get start time.
gps_type getStopGPS (void) const
 Get end time.
gps_type getStrideEnd (void) const
 Get stride end time.
long ident (void) const
 Transaction ID.
bool next_stride (void)
 Set time for next stride.
int put_response (int resp)
 Respond to client.
socket_apiref_socket (void)
 Reference OpenSSL bio structure.
user_dataref_user (void)
 Reference user_data structure.
int read (buffer &buf)
 read a line from the client.
void error_reply (const std::string &err)
 Send an error to the client.
void reply (const buffer &reply)
 Send a reply.
void release (void)
 Release the transaction.
void release_segments (void)
 release all segments.
void release_segments (gps_type before)
 Release segments with data before the specified GPS.
void reserve_segments (void)
 Reserve all available segments.
void setCommand (command_code cmd)
 Set the command.
void setCommand (const std::string &cmd)
 Set the command from a string.
void set_id (long tranid)
 set the transaction id.
void set_socket (socket_api *sock)
 Set socket for this transaction.
void set_stage (long s)
 Set socket for this transaction.
void set_user (const user_data &user)
 Set user data.
void setTime (gps_type start, gps_type stop, gps_type stride=0)
 Set transaction times.
gps_type stride (void) const
 Time stride;.

Static Public Member Functions

static command_code getCommandCode (const std::string &str)
 Get command code.
static const char * getCommandString (command_code code)
 Get command string.

Classes

class  chan_stat
 Channel ID and status. More...


Detailed Description

SENDS Transaction structure.

SENDS transaction block containing the SSL connection infomation, the user information, status information and other junk. The transaction structure is passed between the SEDA stages as the transaction is processed by the pipeline.

Author:
J. Zweizig
Version:
1.1; Last Modified January 14, 2008

Member Typedef Documentation

Channel index.

Data type of index into master channel list.

typedef unsigned long sends::transaction::gps_type

GPS times.

Data type for GPS time representation.

Data type for list (vector) oc channel status objects.

Segment list index.

Data type for index into the master segment list, used to specify individual segments.

Reserved segment list type.

Data type ued to maintain a list of reserved segments.


Member Enumeration Documentation

Server command ennumeration.

Enumerate all the commands to be recognized by the server.


Constructor & Destructor Documentation

sends::transaction::transaction ( tran_queue &  retQ  ) 

Transaction constructor.

Construct a transaction block and note the queue into which the transaction is to be returned when processing is complete.

Parameters:
retQ Queue into which the trasaction is to be returned.

sends::transaction::~transaction ( void   ) 

Destroy the transaction. Release all allocated resources.


Member Function Documentation

long sends::transaction::block_seq ( void   )  [inline]

get block sequence number.

Return and increment reply block sequence number.

Returns:
Block sequence

void sends::transaction::add_channel ( chan_index  inx  ) 

Add a channel.

Add a channel index to the transaction channel list.

Parameters:
inx Index of the channel to be processed.

void sends::transaction::clear ( void   ) 

Clear transaction descriptor.

void sends::transaction::clear_channels ( void   ) 

Clear the channel list.

Release all segments and clear the channel list.

transaction::command_code sends::transaction::command ( void   )  const [inline]

Get command code.

Returns:
Transaction command code.

std::ostream& sends::transaction::dump ( std::ostream &  out  )  const

Dump out the transaction.

Write a formatted dump of the transaction descriptor to the specified output stream.

Parameters:
out Output stream to which the dump will be sent.
Returns:
The output stream specified by the argument.

transaction::gps_type sends::transaction::getChanFill ( int  i  )  const [inline]

Get fill point.

Get the first gps time needed by the selected channel.

Parameters:
i Index into transaction channel list.
Returns:
Fill time for indicated channel.

transaction::chan_index sends::transaction::getChanIndex ( int  i  )  const [inline]

Get ith channel index.

Get the master channel list index of the ith channel in this transaction.

Parameters:
i Index into transaction list of channel.
Returns:
Index in the master channel list of the requested channel.

bool sends::transaction::getChanReady ( int  i  )  const [inline]

Test if channel is ready.

Check whether all data are available in reserved segments for the i'th channel in this transaction.

Parameters:
i Cindex into channel list for this transaction.
Returns:
True if all channel data are in reserved segments.

static command_code sends::transaction::getCommandCode ( const std::string &  str  )  [static]

Get command code.

Convert a command name string into a command code.

Parameters:
str Command name string.
Returns:
Command code.

static const char* sends::transaction::getCommandString ( command_code  code  )  [static]

Get command string.

Convert a command code into a command name string.

Parameters:
code Command code.
Returns:
Command name string.

int sends::transaction::getNChan ( void   )  const [inline]

Get number of channels.

Get the number of channels requested for this transaction.

Returns:
Number of channels requested for this transaction.

long sends::transaction::get_stage ( void   )  const [inline]

Get the last stage to have processed this transaction.

Get the number of the last stage to have been processed.

Returns:
Stage ID.

transaction::gps_type sends::transaction::getStartGPS ( void   )  const [inline]

Get start time.

Get the start time of this transaction.

Returns:
Start gps

transaction::gps_type sends::transaction::getStopGPS ( void   )  const [inline]

Get end time.

Get the end time of this transaction.

Returns:
Stop GPS

transaction::gps_type sends::transaction::getStrideEnd ( void   )  const [inline]

Get stride end time.

Get the end time of the current stride of this transaction.

Returns:
End od stride GPS

long sends::transaction::ident ( void   )  const [inline]

Transaction ID.

Return the transaction identifier.

Returns:
Transaction identifier.

bool sends::transaction::next_stride ( void   ) 

Set time for next stride.

The stride start time is set to the end of the current stride. All reserved segments covering the just completed stride are released. If there are more data to be transferrred for this transaction, next_stride treturns true.

Returns:
True if transaction is not complete.

int sends::transaction::put_response ( int  resp  ) 

Respond to client.

Sent a response code to the client int he form of a 4-digit hex number.

Parameters:
resp Response code.
Returns:
Number of bytes written.

socket_api & sends::transaction::ref_socket ( void   )  [inline]

Reference OpenSSL bio structure.

Return a reference to the OpenSSL I/O base structure used by this transaction.

Returns:
Reference to OpenSSL bio structure.

user_data & sends::transaction::ref_user ( void   )  [inline]

Reference user_data structure.

Return a reference to the user data structure for the user authenticated for this transaction.

Returns:
Reference to user_data structure.

int sends::transaction::read ( buffer buf  ) 

read a line from the client.

Read a line from the OpenSSL channel ito the specified buffer.

Parameters:
buf Buffer into which the client data is to be read.
Returns:
Number of characters in the line.

void sends::transaction::error_reply ( const std::string &  err  ) 

Send an error to the client.

Send a terminal error message to the client.

Parameters:
err Error message to be sent to the client.

void sends::transaction::reply ( const buffer reply  ) 

Send a reply.

Send a reply to the client.

Parameters:
reply Buffer containing the reply.

void sends::transaction::release ( void   ) 

Release the transaction.

Release all transaction resources, close the connection and return the transaction structure to the free transaction queue.

void sends::transaction::release_segments ( void   ) 

release all segments.

Release all segments being used by this transaction.

void sends::transaction::release_segments ( gps_type  before  ) 

Release segments with data before the specified GPS.

Release all of the segments being used by this transaction that contain only data before the specified gps.

Parameters:
before Earliest end time for data to be released.

void sends::transaction::reserve_segments ( void   ) 

Reserve all available segments.

Reserve all available segments whilch will be used by this transaction.

void sends::transaction::setCommand ( command_code  cmd  ) 

Set the command.

Set the transaction command code.

Parameters:
cmd Transacton command code.

void sends::transaction::setCommand ( const std::string &  cmd  ) 

Set the command from a string.

Translate a string to a transaction command code and set the transaction command.

Parameters:
cmd Transacton command string.

void sends::transaction::set_id ( long  tranid  ) 

set the transaction id.

Set the transaction ID (serial number).

Parameters:
tranid Transaction serial number.

void sends::transaction::set_socket ( socket_api sock  ) 

Set socket for this transaction.

Identify the communication socket to be used by this transaction.

Parameters:
sock Pointer to a socket_api object.

void sends::transaction::set_stage ( long  s  ) 

Set socket for this transaction.

Identify the communication socket to be used by this transaction.

Parameters:
sock Pointer to a socket_api object.

void sends::transaction::set_user ( const user_data user  ) 

Set user data.

Set the user_data describing the user requesting this transaction.

Parameters:
user User data structure describing users authorization.

void sends::transaction::setTime ( gps_type  start,
gps_type  stop,
gps_type  stride = 0 
)

Set transaction times.

Set the transaction time range and stride. If a stride is specified, the transaction will be divided into a number of replies with the specified length. If the stride is unspecified or zero, a single reply is returned.

Parameters:
start Start GPS time.
stop End GPS time.
stride Time stride in seconds.

transaction::gps_type sends::transaction::stride ( void   )  const [inline]

Time stride;.

Get the stride length

Returns:
time stride in seconds.


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

Generated on Tue Jun 10 12:18:12 2008 for SENDS by  doxygen 1.5.5