📄 iiop.spl
字号:
<?xml version="1.0"?>
<!-- IIOP Pluggable Protocol specialization
* ======================================
* This specializes the pluggable protocol framework within
* TAO for the IIOP concrete protocol implementation. This
* specialization encompasses specializations, such as
* specializations for the Transport, Profile, end-point,
* Acceptor and Connector implementations within ACE+TAO.
*
* @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu>
* $Id: iiop.spl 80826 2008-03-04 14:51:23Z wotte $
-->
<transform>
<module name="TAO/tao">
<!-- Transformations to Transport implementation in TAO -->
<file name="Transport.h">
<!-- Search for TAO_Connection_Handler -->
<substitute match-line="yes">
<search>class TAO_Connection_Handler;</search>
<replace>#include "tao/Connection_Handler.h"</replace>
</substitute>
<!-- Add forward declarations and includes specific to
IIOP -->
<add>
<hook>TAO_TRANSPORT_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
<data>
namespace IIOP
{
class ListenPointList;
}
class TAO_Acceptor;
class TAO_Adapter;
</data>
</add>
<!-- Remove all virtual and pure virtual methods in this
class -->
<remove>virtual</remove>
<substitute match-line="yes">
<search>= 0;</search>
<replace>;</replace>
</substitute>
<!-- Replace the base class constructor with the derive
classes's constructor -->
<substitute match-line="yes">
<search>TAO_Transport \(CORBA::ULong tag,</search>
<replace>TAO_Transport (TAO_IIOP_Connection_Handler *, CORBA::ULong tag,
</replace>
</substitute>
<!-- Add public methods defined in IIOP_Transport -->
<add>
<hook>TAO_TRANSPORT_SPL_PUBLIC_METHODS_ADD_HOOK</hook>
<data>
/// Bridge method to call a similar method on the connection handler
void update_protocol_properties (int send_buffer_size,
int recv_buffer_size,
int no_delay,
int enable_network_priority);
/// Generate the request header
int generate_request_header (TAO_Operation_Details &opd,
TAO_Target_Specification &spec,
TAO_OutputCDR &msg);
</data>
</add>
<!-- Add private methods from IIOP_Transport -->
<add>
<hook>TAO_TRANSPORT_SPL_PRIVATE_METHODS_ADD_HOOK</hook>
<data>
void set_bidir_context_info (TAO_Operation_Details &opdetails);
int get_listen_point (IIOP::ListenPointList &listen_point_list,
TAO_Acceptor *acceptor);
</data>
</add>
<!-- Add private data from IIOP_Transport -->
<add>
<hook>TAO_TRANSPORT_SPL_DATA_MEMBERS_ADD_HOOK</hook>
<data>
/// The connection service handler used for accessing lower layer
/// communication protocols.
TAO_IIOP_Connection_Handler *connection_handler_;
/// Our messaging object.
TAO_Pluggable_Messaging *messaging_object_;
</data>
</add>
<!-- Typedef the TAO_Transport as IIOP_Transport -->
<add>
<hook>TAO_TRANSPORT_SPL_EXTERN_ADD_HOOK</hook>
<data>typedef TAO_Transport TAO_IIOP_Transport;</data>
</add>
<!-- This method is overridden in the derived class -->
<substitute>
<search>generate_request_header</search>
<replace>generate_request_header_base__</replace>
</substitute>
</file>
<file name="Transport.cpp">
<!-- Add necessary includes -->
<add>
<hook>TAO_TRANSPORT_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
<data>
#include "Transport_Acceptor.h"
#include "IIOPC.h"
#include "Acceptor_Registry.h"
#include "operation_details.h"
#include "GIOP_Message_Base.h"
#include "Protocols_Hooks.h"
</data>
</add>
<!-- Modify the TAO constructor adding the IIOP Transport's data -->
<substitute match-line="yes">
<search>TAO_Transport::TAO_Transport \(CORBA::ULong tag,</search>
<replace>TAO_Transport::TAO_Transport (TAO_IIOP_Connection_Handler *handler,
CORBA::ULong tag,
</replace>
</substitute>
<substitute match-line="yes">
<search>, partial_message_ \(0\)</search>
<replace> , partial_message_ (0)
, connection_handler_ (handler)
, messaging_object_ (0)
</replace>
</substitute>
<!-- Within the constructor create/initialize the messaging object -->
<add>
<hook>TAO_TRANSPORT_SPL_CONSTRUCTOR_ADD_HOOK</hook>
<data>
// Use the normal GIOP object
ACE_NEW (this->messaging_object_,
TAO_GIOP_Message_Base (orb_core));
</data>
</add>
<add>
<hook>TAO_TRANSPORT_SPL_DESTRUCTOR_ADD_HOOK</hook>
<data>delete this->messaging_object_;</data>
</add>
<!-- comment out unimplemented base class methods -->
<comment>
<start-hook>TAO_TRANSPORT_SPL_COMMENT_HOOK_START</start-hook>
<end-hook>TAO_TRANSPORT_SPL_COMMENT_HOOK_END</end-hook>
</comment>
<!-- Add the concrete methods from IIOP_Transport implementation -->
<copy-from-source>
<source>IIOP_Transport.cpp</source>
<copy-hook-start>TAO_TRANSPORT_SPL_COPY_HOOK_START</copy-hook-start>
<copy-hook-end>TAO_TRANSPORT_SPL_COPY_HOOK_END</copy-hook-end>
<dest-hook>TAO_TRANSPORT_SPL_METHODS_ADD_HOOK</dest-hook>
</copy-from-source>
<!-- The derived class calls this method. Override this -->
<substitute>
<search>TAO_Transport::generate_request_header</search>
<replace>TAO_Transport::generate_request_header_base__</replace>
</substitute>
</file>
<!-- Transformations to specialize Connection_Handler class -->
<file name="Connection_Handler.h">
<!-- Remove the default constructor, NOTE: we use regular expressions
to match the constructor but not the destructor -->
<remove>\s+TAO_Connection_Handler\s*\(void\);</remove>
<!-- Make sure that Connection_Handler inherits from SVC_HANDLER -->
<substitute match-line="yes">
<search>: public TAO_LF_CH_Event</search>
<replace>: public TAO_IIOP_SVC_HANDLER,
public TAO_LF_CH_Event
</replace>
</substitute>
<!-- Forward declarations -->
<add>
<hook>CONNECTION_HANDLER_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
<data>
#include "ace/Svc_Handler.h"
#include "ace/SOCK_Stream.h"
typedef ACE_Svc_Handler < ACE_SOCK_STREAM, ACE_NULL_SYNCH >
TAO_IIOP_SVC_HANDLER;
namespace IIOP
{
class ListenPointList;
}
</data>
</add>
<!-- Public methods from IIOP_Connection_Handler class -->
<add>
<hook>CONNECTION_HANDLER_SPL_PUBLIC_METHODS_ADD_HOOK</hook>
<data>
int open (void *);
int close (u_long = 0);
int resume_handler (void);
int handle_output (ACE_HANDLE);
int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
int handle_timeout (const ACE_Time_Value &current_time,
const void *act = 0);
/// Add ourselves to Cache.
int add_transport_to_cache (void);
/// Process the @a listen_list
int process_listen_point_list (IIOP::ListenPointList &listen_list);
/// Check if network priority needs to be enabled
int enable_network_priority (void);
TAO_Connection_Handler (ACE_Thread_Manager * = 0);
/// Constructor.
TAO_Connection_Handler (TAO_ORB_Core *orb_core,
CORBA::Boolean flag);
</data>
</add>
<!-- Private data members -->
<add>
<hook>CONNECTION_HANDLER_SPL_PRIVATE_DATA_ADD_HOOK</hook>
<data>int dscp_codepoint_;</data>
</add>
<!-- Typedef the class -->
<add>
<hook>CONNECTION_HANDLER_SPL_EXTERN_ADD_HOOK</hook>
<data>typedef TAO_Connection_Handler TAO_IIOP_Connection_Handler;</data>
</add>
<!-- Remove all virtuals and =0; from the code -->
<remove>virtual</remove>
<substitute match-line="yes">
<search>= 0;</search>
<replace>;</replace>
</substitute>
</file>
<file name="Connection_Handler.cpp">
<!-- Add the include hook -->
<add>
<hook>CONNECTION_HANDLER_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
<data>
#include "IIOPC.h"
#include "Thread_Lane_Resources.h"
#include "Base_Transport_Property.h"
#include "Protocols_Hooks.h"
#include "Wait_Strategy.h"
#include "ace/os_include/netinet/os_tcp.h"
#include "ace/os_include/os_netdb.h"
</data>
</add>
<!-- IIOP_Connection_Handler constructors added -->
<add>
<hook>CONNECTION_HANDLER_SPL_METHODS_ADD_HOOK</hook>
<data>
TAO_Connection_Handler::TAO_Connection_Handler (ACE_Thread_Manager *t)
: TAO_IIOP_SVC_HANDLER (t, 0 , 0),
orb_core_ (0),
dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
{
ACE_ASSERT (0);
}
TAO_Connection_Handler::TAO_Connection_Handler (
TAO_ORB_Core *orb_core,
CORBA::Boolean flag)
: TAO_IIOP_SVC_HANDLER (orb_core->thr_mgr (), 0, 0),
orb_core_ (orb_core),
transport_ (0),
dscp_codepoint_ (IPDSFIELD_DSCP_DEFAULT << 2)
{
TAO_IIOP_Transport* specific_transport = 0;
ACE_NEW (specific_transport,
TAO_IIOP_Transport (this, IOP::TAG_INTERNET_IOP, orb_core));
// store this pointer (indirectly increment ref count)
this->transport (specific_transport);
// @@todo: We need to have a distinct option/ method in the resource
// factory for this and TAO_Transport.
this->lock_ =
this->orb_core_->resource_factory ()->create_cached_connection_lock ();
// Put ourselves in the connection wait state as soon as we get
// created
this->state_changed (TAO_LF_Event::LFS_CONNECTION_WAIT,
this->orb_core_->leader_follower ());
}
</data>
</add>
<!-- Replace all occurances of IIOP_Connection_Handler with that
of TAO_Connection_Handler -->
<substitute>
<search>TAO_IIOP_Connection_Handler</search>
<replace>TAO_Connection_Handler</replace>
</substitute>
<!-- Comment out base class methods that are over-ridden in the
derived class -->
<comment>
<start-hook>CONNECTION_HANDLER_SPL_COMMENT_HOOK_START</start-hook>
<end-hook>CONNECTION_HANDLER_SPL_COMMENT_HOOK_END</end-hook>
</comment>
<!-- Copy operations from IIOP_Connection_Handler class and put them
in the Connection_Handler class -->
<copy-from-source>
<source>IIOP_Connection_Handler.cpp</source>
<copy-hook-start>CONNECTION_HANDLER_SPL_COPY_HOOK_START</copy-hook-start>
<copy-hook-end>CONNECTION_HANDLER_SPL_COPY_HOOK_END</copy-hook-end>
<dest-hook>CONNECTION_HANDLER_SPL_METHODS_ADD_HOOK</dest-hook>
</copy-from-source>
<add>
<hook>CONNECTION_HANDLER_DESTRUCTOR_ADD_HOOK</hook>
<data>delete this->transport ();</data>
</add>
</file>
<!-- Modifications to Acceptor and Connector Components in TAO -->
<file name="Transport_Acceptor.h">
<!-- Forward declaration -->
<add>
<hook>TAO_ACCEPTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK</hook>
<data>
#include "tao/Connection_Handler.h"
#include "tao/Acceptor_Impl.h"
#include "tao/GIOP_Message_Version.h"
#include "ace/Acceptor.h"
#include "ace/SOCK_Acceptor.h"
</data>
</add>
<!-- Methods from IIOP_Acceptor components -->
<copy-from-source>
<source>IIOP_Acceptor.h</source>
<copy-hook-start>TAO_ACCEPTOR_SPL_CONCRETE_METHODS_COPY_HOOK_START</copy-hook-start>
<copy-hook-end>TAO_ACCEPTOR_SPL_CONCRETE_METHODS_COPY_HOOK_END</copy-hook-end>
<dest-hook>TAO_ACCEPTOR_SPL_PUBLIC_METHODS_ADD_HOOK</dest-hook>
</copy-from-source>
<!-- Typedef hook -->
<add>
<hook>TAO_ACCEPTOR_SPL_EXTERN_ADD_HOOK</hook>
<data>typedef TAO_Acceptor TAO_IIOP_Acceptor;
#if defined(__ACE_INLINE__)
#include "tao/IIOP_Acceptor.i"
#endif /* __ACE_INLINE__ */
</data>
</add>
<!-- Private data memeber -->
<copy-from-source>
<source>IIOP_Acceptor.h</source>
<copy-hook-start>TAO_ACCEPTOR_SPL_DATA_MEMBERS_COPY_HOOK_START</copy-hook-start>
<copy-hook-end>TAO_ACCEPTOR_SPL_DATA_MEMBERS_COPY_HOOK_END</copy-hook-end>
<dest-hook>TAO_ACCEPTOR_SPL_DATA_MEMBERS_ADD_HOOK</dest-hook>
</copy-from-source>
<!-- Eliminate the virtual functions -->
<remove>virtual</remove>
<substitute match-line="yes">
<search>= 0;</search>
<replace>;</replace>
</substitute>
<!-- Remove destructor -->
<remove>~TAO_IIOP_Acceptor \(void\);</remove>
<substitute>
<search>TAO_IIOP_Acceptor</search>
<replace>TAO_Acceptor</replace>
</substitute>
</file>
<!-- Transformations to Transport_Acceptor.cpp -->
<file name="Transport_Acceptor.cpp">
<copy-from-source>
<source>IIOP_Acceptor.cpp</source>
<copy-hook-start>TAO_ACCEPTOR_SPL_COPY_HOOK_START</copy-hook-start>
<copy-hook-end>TAO_ACCEPTOR_SPL_COPY_HOOK_END</copy-hook-end>
<dest-hook>TAO_ACCEPTOR_SPL_METHODS_ADD_HOOK</dest-hook>
</copy-from-source>
<!-- Modify the constructor -->
<substitute match-line="yes">
<search>: TAO_Acceptor \(IOP::TAG_INTERNET_IOP\),</search>
<replace>: tag_ (IOP::TAG_INTERNET_IOP),
</replace>
</substitute>
<!-- Add mthods to the destructor -->
<add>
<hook>TAO_ACCEPTOR_DESTRUCTOR_ADD_HOOK</hook>
<data>
this->close ();
delete this->creation_strategy_;
delete this->concurrency_strategy_;
delete this->accept_strategy_;
delete [] this->addrs_;
for (CORBA::ULong i = 0; i < this->endpoint_count_; ++i)
CORBA::string_free (this->hosts_[i]);
delete [] this->hosts_;
</data>
</add>
<!-- Trasnform IIOP_Acceptor to TAO_Acceptor -->
<substitute match-line="yes">
<search>#include "tao/IIOP_Acceptor.h"</search>
<replace> </replace>
</substitute>
<substitute match-line="yes">
<search>#include "tao/IIOP_Profile.h"</search>
<replace>#include "tao/Profile.h"</replace>
</substitute>
<substitute>
<search>TAO_IIOP_Acceptor::TAO_IIOP_Acceptor</search>
<replace>TAO_Acceptor::TAO_Acceptor</replace>
</substitute>
</file>
<file name="tao.mpc">
<!-- Do not build all IIOP_* files as the specializations
are moved to the base classes -->
<substitute>
<search>IIOP_Transport.cpp</search>
<replace>// IIOP_Transport.cpp </replace>
</substitute>
<substitute>
<search>IIOP_Transport.h</search>
<replace>// IIOP_Transport.h</replace>
</substitute>
<substitute>
<search>IIOP_Connection_Handler.cpp</search>
<replace>// IIOP_Connection_Handler.cpp</replace>
</substitute>
<substitute>
<search>IIOP_Connection_Handler.h</search>
<replace>// IIOP_Connection_Handler.h</replace>
</substitute>
<substitute>
<search>IIOP_Acceptor.cpp</search>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -