SOCK_Dgram_Mcast_QoS.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    SOCK_Dgram_Mcast_QoS.h
00006  *
00007  *  $Id: SOCK_Dgram_Mcast_QoS.h 80826 2008-03-04 14:51:23Z wotte $
00008  *
00009  *  @author Vishal Kachroo <vishal@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_SOCK_DGRAM_MCAST_QOS_H
00015 #define ACE_SOCK_DGRAM_MCAST_QOS_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/SOCK_Dgram_Mcast.h"
00019 #include "QoS_Manager.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00026 
00027 /**
00028  * @class ACE_SOCK_Dgram_Mcast_QoS
00029  *
00030  * @brief Defines the member functions for the ACE QoS enabled socket
00031  * wrapper for UDP/IP multicast.
00032  */
00033 class ACE_QoS_Export ACE_SOCK_Dgram_Mcast_QoS : public ACE_SOCK_Dgram_Mcast
00034 {
00035 
00036 public:
00037   // = Initialization routines.
00038   /// Ctor, has same defaults as ACE_SOCK_Dgram_Mcast
00039   ACE_SOCK_Dgram_Mcast_QoS (options opts = DEFOPTS);
00040 
00041   // Note that there is no public <open> method.  Therefore, this
00042   // class cannot be used unless you <subscribe> to a multicast group.
00043   // If you just want to send (and not listen) to a multicast group,
00044   // use <ACE_SOCK_Dgram> or <ACE_SOCK_CODgram> instead.
00045 
00046   /// Default dtor.
00047   ~ACE_SOCK_Dgram_Mcast_QoS (void);
00048 
00049   // = Multicast group management routines.
00050   /**
00051    * This is a QoS-enabled method for joining a multicast group, which
00052    * passes <qos_params> via <ACE_OS::join_leaf>.  The network
00053    * interface device driver is instructed to accept datagrams with
00054    * <mcast_addr> multicast addresses.  If the socket has already been
00055    * opened, <subscribe> closes the socket and opens a new socket
00056    * bound to the <mcast_addr>. The session object specifies the QoS
00057    * session that the socket wants to subscribe to. A socket may
00058    * subscribe to multiple QoS sessions by calling this method multiple
00059    * times with different session objects.
00060    *
00061    * The <net_if> interface is hardware specific, e.g., use "netstat
00062    * -i" to find whether your interface is, such as "le0" or something
00063    * else.  If net_if == 0, <subscribe> uses the default mcast
00064    * interface.  Returns: -1 if the call fails.
00065    *
00066    * Note that some platforms, such as pSoS, support only number, not
00067    * names, for network interfaces.  For these platforms, just give
00068    * these numbers in alphanumeric form and <subscribe> will convert
00069    * them into numbers via <ACE_OS::atoi>.
00070    */
00071   int subscribe (const ACE_INET_Addr &mcast_addr,
00072                  const ACE_QoS_Params &qos_params,
00073                  int reuse_addr = 1,
00074                  const ACE_TCHAR *net_if = 0,
00075                  int protocol_family = PF_INET,
00076                  int protocol = 0,
00077                  ACE_Protocol_Info *protocolinfo = 0,
00078                  ACE_SOCK_GROUP g = 0,
00079                  u_long flags = 0,
00080                  ACE_QoS_Session *qos_session = 0);
00081 
00082   // = Data transfer routines.
00083 
00084   /// Send <buffer_count> worth of @a buffers to @a addr using overlapped
00085   /// I/O (uses <WSASentTo>).  Returns 0 on success.
00086   ssize_t send (const iovec buffers[],
00087                 int buffer_count,
00088                 size_t &number_of_bytes_sent,
00089                 int flags,
00090                 const ACE_Addr &addr,
00091                 ACE_OVERLAPPED *overlapped,
00092                 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
00093 
00094   /// Send an @a n byte @a buf to the datagram socket (uses <WSASentTo>).
00095   ssize_t send (const void *buf,
00096                 size_t n,
00097                 const ACE_Addr &addr,
00098                 int flags,
00099                 ACE_OVERLAPPED *overlapped,
00100                 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
00101 
00102   /// Returns the QoS manager for this socket.
00103   ACE_QoS_Manager qos_manager (void);
00104 
00105   /// Declare the dynamic allocation hooks.
00106   ACE_ALLOC_HOOK_DECLARE;
00107 
00108   int open (const ACE_INET_Addr &addr,
00109             const ACE_QoS_Params &qos_params,
00110             int protocol_family = PF_INET,
00111             int protocol = 0,
00112             ACE_Protocol_Info *protocolinfo = 0,
00113             ACE_SOCK_GROUP g = 0,
00114             u_long flags = 0,
00115             int reuse_addr = 0);
00116 
00117 private:
00118   // = Disable public <open> method to ensure class used properly.
00119 
00120 
00121   /// Subscribe to the multicast interface using QoS-enabled semantics.
00122   int subscribe_ifs (const ACE_INET_Addr &mcast_addr,
00123                      const ACE_QoS_Params &qos_params,
00124                      const ACE_TCHAR *net_if,
00125                      int protocol_family,
00126                      int protocol,
00127                      int reuse_addr,
00128                      ACE_Protocol_Info *protocolinfo);
00129 
00130   /// Manages the QoS sessions that this socket subscribes to.
00131   ACE_QoS_Manager qos_manager_;
00132 
00133 };
00134 
00135 ACE_END_VERSIONED_NAMESPACE_DECL
00136 
00137 #if defined (__ACE_INLINE__)
00138 #include "SOCK_Dgram_Mcast_QoS.inl"
00139 #endif /* __ACE_INLINE__ */
00140 
00141 #include /**/ "ace/post.h"
00142 #endif /* ACE_SOCK_DGRAM_MCAST_QOS_H */

Generated on Tue Feb 2 17:36:39 2010 for ACE_QoS by  doxygen 1.4.7