UIPMC_Connection_Handler.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file     UIPMC_Connection_Handler.h
00006  *
00007  *  $Id: UIPMC_Connection_Handler.h 79015 2007-07-24 15:03:04Z vridosh $
00008  *
00009  *  @author Frank Hunleth <fhunleth@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_UIPMC_CONNECTION_HANDLER_H
00014 #define TAO_UIPMC_CONNECTION_HANDLER_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "orbsvcs/PortableGroup/portablegroup_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 #pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "orbsvcs/PortableGroup/UIPMC_Transport.h"
00025 
00026 #include "tao/Wait_Strategy.h"
00027 #include "tao/Connection_Handler.h"
00028 
00029 #include "ace/Acceptor.h"
00030 #include "ace/Reactor.h"
00031 #include "ace/SOCK_Dgram.h"
00032 
00033 
00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00035 
00036 // Forward Decls
00037 class TAO_Pluggable_Messaging;
00038 
00039 // This connection handler.
00040 typedef ACE_Svc_Handler<ACE_SOCK_DGRAM, ACE_NULL_SYNCH>
00041         TAO_UIPMC_SVC_HANDLER;
00042 
00043 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
00044 template class TAO_PortableGroup_Export ACE_Svc_Handler<ACE_SOCK_DGRAM, ACE_NULL_SYNCH>;
00045 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
00046 
00047 // ****************************************************************
00048 
00049 /**
00050  * @class TAO_UIPMC_Connection_Handler
00051  *
00052  * @brief  Handles requests on a single connection.
00053  *
00054  * Since MIOP is asymmetric then this Connection handler
00055  * is for only use in the Connector.
00056  */
00057 class TAO_PortableGroup_Export TAO_UIPMC_Connection_Handler :
00058   public TAO_UIPMC_SVC_HANDLER,
00059   public TAO_Connection_Handler
00060 {
00061 
00062 public:
00063 
00064   TAO_UIPMC_Connection_Handler (ACE_Thread_Manager* t = 0);
00065 
00066   /// Constructor. <arg> parameter is used by the Acceptor to pass the
00067   /// protocol configuration properties for this connection.
00068   TAO_UIPMC_Connection_Handler (TAO_ORB_Core *orb_core);
00069 
00070 
00071   /// Destructor.
00072   ~TAO_UIPMC_Connection_Handler (void);
00073 
00074   //@{
00075   /** @name Connection Handler overloads
00076    */
00077   virtual int open_handler (void *v);
00078   //@}
00079 
00080   /// Close called by the Acceptor or Connector when connection
00081   /// establishment fails.
00082   int close (u_long = 0);
00083 
00084   //@{
00085   /** @name Event Handler overloads
00086    */
00087   virtual int resume_handler (void);
00088   virtual int close_connection (void);
00089   virtual int handle_input (ACE_HANDLE);
00090   virtual int handle_output (ACE_HANDLE);
00091   virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
00092   virtual int handle_timeout (const ACE_Time_Value &current_time,
00093                               const void *act = 0);
00094   virtual int open (void *);
00095   //@}
00096 
00097   /// Add ourselves to Cache.
00098   int add_transport_to_cache (void);
00099 
00100   /// Set Diff-Serv codepoint on outgoing packets.
00101   int set_dscp_codepoint (CORBA::Boolean set_network_priority);
00102   int set_dscp_codepoint (CORBA::Long dscp_codepoint);
00103 
00104   // UIPMC Additions - Begin
00105   const ACE_INET_Addr &addr (void);
00106 
00107   void addr (const ACE_INET_Addr &addr);
00108 
00109   const ACE_INET_Addr &local_addr (void);
00110 
00111   void local_addr (const ACE_INET_Addr &addr);
00112 
00113   /// This is only to be able to use client and server
00114   /// connection handlers in the same way in transport.
00115   ssize_t send (const iovec iov[],
00116                 int n,
00117                 const ACE_Addr &addr,
00118                 int flags = 0) const;
00119   // UIPMC Additions - End
00120 
00121 protected:
00122 
00123   // UIPMC Additions - Begin
00124 
00125   // This is always the remote address
00126   ACE_INET_Addr addr_;
00127 
00128   // This is always the local address for the connector
00129   ACE_INET_Addr local_addr_;
00130 
00131   // UIPMC Additions - End
00132 
00133   //@{
00134   /**
00135    * @name TAO_Connection Handler overloads
00136    */
00137   virtual int release_os_resources (void);
00138   //@}
00139 
00140   // helper function used by the set_dscp_codepoint () methods to
00141   // set the TOS field in the IP packets.
00142   int set_tos (int tos);
00143 
00144 private:
00145 
00146   /// Stores the type of service value.
00147   int dscp_codepoint_;
00148 };
00149 
00150 // Transport for this handler.
00151 typedef TAO_UIPMC_Transport<TAO_UIPMC_Connection_Handler>
00152         UIPMC_TRANSPORT;
00153 
00154 #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT
00155 template class TAO_PortableGroup_Export TAO_UIPMC_Transport<TAO_UIPMC_Connection_Handler>;
00156 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */
00157 
00158 TAO_END_VERSIONED_NAMESPACE_DECL
00159 
00160 #include /**/ "ace/post.h"
00161 #endif /* TAO_UIPMC_CONNECTION_HANDLER_H */

Generated on Sun Jan 27 16:22:31 2008 for TAO_PortableGroup by doxygen 1.3.6