OS_QoS.h

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

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