[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / OS_QoS.h
blob74d46afce0e249f4029a65a307b5d7bb8df849f9
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file OS_QoS.h
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 //=============================================================================
15 #ifndef ACE_OS_QOS_H
16 #define ACE_OS_QOS_H
17 #include /**/ "ace/pre.h"
19 #include /**/ "ace/ACE_export.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # 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;
32 #else
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
38 #else
39 # define ACE_OVERLAPPED_SOCKET_FLAG 0
40 #endif
42 #if defined (XP1_QOS_SUPPORTED)
43 # define ACE_XP1_QOS_SUPPORTED XP1_QOS_SUPPORTED
44 #else
45 # define ACE_XP1_QOS_SUPPORTED 0x00002000
46 #endif
48 #if defined (XP1_SUPPORT_MULTIPOINT)
49 # define ACE_XP1_SUPPORT_MULTIPOINT XP1_SUPPORT_MULTIPOINT
50 #else
51 # define ACE_XP1_SUPPORT_MULTIPOINT 0x00000400
52 #endif
54 #if defined (WSABASEERR)
55 # define ACE_BASEERR WSABASEERR
56 #else
57 # define ACE_BASEERR 10000
58 #endif
60 #if defined (WSAENOBUFS)
61 # define ACE_ENOBUFS WSAENOBUFS
62 #else
63 # define ACE_ENOBUFS (ACE_BASEERR+55)
64 #endif
66 #if defined (FROM_PROTOCOL_INFO)
67 # define ACE_FROM_PROTOCOL_INFO FROM_PROTOCOL_INFO
68 #else
69 # define ACE_FROM_PROTOCOL_INFO (-1)
70 #endif
72 #if defined (WSA_FLAG_MULTIPOINT_C_ROOT)
73 # define ACE_FLAG_MULTIPOINT_C_ROOT WSA_FLAG_MULTIPOINT_C_ROOT
74 #else
75 # define ACE_FLAG_MULTIPOINT_C_ROOT 0x02
76 #endif
78 #if defined (WSA_FLAG_MULTIPOINT_C_LEAF)
79 # define ACE_FLAG_MULTIPOINT_C_LEAF WSA_FLAG_MULTIPOINT_C_LEAF
80 #else
81 # define ACE_FLAG_MULTIPOINT_C_LEAF 0x04
82 #endif
84 #if defined (WSA_FLAG_MULTIPOINT_D_ROOT)
85 # define ACE_FLAG_MULTIPOINT_D_ROOT WSA_FLAG_MULTIPOINT_D_ROOT
86 #else
87 # define ACE_FLAG_MULTIPOINT_D_ROOT 0x08
88 #endif
90 #if defined (WSA_FLAG_MULTIPOINT_D_LEAF)
91 # define ACE_FLAG_MULTIPOINT_D_LEAF WSA_FLAG_MULTIPOINT_D_LEAF
92 #else
93 # define ACE_FLAG_MULTIPOINT_D_LEAF 0x10
94 #endif
96 #if defined (QOS_NOT_SPECIFIED)
97 # define ACE_QOS_NOT_SPECIFIED QOS_NOT_SPECIFIED
98 #else
99 # define ACE_QOS_NOT_SPECIFIED 0xFFFFFFFF
100 #endif
102 #if defined (SERVICETYPE_NOTRAFFIC)
103 # define ACE_SERVICETYPE_NOTRAFFIC SERVICETYPE_NOTRAFFIC
104 #else
105 # define ACE_SERVICETYPE_NOTRAFFIC 0x00000000 /* No data in this */
106 /* direction. */
107 #endif
109 #if defined (SERVICETYPE_CONTROLLEDLOAD)
110 # define ACE_SERVICETYPE_CONTROLLEDLOAD SERVICETYPE_CONTROLLEDLOAD
111 #else
112 # define ACE_SERVICETYPE_CONTROLLEDLOAD 0x00000001 /* Controlled Load. */
113 #endif
115 #if defined (SERVICETYPE_GUARANTEED)
116 # define ACE_SERVICETYPE_GUARANTEED SERVICETYPE_GUARANTEED
117 #else
118 # define ACE_SERVICETYPE_GUARANTEED 0x00000003 /* Guaranteed. */
119 #endif
121 #if defined (JL_SENDER_ONLY)
122 # define ACE_JL_SENDER_ONLY JL_SENDER_ONLY
123 #else
124 # define ACE_JL_SENDER_ONLY 0x01
125 #endif
127 #if defined (JL_BOTH)
128 # define ACE_JL_BOTH JL_BOTH
129 #else
130 # define ACE_JL_BOTH 0x04
131 #endif
133 #if defined (SIO_GET_QOS)
134 # define ACE_SIO_GET_QOS SIO_GET_QOS
135 #else
136 # define ACE_SIO_GET_QOS (0x40000000 | 0x08000000 | 7)
137 #endif
139 #if defined (SIO_MULTIPOINT_LOOPBACK)
140 # define ACE_SIO_MULTIPOINT_LOOPBACK SIO_MULTIPOINT_LOOPBACK
141 #else
142 # define ACE_SIO_MULTIPOINT_LOOPBACK (0x08000000 | 9)
143 #endif
145 #if defined (SIO_MULTICAST_SCOPE)
146 # define ACE_SIO_MULTICAST_SCOPE SIO_MULTICAST_SCOPE
147 #else
148 # define ACE_SIO_MULTICAST_SCOPE (0x08000000 | 10)
149 #endif
151 #if defined (SIO_SET_QOS)
152 # define ACE_SIO_SET_QOS SIO_SET_QOS
153 #else
154 # define ACE_SIO_SET_QOS (0x08000000 | 11)
155 #endif
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)
165 : public FLOWSPEC
166 #endif /* ACE_HAS_WINSOCK2 */
168 public:
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,
181 int ttl,
182 int priority);
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.
236 void ttl (int t);
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)
246 #else
247 private:
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_;
256 int ttl_;
257 int priority_;
258 #endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
259 defined (ACE_HAS_WINSOCK2_GQOS) */
263 * @class ACE_QoS
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)
270 : public QOS
271 #endif /* ACE_HAS_WINSOCK2 */
273 public:
274 /// Constructor
275 ACE_QoS (void);
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)
296 #else
297 private:
299 ACE_Flow_Spec *sending_flowspec_;
300 ACE_Flow_Spec *receiving_flowspec_;
301 #endif
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
313 public:
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);
331 /// Get caller data.
332 iovec *caller_data (void) const;
334 /// Set caller data.
335 void caller_data (iovec *);
337 /// Get callee data.
338 iovec *callee_data (void) const;
340 /// Set callee data.
341 void callee_data (iovec *);
343 /// Get socket qos.
344 ACE_QoS *socket_qos (void) const;
346 /// Set socket qos.
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 *);
355 /// Get flags.
356 unsigned long flags (void) const;
358 /// Set flags.
359 void flags (unsigned long);
361 private:
362 /// A pointer to the user data that is to be transferred to the peer
363 /// during connection establishment.
364 iovec *caller_data_;
366 /// A pointer to the user data that is to be transferred back from
367 /// the peer during connection establishment.
368 iovec *callee_data_;
370 /// A pointer to the flow speicfications for the socket, one for each
371 /// direction.
372 ACE_QoS *socket_qos_;
374 /// A pointer to the flow speicfications for the socket group, if
375 /// applicable.
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>
383 // method.
384 typedef int (*ACE_QOS_CONDITION_FUNC) (iovec *caller_id,
385 iovec *caller_data,
386 ACE_QoS *socket_qos,
387 ACE_QoS *group_socket_qos,
388 iovec *callee_id,
389 iovec *callee_data,
390 ACE_SOCK_GROUP *g,
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
402 public:
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);
428 private:
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
441 * (ACT).
443 unsigned long callback_data_;
446 ACE_END_VERSIONED_NAMESPACE_DECL
448 #include /**/ "ace/post.h"
449 #endif /* ACE_OS_QOS_H */