3 //=============================================================================
5 * @file QoS_Session_Impl.h
7 * @author Vishal Kachroo <vishal@cs.wustl.edu>
9 //=============================================================================
12 #ifndef ACE_QOS_SESSION_IMPL_H
13 #define ACE_QOS_SESSION_IMPL_H
14 #include /**/ "ace/pre.h"
16 #include "ace/QoS/QoS_Session.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if defined (ACE_HAS_RAPI)
25 #define DEFAULT_SOURCE_SENDER_PORT 10001
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 * @class ACE_RAPI_Session
32 * @brief A RAPI QoS session object.
34 * This class is a RAPI (RSVP API, an implementation of RSVP on UNIX)
35 * implementation of the ACE_QoS_Session interface.
37 class ACE_QoS_Export ACE_RAPI_Session
: public ACE_QoS_Session
40 /// Default destructor.
43 /// Error handling for RSVP callback
44 static int rsvp_error
;
46 /// Open a RAPI QoS session [dest IP, dest port, Protocol ID].
47 virtual int open (ACE_INET_Addr dest_addr
,
48 ACE_Protocol_ID protocol_id
);
50 /// Close the RAPI QoS Session.
53 /// Returns the QoS for this RAPI session.
54 virtual ACE_QoS
qos () const;
56 /// Set QoS for this RAPI session. The socket parameter is used to confirm if
57 /// this QoS session was subscribed to by the socket.
58 virtual int qos (ACE_SOCK
*socket
,
59 ACE_QoS_Manager
*qos_manager
,
60 const ACE_QoS
&ace_qos
);
63 * Sets the QoS for this session object to ace_qos. Does not interfere with the
64 * QoS in the underlying socket. This call is useful to update the QoS object
65 * when the underlying socket QoS is being set through a mechanism other than
66 * the previous qos () method e.g. inside the dgram_mcast.subscribe () where the
67 * QoS for the socket is set through ACE_OS::join_leaf ().
69 virtual void qos (const ACE_QoS
&ace_qos
);
72 * Calls rapi_dispatch () that further triggers the call back function.
73 * It is a mechanism of updating the QoS for this session asynchronously, as
76 virtual int update_qos ();
78 /// Get methods for the flags_.
79 virtual ACE_End_Point_Type
flags () const;
81 /// Set methods for the flags_.
82 virtual void flags (const ACE_End_Point_Type flags
);
84 /// Get the RAPI session id.
85 virtual int session_id () const;
87 /// Set the RAPI session id.
88 virtual void session_id (const int session_id
);
90 /// Get the RAPI file descriptor for RSVP events.
91 virtual ACE_HANDLE
rsvp_events_handle ();
93 ///Set the RAPI event that last occurred
94 virtual void rsvp_event_type (RSVP_Event_Type event_type
);
96 ///Get the RAPI event that last occurred
97 virtual RSVP_Event_Type
rsvp_event_type ();
99 /// Get the destination address for this RAPI session.
100 virtual ACE_INET_Addr
dest_addr () const;
102 /// Set the destination address for this RAPI session.
103 virtual void dest_addr (const ACE_INET_Addr
&dest_addr
);
105 /// Get the source port for this session.
106 virtual u_short
source_port () const;
108 /// Set the source port for this session.
109 virtual void source_port (const u_short
&source_port
);
111 //Set the source host
112 virtual ACE_INET_Addr
* source_addr () const;
114 /// Set the source port for this session.
115 virtual void source_addr (ACE_INET_Addr
* source_addr
);
117 /// RAPI version. Returned value = 100 * major-version + minor-version.
118 virtual int version ();
120 /// The factory is a friend so it can create this object through
121 /// the only private constructor.
122 friend class ACE_QoS_Session_Factory
;
125 /// Default constuctor. Constructor is defined private so that only
126 /// the friend factory can instantiate this class.
129 /// Construct a simplified RAPI Sender TSpec object
130 /// from an ACE_Flow_Spec object. Used internally by this class.
131 rapi_tspec_t
*init_tspec_simplified (const ACE_Flow_Spec
&flow_spec
);
133 /// Construct a simplified RAPI Receiver FlowSpec object
134 /// from an ACE_Flow_Spec object. Used internally by the class.
135 rapi_flowspec_t
*init_flowspec_simplified(const ACE_Flow_Spec
&flow_spec
);
137 /// Set sending QoS for this RAPI session.
138 int sending_qos (const ACE_QoS
&ace_qos
);
140 /// Set receiving QoS for this RAPI session.
141 int receiving_qos (const ACE_QoS
&ace_qos
);
144 ACE_END_VERSIONED_NAMESPACE_DECL
146 #endif /* ACE_HAS_RAPI */
148 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
151 * @class ACE_GQoS_Session
153 * @brief A GQoS session object.
155 * This class is a GQoS (Generic QoS, an implementation of RSVP on
156 * Win2K) implementation of the ACE_QoS_Session interface.
158 class ACE_QoS_Export ACE_GQoS_Session
: public ACE_QoS_Session
161 /// Default destructor.
162 ~ACE_GQoS_Session ();
164 /// This is a session ID generator. It does a lot more than expected
166 static int GQoS_session_id
;
168 /// Open a GQoS session [dest IP, dest port, Protocol ID].
169 virtual int open (ACE_INET_Addr dest_addr
,
170 ACE_Protocol_ID protocol_id
);
172 /// Close the GQoS Session.
173 virtual int close ();
175 /// Returns the QoS for this GQoS session.
176 virtual ACE_QoS
qos () const;
178 /// Set QoS for this GQoS session. The socket parameter is used to confirm if
179 /// this QoS session was subscribed to by the socket.
180 virtual int qos (ACE_SOCK
*socket
,
181 ACE_QoS_Manager
*qos_manager
,
182 const ACE_QoS
&ace_qos
);
185 * Sets the QoS for this session object to ace_qos. Does not interfere with the
186 * QoS in the underlying socket. This call is useful to update the QoS object
187 * when the underlying socket QoS is being set through a mechanism other than
188 * the previous qos () method e.g. inside the dgram_mcast.subscribe () where the
189 * QoS for the socket is set through ACE_OS::join_leaf ().
191 virtual void qos (const ACE_QoS
&ace_qos
);
193 /// Calls the ioctl (ACE_SIO_GET_QOS). It is a mechanism of updating the
194 /// QoS for this session asynchronously, as RSVP events occur.
195 virtual int update_qos ();
197 /// Get/Set methods for the flags_.
198 virtual ACE_End_Point_Type
flags () const;
199 virtual void flags (const ACE_End_Point_Type flags
);
201 /// Get the destination address for this GQoS session.
202 virtual ACE_INET_Addr
dest_addr () const;
204 /// Set the destination address for this GQoS session.
205 virtual void dest_addr (const ACE_INET_Addr
&dest_addr
);
207 /// Get the source port for this session.
208 virtual u_short
source_port () const;
210 /// Set the source port for this session.
211 virtual void source_port (const u_short
&source_port
);
213 //Set the source host
214 virtual ACE_INET_Addr
* source_addr () const;
216 /// Set the source port for this session.
217 virtual void source_addr (ACE_INET_Addr
* source_addr
);
219 /// Get the GQoS session id.
220 virtual int session_id () const;
222 /// Set the GQoS session id.
223 virtual void session_id (const int session_id
);
225 /// Get the file descriptor of the underlying socket.
226 virtual ACE_HANDLE
rsvp_events_handle ();
228 virtual void rsvp_event_type (RSVP_Event_Type event_type
);
229 ///Set the RAPI event that last occurred
231 virtual RSVP_Event_Type
rsvp_event_type ();
232 ///Get the RAPI event that last occurred
235 virtual int version ();
237 /// The factory is a friend so it can create this object through
238 /// the only private constructor.
239 friend class ACE_QoS_Session_Factory
;
242 /// Default constructor. Constructor is defined private so that only
243 /// the friend factory can instantiate this class.
247 ACE_END_VERSIONED_NAMESPACE_DECL
249 #if defined (__ACE_INLINE__)
250 #include "QoS_Session_Impl.inl"
251 #endif /* __ACE_INLINE__ */
253 #include /**/ "ace/post.h"
254 #endif /* ACE_QOS_SESSION_IMPL_H */