TAO_On_Demand_Fragmentation_Strategy Class Reference

#include <On_Demand_Fragmentation_Strategy.h>

Inheritance diagram for TAO_On_Demand_Fragmentation_Strategy:

Inheritance graph
[legend]
Collaboration diagram for TAO_On_Demand_Fragmentation_Strategy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_On_Demand_Fragmentation_Strategy (TAO_Transport *transport, ACE_CDR::ULong max_message_size)
 Constructor.
virtual ~TAO_On_Demand_Fragmentation_Strategy (void)
virtual int fragment (TAO_OutputCDR &cdr, ACE_CDR::ULong pending_alignment, ACE_CDR::ULong pending_length)
 Fragment the (potentially partially) encoded GIOP message.

Private Member Functions

 TAO_On_Demand_Fragmentation_Strategy (TAO_On_Demand_Fragmentation_Strategy const &)
void operator= (TAO_On_Demand_Fragmentation_Strategy const &)

Private Attributes

TAO_Transport *const transport_
 Pointer to the underlying transport object.
ACE_CDR::ULong const max_message_size_
 Size of GIOP message at which fragmentation will occur.

Detailed Description

Definition at line 43 of file On_Demand_Fragmentation_Strategy.h.


Constructor & Destructor Documentation

TAO_On_Demand_Fragmentation_Strategy::TAO_On_Demand_Fragmentation_Strategy ( TAO_Transport transport,
ACE_CDR::ULong  max_message_size 
)

Constructor.

TAO_On_Demand_Fragmentation_Strategy::~TAO_On_Demand_Fragmentation_Strategy ( void   )  [virtual]

Definition at line 19 of file On_Demand_Fragmentation_Strategy.cpp.

00021 {
00022 }

TAO_On_Demand_Fragmentation_Strategy::TAO_On_Demand_Fragmentation_Strategy ( TAO_On_Demand_Fragmentation_Strategy const &   )  [private]


Member Function Documentation

int TAO_On_Demand_Fragmentation_Strategy::fragment ( TAO_OutputCDR cdr,
ACE_CDR::ULong  pending_alignment,
ACE_CDR::ULong  pending_length 
) [virtual]

Fragment the (potentially partially) encoded GIOP message.

Fragmentation the contents of the CDR output stream cdr into smaller chunks of data of size that fits within the configured ORB fragmentation threshold, and send each fragment "over the wire."

Note:
Fragmentation will only occur if the CDR stream length will surpass the configured fragmentation threshold when marshaling the pending set of data.
Parameters:
cdr Output CDR stream.
pending_alignment Size of alignment boundary for next data to be marshaled (e.g. 4 for a CORBA::ULong).
pending_length Size of next data to be marshaled (e.g. 2 for a CORBA::UShort).
Returns:
Zero on success.

Implements TAO_GIOP_Fragmentation_Strategy.

Definition at line 25 of file On_Demand_Fragmentation_Strategy.cpp.

References ACE_align_binary(), ACE_DEBUG, ACE_OutputCDR::align_write_ptr(), TAO_OutputCDR::get_version(), LM_DEBUG, TAO_GIOP_Message_Version::major, ACE_CDR::MAX_ALIGNMENT, TAO_OutputCDR::message_semantics(), TAO_GIOP_Message_Version::minor, TAO_OutputCDR::more_fragments(), TAO_OutputCDR::request_id(), TAO_OutputCDR::stub(), TAO_debug_level, TAO_OutputCDR::timeout(), and ACE_OutputCDR::total_length().

00029 {
00030   if (this->transport_ == 0)
00031     return 0;  // No transport.  Can't fragment.
00032 
00033   TAO_GIOP_Message_Version giop_version;
00034 
00035   cdr.get_version (giop_version);
00036 
00037   // GIOP fragments are supported in GIOP 1.1 and better, but TAO only
00038   // supports them in 1.2 or better since GIOP 1.1 fragments do not
00039   // have a fragment message header.
00040   if (giop_version.major == 1 && giop_version.minor < 2)
00041     return -1;
00042 
00043   // Determine increase in CDR stream length if pending data is
00044   // marshaled, taking into account the alignment for the given data
00045   // type.
00046   ACE_CDR::ULong const total_pending_length =
00047     ACE_align_binary (cdr.total_length (), pending_alignment)
00048     + pending_length;
00049 
00050   // Except for the last fragment, fragmented GIOP messages must
00051   // always be aligned on an 8-byte boundary.  Padding will be added
00052   // if necessary.
00053   ACE_CDR::ULong const aligned_length =
00054     ACE_align_binary (total_pending_length, ACE_CDR::MAX_ALIGNMENT);
00055 
00056   // this->max_message_size_ must be >= 24 bytes, i.e.:
00057   //   12 for GIOP protocol header
00058   //  + 4 for GIOP fragment header
00059   //  + 8 for payload (including padding)
00060   // since fragments must be aligned on an 8 byte boundary.
00061   if (aligned_length > this->max_message_size_)
00062     {
00063       // Pad the outgoing fragment if necessary.
00064       if (cdr.align_write_ptr (ACE_CDR::MAX_ALIGNMENT) != 0)
00065         return -1;
00066 
00067       // More fragments to come.
00068       cdr.more_fragments (true);
00069 
00070       if (TAO_debug_level > 0)
00071         ACE_DEBUG ((LM_DEBUG,
00072                     "TAO (%P|%t) - On_Demand_Fragmentation_Strategy::fragment, "
00073                     "sending fragment of size %d\n",
00074                     cdr.total_length ()));
00075 
00076       // Send the current CDR stream contents through the transport,
00077       // making sure to switch on the the GIOP flags "more fragments"
00078       // bit.
00079       if (this->transport_->send_message (cdr,
00080                                           cdr.stub (),
00081                                           cdr.message_semantics (),
00082                                           cdr.timeout ()) == -1
00083 
00084           // Now generate a fragment header.
00085           || this->transport_->messaging_object ()->generate_fragment_header (
00086                cdr,
00087                cdr.request_id ()) != 0)
00088         return -1;
00089     }
00090 
00091   return 0;
00092 }

void TAO_On_Demand_Fragmentation_Strategy::operator= ( TAO_On_Demand_Fragmentation_Strategy const &   )  [private]


Member Data Documentation

ACE_CDR::ULong const TAO_On_Demand_Fragmentation_Strategy::max_message_size_ [private]

Size of GIOP message at which fragmentation will occur.

Definition at line 69 of file On_Demand_Fragmentation_Strategy.h.

TAO_Transport* const TAO_On_Demand_Fragmentation_Strategy::transport_ [private]

Pointer to the underlying transport object.

Definition at line 66 of file On_Demand_Fragmentation_Strategy.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:39:38 2010 for TAO by  doxygen 1.4.7