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

OS_QoS.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   OS_QoS.h
00006  *
00007  *  $Id: OS_QoS.h,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
00008  *  
00009  *  @brief  Contains OS specific data structures for QoS networking.
00010  *  
00011  *  @author Craig Rodrigues  <crodrigu@bbn.com>
00012  */
00013 //=============================================================================
00014 
00015 #ifndef ACE_OS_QOS_H
00016 #define ACE_OS_QOS_H
00017 #include "ace/pre.h"
00018 
00019 #include "ace/OS.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00026 #if defined (ACE_HAS_WINSOCK2_GQOS)
00027 typedef SERVICETYPE ACE_SERVICE_TYPE;
00028 #else
00029 typedef u_long ACE_SERVICE_TYPE;
00030 #endif /* ACE_HAS_WINSOCK2_GQOS */
00031 
00032 
00033 #define ACE_OVERLAPPED_SOCKET_FLAG WSA_FLAG_OVERLAPPED
00034 
00035 #define ACE_XP1_QOS_SUPPORTED XP1_QOS_SUPPORTED
00036 #define ACE_XP1_SUPPORT_MULTIPOINT XP1_SUPPORT_MULTIPOINT
00037 
00038 #define ACE_BASEERR WSABASEERR
00039 #define ACE_ENOBUFS WSAENOBUFS
00040 #define ACE_FROM_PROTOCOL_INFO FROM_PROTOCOL_INFO
00041 #define ACE_FLAG_MULTIPOINT_C_ROOT WSA_FLAG_MULTIPOINT_C_ROOT
00042 #define ACE_FLAG_MULTIPOINT_C_LEAF WSA_FLAG_MULTIPOINT_C_LEAF
00043 #define ACE_FLAG_MULTIPOINT_D_ROOT WSA_FLAG_MULTIPOINT_D_ROOT
00044 #define ACE_FLAG_MULTIPOINT_D_LEAF WSA_FLAG_MULTIPOINT_D_LEAF
00045 
00046 #define ACE_QOS_NOT_SPECIFIED QOS_NOT_SPECIFIED
00047 #define ACE_SERVICETYPE_NOTRAFFIC SERVICETYPE_NOTRAFFIC
00048 #define ACE_SERVICETYPE_CONTROLLEDLOAD SERVICETYPE_CONTROLLEDLOAD
00049 #define ACE_SERVICETYPE_GUARANTEED SERVICETYPE_GUARANTEED
00050 
00051 #define ACE_JL_SENDER_ONLY JL_SENDER_ONLY
00052 #define ACE_JL_BOTH JL_BOTH
00053 
00054 #define ACE_SIO_GET_QOS SIO_GET_QOS
00055 #define ACE_SIO_MULTIPOINT_LOOPBACK SIO_MULTIPOINT_LOOPBACK
00056 #define ACE_SIO_MULTICAST_SCOPE SIO_MULTICAST_SCOPE
00057 #define ACE_SIO_SET_QOS SIO_SET_QOS
00058 
00059 #else
00060 typedef u_long ACE_SERVICE_TYPE;
00061 
00062 #define ACE_OVERLAPPED_SOCKET_FLAG 0
00063 #define ACE_XP1_QOS_SUPPORTED        0x00002000
00064 #define ACE_XP1_SUPPORT_MULTIPOINT   0x00000400
00065 
00066 #define ACE_BASEERR   10000
00067 #define ACE_ENOBUFS   (ACE_BASEERR+55)
00068 
00069 #define ACE_FROM_PROTOCOL_INFO (-1)
00070 
00071 #define ACE_FLAG_MULTIPOINT_C_ROOT    0x02
00072 #define ACE_FLAG_MULTIPOINT_C_LEAF    0x04
00073 #define ACE_FLAG_MULTIPOINT_D_ROOT    0x08
00074 #define ACE_FLAG_MULTIPOINT_D_LEAF    0x10
00075 
00076 #define ACE_QOS_NOT_SPECIFIED            0xFFFFFFFF
00077 #define ACE_SERVICETYPE_NOTRAFFIC        0x00000000  /* No data in this */
00078                                                      /* direction. */
00079 #define ACE_SERVICETYPE_CONTROLLEDLOAD   0x00000001  /* Controlled Load. */
00080 #define ACE_SERVICETYPE_GUARANTEED       0x00000003  /* Guaranteed. */
00081 
00082 #define ACE_JL_SENDER_ONLY    0x01
00083 #define ACE_JL_BOTH           0x04
00084 
00085 #define ACE_SIO_GET_QOS              (0x40000000 | 0x08000000 | 7)
00086 #define ACE_SIO_MULTIPOINT_LOOPBACK  (0x08000000 | 9)
00087 #define ACE_SIO_MULTICAST_SCOPE      (0x08000000 | 10)
00088 #define ACE_SIO_SET_QOS              (0x08000000 | 11)
00089 
00090 #endif /* ACE_HAS_WINSOCK2 && ACE_HAS_WINSOCK2 != 0 */
00091 
00092 
00093 
00094 
00095 /**
00096  * @class ACE_Flow_Spec
00097  *
00098  * @brief Wrapper class that defines the flow spec QoS information,
00099  *    which is used by IntServ (RSVP) and DiffServ.
00100  */
00101 class ACE_OS_Export ACE_Flow_Spec
00102 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00103   : public FLOWSPEC
00104 #endif /* ACE_HAS_WINSOCK2 */
00105 {
00106 public:
00107   /// Default constructor.
00108   ACE_Flow_Spec (void);
00109 
00110   /// Constructor that initializes all the fields.
00111   ACE_Flow_Spec (u_long token_rate,
00112                  u_long token_bucket_size,
00113                  u_long peak_bandwidth,
00114                  u_long latency,
00115                  u_long delay_variation,
00116                  ACE_SERVICE_TYPE service_type,
00117                  u_long max_sdu_size,
00118                  u_long minimum_policed_size,
00119                  int ttl,
00120                  int priority);
00121 
00122   /// Get the token rate in bytes/sec.
00123   u_long token_rate (void) const;
00124 
00125   /// Set the token rate in bytes/sec.
00126   void token_rate (u_long tr);
00127 
00128   /// Get the token bucket size in bytes.
00129   u_long token_bucket_size (void) const;
00130 
00131   /// Set the token bucket size in bytes.
00132   void token_bucket_size (u_long tbs);
00133 
00134   /// Get the PeakBandwidth in bytes/sec.
00135   u_long peak_bandwidth (void) const;
00136 
00137   /// Set the PeakBandwidth in bytes/sec.
00138   void peak_bandwidth (u_long pb);
00139 
00140   /// Get the latency in microseconds.
00141   u_long latency (void) const;
00142 
00143   /// Set the latency in microseconds.
00144   void latency (u_long l);
00145 
00146   /// Get the delay variation in microseconds.
00147   u_long delay_variation (void) const;
00148 
00149   /// Set the delay variation in microseconds.
00150   void delay_variation (u_long dv);
00151 
00152   /// Get the service type.
00153   ACE_SERVICE_TYPE service_type (void) const;
00154 
00155   /// Set the service type.
00156   void service_type (ACE_SERVICE_TYPE st);
00157 
00158   /// Get the maximum SDU size in bytes.
00159   u_long max_sdu_size (void) const;
00160 
00161   /// Set the maximum SDU size in bytes.
00162   void max_sdu_size (u_long mss);
00163 
00164   /// Get the minimum policed size in bytes.
00165   u_long minimum_policed_size (void) const;
00166 
00167   /// Set the minimum policed size in bytes.
00168   void minimum_policed_size (u_long mps);
00169 
00170   /// Get the time-to-live.
00171   int ttl (void) const;
00172 
00173   /// Set the time-to-live.
00174   void ttl (int t);
00175 
00176   /// Get the priority.
00177   int priority (void) const;
00178 
00179   /// Set the priority.
00180   void priority (int p);
00181 
00182 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00183     defined (ACE_HAS_WINSOCK2_GQOS)
00184 #else
00185 private:
00186   u_long token_rate_;
00187   u_long token_bucket_size_;
00188   u_long peak_bandwidth_;
00189   u_long latency_;
00190   u_long delay_variation_;
00191   ACE_SERVICE_TYPE service_type_;
00192   u_long max_sdu_size_;
00193   u_long minimum_policed_size_;
00194   int ttl_;
00195   int priority_;
00196 #endif /* defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) && \
00197           defined (ACE_HAS_WINSOCK2_GQOS) */
00198 };
00199 
00200 /**
00201  * @class ACE_QoS
00202  *
00203  * @brief Wrapper class that holds the sender and receiver flow spec
00204  *     information, which is used by IntServ (RSVP) and DiffServ.
00205  */
00206 class ACE_OS_Export ACE_QoS
00207 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00208   : public QOS
00209 #endif /* ACE_HAS_WINSOCK2 */
00210 {
00211 public:
00212   /// Constructor
00213   ACE_QoS (void);
00214 
00215   /// Get the flow spec for data sending.
00216   ACE_Flow_Spec *sending_flowspec (void) const;
00217 
00218   /// Set the flow spec for data sending.
00219   void sending_flowspec (ACE_Flow_Spec *fs);
00220 
00221   /// Get the flow spec for data receiving.
00222   ACE_Flow_Spec *receiving_flowspec (void) const;
00223 
00224   /// Set the flow spec for data receiving.
00225   void receiving_flowspec (ACE_Flow_Spec *fs);
00226 
00227   /// Get the provider specific information.
00228   iovec provider_specific (void) const;
00229 
00230   /// Set the provider specific information.
00231   void provider_specific (const iovec &ps);
00232 
00233 #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0)
00234 #else
00235 private:
00236 
00237   ACE_Flow_Spec *sending_flowspec_;
00238   ACE_Flow_Spec *receiving_flowspec_;
00239 #endif
00240 
00241 };
00242 
00243 /**
00244  * @class ACE_QoS_Params
00245  *
00246  * @brief Wrapper class that simplifies the information passed to the QoS
00247  * enabled <ACE_OS::connect> and <ACE_OS::join_leaf> methods.
00248  */
00249 class ACE_OS_Export ACE_QoS_Params
00250 {
00251 public:
00252   /**
00253    * Initialize the data members.  The <caller_data> is a pointer to
00254    * the user data that is to be transferred to the peer during
00255    * connection establishment.  The <callee_data> is a pointer to the
00256    * user data that is to be transferred back from the peer during
00257    * connection establishment.  The_<socket_qos> is a pointer to the
00258    * flow specifications for the socket, one for each direction.  The
00259    * <group_socket_qos> is a pointer to the flow speicfications for
00260    * the socket group, if applicable.  The_<flags> indicate if we're a
00261    * sender, receiver, or both.
00262    */
00263   ACE_QoS_Params (iovec *caller_data = 0,
00264                   iovec *callee_data = 0,
00265                   ACE_QoS *socket_qos = 0,
00266                   ACE_QoS *group_socket_qos = 0,
00267                   u_long flags = 0);
00268 
00269   /// Get caller data.
00270   iovec *caller_data (void) const;
00271 
00272   /// Set caller data.
00273   void caller_data (iovec *);
00274 
00275   /// Get callee data.
00276   iovec *callee_data (void) const;
00277 
00278   /// Set callee data.
00279   void callee_data (iovec *);
00280 
00281   /// Get socket qos.
00282   ACE_QoS *socket_qos (void) const;
00283 
00284   /// Set socket qos.
00285   void socket_qos (ACE_QoS *);
00286 
00287   /// Get group socket qos.
00288   ACE_QoS *group_socket_qos (void) const;
00289 
00290   /// Set group socket qos.
00291   void group_socket_qos (ACE_QoS *);
00292 
00293   /// Get flags.
00294   u_long flags (void) const;
00295 
00296   /// Set flags.
00297   void flags (u_long);
00298 
00299 private:
00300   /// A pointer to the user data that is to be transferred to the peer
00301   /// during connection establishment.
00302   iovec *caller_data_;
00303 
00304   /// A pointer to the user data that is to be transferred back from
00305   /// the peer during connection establishment.
00306   iovec *callee_data_;
00307 
00308   /// A pointer to the flow speicfications for the socket, one for each
00309   /// direction.
00310   ACE_QoS *socket_qos_;
00311 
00312   /// A pointer to the flow speicfications for the socket group, if
00313   /// applicable.
00314   ACE_QoS *group_socket_qos_;
00315 
00316   /// Flags that indicate if we're a sender, receiver, or both.
00317   u_long flags_;
00318 };
00319 
00320 // Callback function that's used by the QoS-enabled <ACE_OS::accept>
00321 // method.
00322 typedef int (*ACE_QOS_CONDITION_FUNC) (iovec *caller_id,
00323                                        iovec *caller_data,
00324                                        ACE_QoS *socket_qos,
00325                                        ACE_QoS *group_socket_qos,
00326                                        iovec *callee_id,
00327                                        iovec *callee_data,
00328                                        ACE_SOCK_GROUP *g,
00329                                        u_long callbackdata);
00330 
00331 
00332 /**
00333  * @class ACE_Accept_QoS_Params
00334  *
00335  * @brief Wrapper class that simplifies the information passed to the QoS
00336  * enabled <ACE_OS::accept> method.
00337  */
00338 class ACE_OS_Export ACE_Accept_QoS_Params
00339 {
00340 public:
00341   /**
00342    * Initialize the data members.  The <qos_condition_callback> is the
00343    * address of an optional, application-supplied condition function
00344    * that will make an accept/reject decision based on the caller
00345    * information pass in as parameters, and optionally create or join
00346    * a socket group by assinging an appropriate value to the result
00347    * parameter <g> of this function.  The <callback_data> data is
00348    * passed back to the application as a condition function parameter,
00349    * i.e., it is an Asynchronous Completion Token (ACT).
00350    */
00351   ACE_Accept_QoS_Params (ACE_QOS_CONDITION_FUNC qos_condition_callback = 0,
00352                          u_long callback_data = 0);
00353 
00354   /// Get QoS condition callback.
00355   ACE_QOS_CONDITION_FUNC qos_condition_callback (void) const;
00356 
00357   /// Set QoS condition callback.
00358   void qos_condition_callback (ACE_QOS_CONDITION_FUNC qcc);
00359 
00360   /// Get callback data.
00361   u_long callback_data (void) const;
00362 
00363   /// Set callback data.
00364   void callback_data (u_long cd);
00365 
00366 private:
00367   /**
00368    * This is the address of an optional, application-supplied
00369    * condition function that will make an accept/reject decision based
00370    * on the caller information pass in as parameters, and optionally
00371    * create or join a socket group by assinging an appropriate value
00372    * to the result parameter <g> of this function.
00373    */
00374   ACE_QOS_CONDITION_FUNC qos_condition_callback_;
00375 
00376   /**
00377    * This data is passed back to the application as a condition
00378    * function parameter, i.e., it is an Asynchronous Completion Token
00379    * (ACT).
00380    */
00381   u_long callback_data_;
00382 };
00383 
00384 
00385 #include "ace/post.h"
00386 #endif  /* ACE_OS_QOS_H */

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