3 //=============================================================================
7 * $Id: OS_QoS.h 80826 2008-03-04 14:51:23Z wotte $
9 * @brief Contains OS specific data structures for QoS networking.
11 * @author Craig Rodrigues <crodrigu@bbn.com>
13 //=============================================================================
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/ACE_export.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "ace/os_include/sys/os_uio.h"
26 #include "ace/OS_NS_stropts.h"
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && defined (ACE_HAS_WINSOCK2_GQOS)
31 typedef SERVICETYPE ACE_SERVICE_TYPE
;
33 typedef unsigned long ACE_SERVICE_TYPE
;
34 #endif /* ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 != 0 */
36 #if defined (WSA_FLAG_OVERLAPPED)
37 # define ACE_OVERLAPPED_SOCKET_FLAG WSA_FLAG_OVERLAPPED
39 # define ACE_OVERLAPPED_SOCKET_FLAG 0
42 #if defined (XP1_QOS_SUPPORTED)
43 # define ACE_XP1_QOS_SUPPORTED XP1_QOS_SUPPORTED
45 # define ACE_XP1_QOS_SUPPORTED 0x00002000
48 #if defined (XP1_SUPPORT_MULTIPOINT)
49 # define ACE_XP1_SUPPORT_MULTIPOINT XP1_SUPPORT_MULTIPOINT
51 # define ACE_XP1_SUPPORT_MULTIPOINT 0x00000400
54 #if defined (WSABASEERR)
55 # define ACE_BASEERR WSABASEERR
57 # define ACE_BASEERR 10000
60 #if defined (WSAENOBUFS)
61 # define ACE_ENOBUFS WSAENOBUFS
63 # define ACE_ENOBUFS (ACE_BASEERR+55)
66 #if defined (FROM_PROTOCOL_INFO)
67 # define ACE_FROM_PROTOCOL_INFO FROM_PROTOCOL_INFO
69 # define ACE_FROM_PROTOCOL_INFO (-1)
72 #if defined (WSA_FLAG_MULTIPOINT_C_ROOT)
73 # define ACE_FLAG_MULTIPOINT_C_ROOT WSA_FLAG_MULTIPOINT_C_ROOT
75 # define ACE_FLAG_MULTIPOINT_C_ROOT 0x02
78 #if defined (WSA_FLAG_MULTIPOINT_C_LEAF)
79 # define ACE_FLAG_MULTIPOINT_C_LEAF WSA_FLAG_MULTIPOINT_C_LEAF
81 # define ACE_FLAG_MULTIPOINT_C_LEAF 0x04
84 #if defined (WSA_FLAG_MULTIPOINT_D_ROOT)
85 # define ACE_FLAG_MULTIPOINT_D_ROOT WSA_FLAG_MULTIPOINT_D_ROOT
87 # define ACE_FLAG_MULTIPOINT_D_ROOT 0x08
90 #if defined (WSA_FLAG_MULTIPOINT_D_LEAF)
91 # define ACE_FLAG_MULTIPOINT_D_LEAF WSA_FLAG_MULTIPOINT_D_LEAF
93 # define ACE_FLAG_MULTIPOINT_D_LEAF 0x10
96 #if defined (QOS_NOT_SPECIFIED)
97 # define ACE_QOS_NOT_SPECIFIED QOS_NOT_SPECIFIED
99 # define ACE_QOS_NOT_SPECIFIED 0xFFFFFFFF
102 #if defined (SERVICETYPE_NOTRAFFIC)
103 # define ACE_SERVICETYPE_NOTRAFFIC SERVICETYPE_NOTRAFFIC
105 # define ACE_SERVICETYPE_NOTRAFFIC 0x00000000 /* No data in this */
109 #if defined (SERVICETYPE_CONTROLLEDLOAD)
110 # define ACE_SERVICETYPE_CONTROLLEDLOAD SERVICETYPE_CONTROLLEDLOAD
112 # define ACE_SERVICETYPE_CONTROLLEDLOAD 0x00000001 /* Controlled Load. */
115 #if defined (SERVICETYPE_GUARANTEED)
116 # define ACE_SERVICETYPE_GUARANTEED SERVICETYPE_GUARANTEED
118 # define ACE_SERVICETYPE_GUARANTEED 0x00000003 /* Guaranteed. */
121 #if defined (JL_SENDER_ONLY)
122 # define ACE_JL_SENDER_ONLY JL_SENDER_ONLY
124 # define ACE_JL_SENDER_ONLY 0x01
127 #if defined (JL_BOTH)
128 # define ACE_JL_BOTH JL_BOTH
130 # define ACE_JL_BOTH 0x04
133 #if defined (SIO_GET_QOS)
134 # define ACE_SIO_GET_QOS SIO_GET_QOS
136 # define ACE_SIO_GET_QOS (0x40000000 | 0x08000000 | 7)
139 #if defined (SIO_MULTIPOINT_LOOPBACK)
140 # define ACE_SIO_MULTIPOINT_LOOPBACK SIO_MULTIPOINT_LOOPBACK
142 # define ACE_SIO_MULTIPOINT_LOOPBACK (0x08000000 | 9)
145 #if defined (SIO_MULTICAST_SCOPE)
146 # define ACE_SIO_MULTICAST_SCOPE SIO_MULTICAST_SCOPE
148 # define ACE_SIO_MULTICAST_SCOPE (0x08000000 | 10)
151 #if defined (SIO_SET_QOS)
152 # define ACE_SIO_SET_QOS SIO_SET_QOS
154 # define ACE_SIO_SET_QOS (0x08000000 | 11)
158 * @class ACE_Flow_Spec
160 * @brief Wrapper class that defines the flow spec QoS information,
161 * which is used by IntServ (RSVP) and DiffServ.
163 class ACE_Export ACE_Flow_Spec
164 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
166 #endif /* ACE_HAS_WINSOCK2 */
169 /// Default constructor.
170 ACE_Flow_Spec (void);
172 /// Constructor that initializes all the fields.
173 ACE_Flow_Spec (unsigned long token_rate
,
174 unsigned long token_bucket_size
,
175 unsigned long peak_bandwidth
,
176 unsigned long latency
,
177 unsigned long delay_variation
,
178 ACE_SERVICE_TYPE service_type
,
179 unsigned long max_sdu_size
,
180 unsigned long minimum_policed_size
,
184 /// Get the token rate in bytes/sec.
185 unsigned long token_rate (void) const;
187 /// Set the token rate in bytes/sec.
188 void token_rate (unsigned long tr
);
190 /// Get the token bucket size in bytes.
191 unsigned long token_bucket_size (void) const;
193 /// Set the token bucket size in bytes.
194 void token_bucket_size (unsigned long tbs
);
196 /// Get the PeakBandwidth in bytes/sec.
197 unsigned long peak_bandwidth (void) const;
199 /// Set the PeakBandwidth in bytes/sec.
200 void peak_bandwidth (unsigned long pb
);
202 /// Get the latency in microseconds.
203 unsigned long latency (void) const;
205 /// Set the latency in microseconds.
206 void latency (unsigned long l
);
208 /// Get the delay variation in microseconds.
209 unsigned long delay_variation (void) const;
211 /// Set the delay variation in microseconds.
212 void delay_variation (unsigned long dv
);
214 /// Get the service type.
215 ACE_SERVICE_TYPE
service_type (void) const;
217 /// Set the service type.
218 void service_type (ACE_SERVICE_TYPE st
);
220 /// Get the maximum SDU size in bytes.
221 unsigned long max_sdu_size (void) const;
223 /// Set the maximum SDU size in bytes.
224 void max_sdu_size (unsigned long mss
);
226 /// Get the minimum policed size in bytes.
227 unsigned long minimum_policed_size (void) const;
229 /// Set the minimum policed size in bytes.
230 void minimum_policed_size (unsigned long mps
);
232 /// Get the time-to-live.
233 int ttl (void) const;
235 /// Set the time-to-live.
238 /// Get the priority.
239 int priority (void) const;
241 /// Set the priority.
242 void priority (int p
);
244 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
245 defined (ACE_HAS_WINSOCK2_GQOS)
248 unsigned long token_rate_
;
249 unsigned long token_bucket_size_
;
250 unsigned long peak_bandwidth_
;
251 unsigned long latency_
;
252 unsigned long delay_variation_
;
253 ACE_SERVICE_TYPE service_type_
;
254 unsigned long max_sdu_size_
;
255 unsigned long minimum_policed_size_
;
258 #endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
259 defined (ACE_HAS_WINSOCK2_GQOS) */
265 * @brief Wrapper class that holds the sender and receiver flow spec
266 * information, which is used by IntServ (RSVP) and DiffServ.
268 class ACE_Export ACE_QoS
269 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
271 #endif /* ACE_HAS_WINSOCK2 */
277 /// Get the flow spec for data sending.
278 ACE_Flow_Spec
*sending_flowspec (void) const;
280 /// Set the flow spec for data sending.
281 void sending_flowspec (ACE_Flow_Spec
*fs
);
283 /// Get the flow spec for data receiving.
284 ACE_Flow_Spec
*receiving_flowspec (void) const;
286 /// Set the flow spec for data receiving.
287 void receiving_flowspec (ACE_Flow_Spec
*fs
);
289 /// Get the provider specific information.
290 iovec
provider_specific (void) const;
292 /// Set the provider specific information.
293 void provider_specific (const iovec
&ps
);
295 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
299 ACE_Flow_Spec
*sending_flowspec_
;
300 ACE_Flow_Spec
*receiving_flowspec_
;
306 * @class ACE_QoS_Params
308 * @brief Wrapper class that simplifies the information passed to the QoS
309 * enabled <ACE_OS::connect> and <ACE_OS::join_leaf> methods.
311 class ACE_Export ACE_QoS_Params
315 * Initialize the data members. The <caller_data> is a pointer to
316 * the user data that is to be transferred to the peer during
317 * connection establishment. The <callee_data> is a pointer to the
318 * user data that is to be transferred back from the peer during
319 * connection establishment. The_<socket_qos> is a pointer to the
320 * flow specifications for the socket, one for each direction. The
321 * <group_socket_qos> is a pointer to the flow speicfications for
322 * the socket group, if applicable. The_@a flags indicate if we're a
323 * sender, receiver, or both.
325 ACE_QoS_Params (iovec
*caller_data
= 0,
326 iovec
*callee_data
= 0,
327 ACE_QoS
*socket_qos
= 0,
328 ACE_QoS
*group_socket_qos
= 0,
329 unsigned long flags
= 0);
332 iovec
*caller_data (void) const;
335 void caller_data (iovec
*);
338 iovec
*callee_data (void) const;
341 void callee_data (iovec
*);
344 ACE_QoS
*socket_qos (void) const;
347 void socket_qos (ACE_QoS
*);
349 /// Get group socket qos.
350 ACE_QoS
*group_socket_qos (void) const;
352 /// Set group socket qos.
353 void group_socket_qos (ACE_QoS
*);
356 unsigned long flags (void) const;
359 void flags (unsigned long);
362 /// A pointer to the user data that is to be transferred to the peer
363 /// during connection establishment.
366 /// A pointer to the user data that is to be transferred back from
367 /// the peer during connection establishment.
370 /// A pointer to the flow speicfications for the socket, one for each
372 ACE_QoS
*socket_qos_
;
374 /// A pointer to the flow speicfications for the socket group, if
376 ACE_QoS
*group_socket_qos_
;
378 /// Flags that indicate if we're a sender, receiver, or both.
379 unsigned long flags_
;
382 // Callback function that's used by the QoS-enabled <ACE_OS::accept>
384 typedef int (*ACE_QOS_CONDITION_FUNC
) (iovec
*caller_id
,
387 ACE_QoS
*group_socket_qos
,
391 unsigned long callbackdata
);
395 * @class ACE_Accept_QoS_Params
397 * @brief Wrapper class that simplifies the information passed to the QoS
398 * enabled <ACE_OS::accept> method.
400 class ACE_Export ACE_Accept_QoS_Params
404 * Initialize the data members. The <qos_condition_callback> is the
405 * address of an optional, application-supplied condition function
406 * that will make an accept/reject decision based on the caller
407 * information pass in as parameters, and optionally create or join
408 * a socket group by assinging an appropriate value to the result
409 * parameter <g> of this function. The <callback_data> data is
410 * passed back to the application as a condition function parameter,
411 * i.e., it is an Asynchronous Completion Token (ACT).
413 ACE_Accept_QoS_Params (ACE_QOS_CONDITION_FUNC qos_condition_callback
= 0,
414 unsigned long callback_data
= 0);
416 /// Get QoS condition callback.
417 ACE_QOS_CONDITION_FUNC
qos_condition_callback (void) const;
419 /// Set QoS condition callback.
420 void qos_condition_callback (ACE_QOS_CONDITION_FUNC qcc
);
422 /// Get callback data.
423 unsigned long callback_data (void) const;
425 /// Set callback data.
426 void callback_data (unsigned long cd
);
430 * This is the address of an optional, application-supplied
431 * condition function that will make an accept/reject decision based
432 * on the caller information pass in as parameters, and optionally
433 * create or join a socket group by assinging an appropriate value
434 * to the result parameter <g> of this function.
436 ACE_QOS_CONDITION_FUNC qos_condition_callback_
;
439 * This data is passed back to the application as a condition
440 * function parameter, i.e., it is an Asynchronous Completion Token
443 unsigned long callback_data_
;
446 ACE_END_VERSIONED_NAMESPACE_DECL
448 #include /**/ "ace/post.h"
449 #endif /* ACE_OS_QOS_H */