1 //=============================================================================
7 // * @brief Contains OS specific data structures for QoS networking.
9 // * @author Craig Rodrigues <crodrigu@bbn.com>
11 //=============================================================================
13 #include "ace/OS_QoS.h"
14 #include "ace/OS_NS_errno.h"
16 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
18 ACE_Flow_Spec::ACE_Flow_Spec (unsigned long token_rate
,
19 unsigned long token_bucket_size
,
20 unsigned long peak_bandwidth
,
21 unsigned long latency
,
22 unsigned long delay_variation
,
23 ACE_SERVICE_TYPE service_type
,
24 unsigned long max_sdu_size
,
25 unsigned long minimum_policed_size
,
29 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
30 this->TokenRate
= token_rate
;
31 this->TokenBucketSize
= token_bucket_size
;
32 this->PeakBandwidth
= peak_bandwidth
;
33 this->Latency
= latency
;
34 this->DelayVariation
= delay_variation
;
35 #if defined(ACE_HAS_WINSOCK2_GQOS)
36 this->ServiceType
= service_type
;
37 this->MaxSduSize
= max_sdu_size
;
38 this->MinimumPolicedSize
= minimum_policed_size
;
40 ACE_UNUSED_ARG (service_type
);
41 ACE_UNUSED_ARG (max_sdu_size
);
42 ACE_UNUSED_ARG (minimum_policed_size
);
43 #endif /* ACE_HAS_WINSOCK2_GQOS */
45 ACE_UNUSED_ARG (priority
);
48 this->token_rate_
= token_rate
;
49 this->token_bucket_size_
= token_bucket_size
;
50 this->peak_bandwidth_
= peak_bandwidth
;
51 this->latency_
= latency
;
52 this->delay_variation_
= delay_variation
;
53 this->service_type_
= service_type
;
54 this->max_sdu_size_
= max_sdu_size
;
55 this->minimum_policed_size_
= minimum_policed_size
;
57 this->priority_
= priority
;
59 #endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
62 ACE_Flow_Spec::ACE_Flow_Spec (void)
64 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
65 defined (ACE_HAS_WINSOCK2_GQOS)
67 this->TokenBucketSize
= 0;
68 this->PeakBandwidth
= 0;
70 this->DelayVariation
= 0;
71 #if defined(ACE_HAS_WINSOCK2_GQOS)
72 this->ServiceType
= 0;
74 this->MinimumPolicedSize
= 0;
75 #endif /* ACE_HAS_WINSOCK2_GQOS */
78 this->token_rate_
= 0;
79 this->token_bucket_size_
= 0;
80 this->peak_bandwidth_
= 0;
82 this->delay_variation_
= 0;
83 this->service_type_
= 0;
84 this->max_sdu_size_
= 0;
85 this->minimum_policed_size_
= 0;
89 #endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
93 ACE_Flow_Spec::token_rate (void) const
95 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
96 return this->TokenRate
;
98 return this->token_rate_
;
99 #endif /* ACE_HAS_WINSOCK2 */
103 ACE_Flow_Spec::token_rate (unsigned long tr
)
105 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
106 this->TokenRate
= tr
;
108 this->token_rate_
= tr
;
109 #endif /* ACE_HAS_WINSOCK2 */
113 ACE_Flow_Spec::token_bucket_size (void) const
115 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
116 return this->TokenBucketSize
;
118 return this->token_bucket_size_
;
119 #endif /* ACE_HAS_WINSOCK2 */
123 ACE_Flow_Spec::token_bucket_size (unsigned long tbs
)
125 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
126 this->TokenBucketSize
= tbs
;
128 this->token_bucket_size_
= tbs
;
129 #endif /* ACE_HAS_WINSOCK2 */
133 ACE_Flow_Spec::peak_bandwidth (void) const
135 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
136 return this->PeakBandwidth
;
138 return this->peak_bandwidth_
;
139 #endif /* ACE_HAS_WINSOCK2 */
143 ACE_Flow_Spec::peak_bandwidth (unsigned long pb
)
145 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
146 this->PeakBandwidth
= pb
;
148 this->peak_bandwidth_
= pb
;
149 #endif /* ACE_HAS_WINSOCK2 */
153 ACE_Flow_Spec::latency (void) const
155 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
156 return this->Latency
;
158 return this->latency_
;
159 #endif /* ACE_HAS_WINSOCK2 */
163 ACE_Flow_Spec::latency (unsigned long l
)
165 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
169 #endif /* ACE_HAS_WINSOCK2 */
173 ACE_Flow_Spec::delay_variation (void) const
175 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
176 return this->DelayVariation
;
178 return this->delay_variation_
;
179 #endif /* ACE_HAS_WINSOCK2 */
182 ACE_Flow_Spec::delay_variation (unsigned long dv
)
184 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
185 this->DelayVariation
= dv
;
187 this->delay_variation_
= dv
;
188 #endif /* ACE_HAS_WINSOCK2 */
192 ACE_Flow_Spec::service_type (void) const
194 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
195 defined (ACE_HAS_WINSOCK2_GQOS)
196 return this->ServiceType
;
198 return this->service_type_
;
199 #endif /* ACE_HAS_WINSOCK2 */
203 ACE_Flow_Spec::service_type (ACE_SERVICE_TYPE st
)
205 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
206 defined (ACE_HAS_WINSOCK2_GQOS)
207 this->ServiceType
= st
;
209 this->service_type_
= st
;
210 #endif /* ACE_HAS_WINSOCK2 */
214 ACE_Flow_Spec::max_sdu_size (void) const
216 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
217 defined (ACE_HAS_WINSOCK2_GQOS)
218 return this->MaxSduSize
;
220 return this->max_sdu_size_
;
221 #endif /* ACE_HAS_WINSOCK2 */
225 ACE_Flow_Spec::max_sdu_size (unsigned long mss
)
227 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
228 defined (ACE_HAS_WINSOCK2_GQOS)
229 this->MaxSduSize
= mss
;
231 this->max_sdu_size_
= mss
;
232 #endif /* ACE_HAS_WINSOCK2 */
236 ACE_Flow_Spec::minimum_policed_size (void) const
238 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
239 defined (ACE_HAS_WINSOCK2_GQOS)
240 return this->MinimumPolicedSize
;
242 return this->minimum_policed_size_
;
243 #endif /* ACE_HAS_WINSOCK2 */
247 ACE_Flow_Spec::minimum_policed_size (unsigned long mps
)
249 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
250 defined (ACE_HAS_WINSOCK2_GQOS)
251 this->MinimumPolicedSize
= mps
;
253 this->minimum_policed_size_
= mps
;
254 #endif /* ACE_HAS_WINSOCK2 */
258 ACE_Flow_Spec::ttl (void) const
260 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
261 defined (ACE_HAS_WINSOCK2_GQOS)
262 ACE_NOTSUP_RETURN (-1);
265 #endif /* ACE_HAS_WINSOCK2 */
269 ACE_Flow_Spec::ttl (int t
)
271 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
272 defined (ACE_HAS_WINSOCK2_GQOS)
277 #endif /* ACE_HAS_WINSOCK2 */
281 ACE_Flow_Spec::priority (void) const
283 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
284 defined (ACE_HAS_WINSOCK2_GQOS)
285 ACE_NOTSUP_RETURN (-1);
287 return this->priority_
;
288 #endif /* ACE_HAS_WINSOCK2 */
292 ACE_Flow_Spec::priority (int p
)
294 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
295 defined (ACE_HAS_WINSOCK2_GQOS)
300 #endif /* ACE_HAS_WINSOCK2 */
303 ACE_QoS::ACE_QoS (void)
304 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
306 : sending_flowspec_ (0),
307 receiving_flowspec_ (0)
308 #endif /* ACE_HAS_WINSOCK2 */
313 ACE_QoS::sending_flowspec (void) const
315 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
316 return &((ACE_Flow_Spec
&) this->SendingFlowspec
);
318 return this->sending_flowspec_
;
319 #endif /* ACE_HAS_WINSOCK2 */
323 ACE_QoS::sending_flowspec (ACE_Flow_Spec
*fs
)
325 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
326 this->SendingFlowspec
= (FLOWSPEC
) (*fs
);
328 this->sending_flowspec_
= fs
;
329 #endif /* ACE_HAS_WINSOCK2 */
333 ACE_QoS::receiving_flowspec (void) const
335 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
336 return &((ACE_Flow_Spec
&) this->ReceivingFlowspec
);
338 return receiving_flowspec_
;
339 #endif /* ACE_HAS_WINSOCK2 */
343 ACE_QoS::receiving_flowspec (ACE_Flow_Spec
*fs
)
345 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
346 this->ReceivingFlowspec
= (FLOWSPEC
) (*fs
);
348 this->receiving_flowspec_
= fs
;
349 #endif /* ACE_HAS_WINSOCK2 */
353 ACE_QoS::provider_specific (void) const
355 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
356 return (iovec
&) this->ProviderSpecific
;
358 ACE_NOTSUP_RETURN (iovec ());
359 #endif /* ACE_HAS_WINSOCK2 */
363 ACE_QoS::provider_specific (const iovec
&ps
)
365 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
366 this->ProviderSpecific
= (WSABUF
) (const_cast <iovec
&> (ps
));
369 #endif /* ACE_HAS_WINSOCK2 */
372 ACE_QoS_Params::ACE_QoS_Params (iovec
*caller_data
,
375 ACE_QoS
*group_socket_qos
,
377 : caller_data_ (caller_data
),
378 callee_data_ (callee_data
),
379 socket_qos_ (socket_qos
),
380 group_socket_qos_ (group_socket_qos
),
386 ACE_QoS_Params::caller_data (void) const
388 return this->caller_data_
;
392 ACE_QoS_Params::caller_data (iovec
*cd
)
394 this->caller_data_
= cd
;
398 ACE_QoS_Params::callee_data (void) const
400 return this->callee_data_
;
404 ACE_QoS_Params::callee_data (iovec
*cd
)
406 this->callee_data_
= cd
;
410 ACE_QoS_Params::socket_qos (void) const
412 return this->socket_qos_
;
416 ACE_QoS_Params::socket_qos (ACE_QoS
*sq
)
418 this->socket_qos_
= sq
;
422 ACE_QoS_Params::group_socket_qos (void) const
424 return this->group_socket_qos_
;
428 ACE_QoS_Params::group_socket_qos (ACE_QoS
*gsq
)
430 this->group_socket_qos_
= gsq
;
434 ACE_QoS_Params::flags (void) const
440 ACE_QoS_Params::flags (unsigned long f
)
445 ACE_Accept_QoS_Params::ACE_Accept_QoS_Params (ACE_QOS_CONDITION_FUNC qos_condition_callback
,
446 unsigned long callback_data
)
447 : qos_condition_callback_ (qos_condition_callback
),
448 callback_data_ (callback_data
)
452 ACE_QOS_CONDITION_FUNC
453 ACE_Accept_QoS_Params::qos_condition_callback (void) const
455 return this->qos_condition_callback_
;
459 ACE_Accept_QoS_Params::qos_condition_callback (ACE_QOS_CONDITION_FUNC qcc
)
461 this->qos_condition_callback_
= qcc
;
465 ACE_Accept_QoS_Params::callback_data (void) const
467 return this->callback_data_
;
471 ACE_Accept_QoS_Params::callback_data (unsigned long cd
)
473 this->callback_data_
= cd
;
476 ACE_END_VERSIONED_NAMESPACE_DECL