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

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

Generated on Mon Jun 16 13:17:27 2003 for ACE_QoS by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002