OS_QoS.cpp

Go to the documentation of this file.
00001 //=============================================================================
00002 ///**
00003 // *  @file   OS_QoS.cpp
00004 // *
00005 // *  OS_QoS.cpp,v 4.4 2005/10/28 16:14:54 ossama Exp
00006 // *
00007 // *  @brief  Contains OS specific data structures for QoS networking.
00008 // *
00009 // *  @author Craig Rodrigues  <crodrigu@bbn.com>
00010 // */
00011 //=============================================================================
00012 
00013 #include "ace/OS_QoS.h"
00014 #include "ace/OS_NS_errno.h"
00015 
00016 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00017 
00018 ACE_Flow_Spec::ACE_Flow_Spec (unsigned long token_rate,
00019                               unsigned long token_bucket_size,
00020                               unsigned long peak_bandwidth,
00021                               unsigned long latency,
00022                               unsigned long delay_variation,
00023                               ACE_SERVICE_TYPE service_type,
00024                               unsigned long max_sdu_size,
00025                               unsigned long minimum_policed_size,
00026                               int ttl,
00027                               int priority)
00028 {
00029 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00030   this->TokenRate = token_rate;
00031   this->TokenBucketSize = token_bucket_size;
00032   this->PeakBandwidth = peak_bandwidth;
00033   this->Latency = latency;
00034   this->DelayVariation = delay_variation;
00035 #if defined(ACE_HAS_WINSOCK2_GQOS)
00036   this->ServiceType = service_type;
00037   this->MaxSduSize = max_sdu_size;
00038   this->MinimumPolicedSize = minimum_policed_size;
00039 #else
00040   ACE_UNUSED_ARG (service_type);
00041   ACE_UNUSED_ARG (max_sdu_size);
00042   ACE_UNUSED_ARG (minimum_policed_size);
00043 #endif /* ACE_HAS_WINSOCK2_GQOS */
00044   ACE_UNUSED_ARG (ttl);
00045   ACE_UNUSED_ARG (priority);
00046 #else
00047 
00048   this->token_rate_ = token_rate;
00049   this->token_bucket_size_ = token_bucket_size;
00050   this->peak_bandwidth_ = peak_bandwidth;
00051   this->latency_ = latency;
00052   this->delay_variation_ = delay_variation;
00053   this->service_type_ = service_type;
00054   this->max_sdu_size_ = max_sdu_size;
00055   this->minimum_policed_size_ = minimum_policed_size;
00056   this->ttl_ = ttl;
00057   this->priority_ = priority;
00058 
00059 #endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
00060 }
00061 
00062 ACE_Flow_Spec::ACE_Flow_Spec (void)
00063 {
00064 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00065     defined (ACE_HAS_WINSOCK2_GQOS)
00066   this->TokenRate = 0;
00067   this->TokenBucketSize = 0;
00068   this->PeakBandwidth = 0;
00069   this->Latency = 0;
00070   this->DelayVariation = 0;
00071 #if defined(ACE_HAS_WINSOCK2_GQOS)
00072   this->ServiceType = 0;
00073   this->MaxSduSize = 0;
00074   this->MinimumPolicedSize = 0;
00075 #endif /* ACE_HAS_WINSOCK2_GQOS */
00076 #else
00077 
00078   this->token_rate_ = 0;
00079   this->token_bucket_size_ = 0;
00080   this->peak_bandwidth_ = 0;
00081   this->latency_ = 0;
00082   this->delay_variation_ = 0;
00083   this->service_type_ = 0;
00084   this->max_sdu_size_ = 0;
00085   this->minimum_policed_size_ = 0;
00086   this->ttl_ = 0;
00087   this->priority_ = 0;
00088 
00089 #endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) */
00090 }
00091 
00092 unsigned long
00093 ACE_Flow_Spec::token_rate (void) const
00094 {
00095 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00096   return this->TokenRate;
00097 #else
00098   return this->token_rate_;
00099 #endif /* ACE_HAS_WINSOCK2 */
00100 }
00101 
00102 void
00103 ACE_Flow_Spec::token_rate (unsigned long tr)
00104 {
00105 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00106   this->TokenRate = tr;
00107 #else
00108   this->token_rate_ = tr;
00109 #endif /* ACE_HAS_WINSOCK2 */
00110 }
00111 
00112 unsigned long
00113 ACE_Flow_Spec::token_bucket_size (void) const
00114 {
00115 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00116   return this->TokenBucketSize;
00117 #else
00118   return this->token_bucket_size_;
00119 #endif /* ACE_HAS_WINSOCK2 */
00120 }
00121 
00122 void
00123 ACE_Flow_Spec::token_bucket_size (unsigned long tbs)
00124 {
00125 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00126   this->TokenBucketSize = tbs;
00127 #else
00128   this->token_bucket_size_ = tbs;
00129 #endif /* ACE_HAS_WINSOCK2 */
00130 }
00131 
00132 unsigned long
00133 ACE_Flow_Spec::peak_bandwidth (void) const
00134 {
00135 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00136   return this->PeakBandwidth;
00137 #else
00138   return this->peak_bandwidth_;
00139 #endif /* ACE_HAS_WINSOCK2 */
00140 }
00141 
00142 void
00143 ACE_Flow_Spec::peak_bandwidth (unsigned long pb)
00144 {
00145 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00146   this->PeakBandwidth = pb;
00147 #else
00148   this->peak_bandwidth_ = pb;
00149 #endif /* ACE_HAS_WINSOCK2 */
00150 }
00151 
00152 unsigned long
00153 ACE_Flow_Spec::latency (void) const
00154 {
00155 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00156   return this->Latency;
00157 #else
00158   return this->latency_;
00159 #endif /* ACE_HAS_WINSOCK2 */
00160 }
00161 
00162 void
00163 ACE_Flow_Spec::latency (unsigned long l)
00164 {
00165 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00166   this->Latency = l;
00167 #else
00168   this->latency_ = l;
00169 #endif /* ACE_HAS_WINSOCK2 */
00170 }
00171 
00172 unsigned long
00173 ACE_Flow_Spec::delay_variation (void) const
00174 {
00175 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00176   return this->DelayVariation;
00177 #else
00178   return this->delay_variation_;
00179 #endif /* ACE_HAS_WINSOCK2 */
00180 }
00181 void
00182 ACE_Flow_Spec::delay_variation (unsigned long dv)
00183 {
00184 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00185   this->DelayVariation = dv;
00186 #else
00187   this->delay_variation_ = dv;
00188 #endif /* ACE_HAS_WINSOCK2 */
00189 }
00190 
00191 ACE_SERVICE_TYPE
00192 ACE_Flow_Spec::service_type (void) const
00193 {
00194 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00195     defined (ACE_HAS_WINSOCK2_GQOS)
00196   return this->ServiceType;
00197 #else
00198   return this->service_type_;
00199 #endif /* ACE_HAS_WINSOCK2 */
00200 }
00201 
00202 void
00203 ACE_Flow_Spec::service_type (ACE_SERVICE_TYPE st)
00204 {
00205 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00206     defined (ACE_HAS_WINSOCK2_GQOS)
00207   this->ServiceType = st;
00208 #else
00209   this->service_type_ = st;
00210 #endif /* ACE_HAS_WINSOCK2 */
00211 }
00212 
00213 unsigned long
00214 ACE_Flow_Spec::max_sdu_size (void) const
00215 {
00216 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00217     defined (ACE_HAS_WINSOCK2_GQOS)
00218   return this->MaxSduSize;
00219 #else
00220   return this->max_sdu_size_;
00221 #endif /* ACE_HAS_WINSOCK2 */
00222 }
00223 
00224 void
00225 ACE_Flow_Spec::max_sdu_size (unsigned long mss)
00226 {
00227 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00228     defined (ACE_HAS_WINSOCK2_GQOS)
00229   this->MaxSduSize = mss;
00230 #else
00231   this->max_sdu_size_ = mss;
00232 #endif /* ACE_HAS_WINSOCK2 */
00233 }
00234 
00235 unsigned long
00236 ACE_Flow_Spec::minimum_policed_size (void) const
00237 {
00238 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00239     defined (ACE_HAS_WINSOCK2_GQOS)
00240   return this->MinimumPolicedSize;
00241 #else
00242   return this->minimum_policed_size_;
00243 #endif /* ACE_HAS_WINSOCK2 */
00244 }
00245 
00246 void
00247 ACE_Flow_Spec::minimum_policed_size (unsigned long mps)
00248 {
00249 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00250     defined (ACE_HAS_WINSOCK2_GQOS)
00251   this->MinimumPolicedSize = mps;
00252 #else
00253   this->minimum_policed_size_ = mps;
00254 #endif /* ACE_HAS_WINSOCK2 */
00255 }
00256 
00257 int
00258 ACE_Flow_Spec::ttl (void) const
00259 {
00260 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00261     defined (ACE_HAS_WINSOCK2_GQOS)
00262   ACE_NOTSUP_RETURN (-1);
00263 #else
00264   return this->ttl_;
00265 #endif /* ACE_HAS_WINSOCK2 */
00266 }
00267 
00268 void
00269 ACE_Flow_Spec::ttl (int t)
00270 {
00271 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00272     defined (ACE_HAS_WINSOCK2_GQOS)
00273   ACE_UNUSED_ARG (t);
00274   // TBD...
00275 #else
00276   this->ttl_ = t;
00277 #endif /* ACE_HAS_WINSOCK2 */
00278 }
00279 
00280 int
00281 ACE_Flow_Spec::priority (void) const
00282 {
00283 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00284     defined (ACE_HAS_WINSOCK2_GQOS)
00285   ACE_NOTSUP_RETURN (-1);
00286 #else
00287   return this->priority_;
00288 #endif /* ACE_HAS_WINSOCK2 */
00289 }
00290 
00291 void
00292 ACE_Flow_Spec::priority (int p)
00293 {
00294 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00295     defined (ACE_HAS_WINSOCK2_GQOS)
00296   ACE_UNUSED_ARG (p);
00297   // TBD...
00298 #else
00299   this->priority_ = p;
00300 #endif /* ACE_HAS_WINSOCK2 */
00301 }
00302 
00303 ACE_QoS::ACE_QoS (void)
00304 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00305 #else
00306   : sending_flowspec_ (0),
00307     receiving_flowspec_ (0)
00308 #endif /* ACE_HAS_WINSOCK2 */
00309 {
00310 }
00311 
00312 ACE_Flow_Spec*
00313 ACE_QoS::sending_flowspec (void) const
00314 {
00315 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00316   return &((ACE_Flow_Spec &) this->SendingFlowspec);
00317 #else
00318   return this->sending_flowspec_;
00319 #endif /* ACE_HAS_WINSOCK2 */
00320 }
00321 
00322 void
00323 ACE_QoS::sending_flowspec (ACE_Flow_Spec *fs)
00324 {
00325 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00326   this->SendingFlowspec = (FLOWSPEC) (*fs);
00327 #else
00328   this->sending_flowspec_ = fs;
00329 #endif /* ACE_HAS_WINSOCK2 */
00330 }
00331 
00332 ACE_Flow_Spec*
00333 ACE_QoS::receiving_flowspec (void) const
00334 {
00335 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00336   return &((ACE_Flow_Spec &) this->ReceivingFlowspec);
00337 #else
00338   return receiving_flowspec_;
00339 #endif /* ACE_HAS_WINSOCK2 */
00340 }
00341 
00342 void
00343 ACE_QoS::receiving_flowspec (ACE_Flow_Spec *fs)
00344 {
00345 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00346   this->ReceivingFlowspec = (FLOWSPEC) (*fs);
00347 #else
00348   this->receiving_flowspec_ = fs;
00349 #endif /* ACE_HAS_WINSOCK2 */
00350 }
00351 
00352 iovec
00353 ACE_QoS::provider_specific (void) const
00354 {
00355 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00356   return (iovec&) this->ProviderSpecific;
00357 #else
00358   ACE_NOTSUP_RETURN (iovec ());
00359 #endif /* ACE_HAS_WINSOCK2 */
00360 }
00361 
00362 void
00363 ACE_QoS::provider_specific (const iovec &ps)
00364 {
00365 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00366   this->ProviderSpecific = (WSABUF) ((iovec &) ps);
00367 #else
00368   ACE_UNUSED_ARG (ps);
00369 #endif /* ACE_HAS_WINSOCK2 */
00370 }
00371 
00372 ACE_QoS_Params::ACE_QoS_Params (iovec *caller_data,
00373                                 iovec *callee_data,
00374                                 ACE_QoS *socket_qos,
00375                                 ACE_QoS *group_socket_qos,
00376                                 unsigned long flags)
00377   : caller_data_ (caller_data),
00378     callee_data_ (callee_data),
00379     socket_qos_ (socket_qos),
00380     group_socket_qos_ (group_socket_qos),
00381     flags_ (flags)
00382 {
00383 }
00384 
00385 iovec *
00386 ACE_QoS_Params::caller_data (void) const
00387 {
00388   return this->caller_data_;
00389 }
00390 
00391 void
00392 ACE_QoS_Params::caller_data (iovec *cd)
00393 {
00394   this->caller_data_ = cd;
00395 }
00396 
00397 iovec *
00398 ACE_QoS_Params::callee_data (void) const
00399 {
00400   return this->callee_data_;
00401 }
00402 
00403 void
00404 ACE_QoS_Params::callee_data (iovec *cd)
00405 {
00406   this->callee_data_ = cd;
00407 }
00408 
00409 ACE_QoS *
00410 ACE_QoS_Params::socket_qos (void) const
00411 {
00412   return this->socket_qos_;
00413 }
00414 
00415 void
00416 ACE_QoS_Params::socket_qos (ACE_QoS *sq)
00417 {
00418   this->socket_qos_ = sq;
00419 }
00420 
00421 ACE_QoS *
00422 ACE_QoS_Params::group_socket_qos (void) const
00423 {
00424   return this->group_socket_qos_;
00425 }
00426 
00427 void
00428 ACE_QoS_Params::group_socket_qos (ACE_QoS *gsq)
00429 {
00430   this->group_socket_qos_ = gsq;
00431 }
00432 
00433 unsigned long
00434 ACE_QoS_Params::flags (void) const
00435 {
00436   return this->flags_;
00437 }
00438 
00439 void
00440 ACE_QoS_Params::flags (unsigned long f)
00441 {
00442   this->flags_ = f;
00443 }
00444 
00445 ACE_Accept_QoS_Params::ACE_Accept_QoS_Params (ACE_QOS_CONDITION_FUNC qos_condition_callback,
00446                                               unsigned long callback_data)
00447   : qos_condition_callback_ (qos_condition_callback),
00448     callback_data_ (callback_data)
00449 {
00450 }
00451 
00452 ACE_QOS_CONDITION_FUNC
00453 ACE_Accept_QoS_Params::qos_condition_callback (void) const
00454 {
00455   return this->qos_condition_callback_;
00456 }
00457 
00458 void
00459 ACE_Accept_QoS_Params::qos_condition_callback (ACE_QOS_CONDITION_FUNC qcc)
00460 {
00461   this->qos_condition_callback_ = qcc;
00462 }
00463 
00464 unsigned long
00465 ACE_Accept_QoS_Params::callback_data (void) const
00466 {
00467   return this->callback_data_;
00468 }
00469 
00470 void
00471 ACE_Accept_QoS_Params::callback_data (unsigned long cd)
00472 {
00473   this->callback_data_ = cd;
00474 }
00475 
00476 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:41:58 2006 for ACE by doxygen 1.3.6