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