Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

OS_QoS.cpp

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

Generated on Mon Jun 16 11:20:45 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002