00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file QoS_Session_Impl.h 00006 * 00007 * $Id: QoS_Session_Impl.h 80826 2008-03-04 14:51:23Z wotte $ 00008 * 00009 * @author Vishal Kachroo <vishal@cs.wustl.edu> 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef ACE_QOS_SESSION_IMPL_H 00015 #define ACE_QOS_SESSION_IMPL_H 00016 #include /**/ "ace/pre.h" 00017 00018 #include "ace/QoS/QoS_Session.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 00025 #if defined (ACE_HAS_RAPI) 00026 #include "rapi_lib.h" 00027 00028 #define DEFAULT_SOURCE_SENDER_PORT 10001 00029 00030 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00031 00032 /** 00033 * @class ACE_RAPI_Session 00034 * 00035 * @brief A RAPI QoS session object. 00036 * 00037 * This class is a RAPI (RSVP API, an implementation of RSVP on UNIX) 00038 * implementation of the ACE_QoS_Session interface. 00039 */ 00040 class ACE_QoS_Export ACE_RAPI_Session : public ACE_QoS_Session 00041 { 00042 00043 public: 00044 00045 /// Default destructor. 00046 ~ACE_RAPI_Session (void); 00047 00048 /// Error handling for RSVP callback 00049 static int rsvp_error; 00050 00051 /// Open a RAPI QoS session [dest IP, dest port, Protocol ID]. 00052 virtual int open (ACE_INET_Addr dest_addr, 00053 ACE_Protocol_ID protocol_id); 00054 00055 /// Close the RAPI QoS Session. 00056 virtual int close (void); 00057 00058 /// Returns the QoS for this RAPI session. 00059 virtual ACE_QoS qos (void) const; 00060 00061 /// Set QoS for this RAPI session. The socket parameter is used to confirm if 00062 /// this QoS session was subscribed to by the socket. 00063 virtual int qos (ACE_SOCK *socket, 00064 ACE_QoS_Manager *qos_manager, 00065 const ACE_QoS &ace_qos); 00066 00067 /** 00068 * Sets the QoS for this session object to ace_qos. Does not interfere with the 00069 * QoS in the underlying socket. This call is useful to update the QoS object 00070 * when the underlying socket QoS is being set through a mechanism other than 00071 * the previous qos () method e.g. inside the dgram_mcast.subscribe () where the 00072 * QoS for the socket is set through ACE_OS::join_leaf (). 00073 */ 00074 virtual void qos (const ACE_QoS &ace_qos); 00075 00076 /** 00077 * Calls rapi_dispatch () that further triggers the call back function. 00078 * It is a mechanism of updating the QoS for this session asynchronously, as 00079 * RSVP events occur. 00080 */ 00081 virtual int update_qos (void); 00082 00083 /// Get methods for the flags_. 00084 virtual ACE_End_Point_Type flags (void) const; 00085 00086 /// Set methods for the flags_. 00087 virtual void flags (const ACE_End_Point_Type flags); 00088 00089 /// Get the RAPI session id. 00090 virtual int session_id (void) const; 00091 00092 /// Set the RAPI session id. 00093 virtual void session_id (const int session_id); 00094 00095 /// Get the RAPI file descriptor for RSVP events. 00096 virtual ACE_HANDLE rsvp_events_handle (void); 00097 00098 ///Set the RAPI event that last occured 00099 virtual void rsvp_event_type (RSVP_Event_Type event_type); 00100 00101 ///Get the RAPI event that last occured 00102 virtual RSVP_Event_Type rsvp_event_type (void); 00103 00104 /// Get the destination address for this RAPI session. 00105 virtual ACE_INET_Addr dest_addr (void) const; 00106 00107 /// Set the destination address for this RAPI session. 00108 virtual void dest_addr (const ACE_INET_Addr &dest_addr); 00109 00110 /// Get the source port for this session. 00111 virtual u_short source_port (void) const; 00112 00113 /// Set the source port for this session. 00114 virtual void source_port (const u_short &source_port); 00115 00116 //Set the source host 00117 virtual ACE_INET_Addr* source_addr (void) const; 00118 00119 /// Set the source port for this session. 00120 virtual void source_addr (ACE_INET_Addr* source_addr); 00121 00122 /// RAPI version. Returned value = 100 * major-version + minor-version. 00123 virtual int version (); 00124 00125 /// The factory is a friend so it can create this object through 00126 /// the only private constructor. 00127 friend class ACE_QoS_Session_Factory; 00128 00129 private: 00130 00131 /// Default constuctor. Constructor is defined private so that only 00132 /// the friend factory can instantiate this class. 00133 ACE_RAPI_Session (void); 00134 00135 /// Construct a simplified RAPI Sender TSpec object 00136 /// from an ACE_Flow_Spec object. Used internally by this class. 00137 rapi_tspec_t *init_tspec_simplified (const ACE_Flow_Spec &flow_spec); 00138 00139 /// Construct a simplified RAPI Receiver FlowSpec object 00140 /// from an ACE_Flow_Spec object. Used internally by the class. 00141 rapi_flowspec_t *init_flowspec_simplified(const ACE_Flow_Spec &flow_spec); 00142 00143 /// Set sending QoS for this RAPI session. 00144 int sending_qos (const ACE_QoS &ace_qos); 00145 00146 /// Set receiving QoS for this RAPI session. 00147 int receiving_qos (const ACE_QoS &ace_qos); 00148 00149 }; 00150 00151 ACE_END_VERSIONED_NAMESPACE_DECL 00152 00153 #endif /* ACE_HAS_RAPI */ 00154 00155 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00156 00157 /** 00158 * @class ACE_GQoS_Session 00159 * 00160 * @brief A GQoS session object. 00161 * 00162 * This class is a GQoS (Generic QoS, an implementation of RSVP on 00163 * Win2K) implementation of the ACE_QoS_Session interface. 00164 */ 00165 class ACE_QoS_Export ACE_GQoS_Session : public ACE_QoS_Session 00166 { 00167 00168 public: 00169 00170 /// Default destructor. 00171 ~ACE_GQoS_Session (void); 00172 00173 /// This is a session ID generator. It does a lot more than expected 00174 /// from an int!. 00175 static int GQoS_session_id; 00176 00177 /// Open a GQoS session [dest IP, dest port, Protocol ID]. 00178 virtual int open (ACE_INET_Addr dest_addr, 00179 ACE_Protocol_ID protocol_id); 00180 00181 /// Close the GQoS Session. 00182 virtual int close (void); 00183 00184 /// Returns the QoS for this GQoS session. 00185 virtual ACE_QoS qos (void) const; 00186 00187 /// Set QoS for this GQoS session. The socket parameter is used to confirm if 00188 /// this QoS session was subscribed to by the socket. 00189 virtual int qos (ACE_SOCK *socket, 00190 ACE_QoS_Manager *qos_manager, 00191 const ACE_QoS &ace_qos); 00192 00193 /** 00194 * Sets the QoS for this session object to ace_qos. Does not interfere with the 00195 * QoS in the underlying socket. This call is useful to update the QoS object 00196 * when the underlying socket QoS is being set through a mechanism other than 00197 * the previous qos () method e.g. inside the dgram_mcast.subscribe () where the 00198 * QoS for the socket is set through ACE_OS::join_leaf (). 00199 */ 00200 virtual void qos (const ACE_QoS &ace_qos); 00201 00202 /// Calls the ioctl (ACE_SIO_GET_QOS). It is a mechanism of updating the 00203 /// QoS for this session asynchronously, as RSVP events occur. 00204 virtual int update_qos (void); 00205 00206 /// Get/Set methods for the flags_. 00207 virtual ACE_End_Point_Type flags (void) const; 00208 virtual void flags (const ACE_End_Point_Type flags); 00209 00210 /// Get the destination address for this GQoS session. 00211 virtual ACE_INET_Addr dest_addr (void) const; 00212 00213 /// Set the destination address for this GQoS session. 00214 virtual void dest_addr (const ACE_INET_Addr &dest_addr); 00215 00216 /// Get the source port for this session. 00217 virtual u_short source_port (void) const; 00218 00219 /// Set the source port for this session. 00220 virtual void source_port (const u_short &source_port); 00221 00222 //Set the source host 00223 virtual ACE_INET_Addr* source_addr (void) const; 00224 00225 /// Set the source port for this session. 00226 virtual void source_addr (ACE_INET_Addr* source_addr); 00227 00228 /// Get the GQoS session id. 00229 virtual int session_id (void) const; 00230 00231 /// Set the GQoS session id. 00232 virtual void session_id (const int session_id); 00233 00234 /// Get the file descriptor of the underlying socket. 00235 virtual ACE_HANDLE rsvp_events_handle (void); 00236 00237 virtual void rsvp_event_type (RSVP_Event_Type event_type); 00238 ///Set the RAPI event that last occured 00239 00240 virtual RSVP_Event_Type rsvp_event_type (void); 00241 ///Get the RAPI event that last occured 00242 00243 /// GQoS version. 00244 virtual int version (); 00245 00246 /// The factory is a friend so it can create this object through 00247 /// the only private constructor. 00248 friend class ACE_QoS_Session_Factory; 00249 00250 private: 00251 00252 /// Default constructor. Constructor is defined private so that only 00253 /// the friend factory can instantiate this class. 00254 ACE_GQoS_Session (void); 00255 00256 }; 00257 00258 ACE_END_VERSIONED_NAMESPACE_DECL 00259 00260 #if defined (__ACE_INLINE__) 00261 #include "QoS_Session_Impl.inl" 00262 #endif /* __ACE_INLINE__ */ 00263 00264 #include /**/ "ace/post.h" 00265 #endif /* ACE_QOS_SESSION_IMPL_H */