3 //=============================================================================
5 * @file SOCK_Dgram_Mcast_QoS.h
7 * @author Vishal Kachroo <vishal@cs.wustl.edu>
9 //=============================================================================
12 #ifndef ACE_SOCK_DGRAM_MCAST_QOS_H
13 #define ACE_SOCK_DGRAM_MCAST_QOS_H
14 #include /**/ "ace/pre.h"
16 #include "ace/SOCK_Dgram_Mcast.h"
17 #include "QoS_Manager.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 * @class ACE_SOCK_Dgram_Mcast_QoS
28 * @brief Defines the member functions for the ACE QoS enabled socket
29 * wrapper for UDP/IP multicast.
31 class ACE_QoS_Export ACE_SOCK_Dgram_Mcast_QoS
: public ACE_SOCK_Dgram_Mcast
34 /// Ctor, has same defaults as ACE_SOCK_Dgram_Mcast
35 ACE_SOCK_Dgram_Mcast_QoS (options opts
= DEFOPTS
);
37 // Note that there is no public <open> method. Therefore, this
38 // class cannot be used unless you <subscribe> to a multicast group.
39 // If you just want to send (and not listen) to a multicast group,
40 // use <ACE_SOCK_Dgram> or <ACE_SOCK_CODgram> instead.
43 ~ACE_SOCK_Dgram_Mcast_QoS ();
45 // = Multicast group management routines.
47 * This is a QoS-enabled method for joining a multicast group, which
48 * passes <qos_params> via <ACE_OS::join_leaf>. The network
49 * interface device driver is instructed to accept datagrams with
50 * <mcast_addr> multicast addresses. If the socket has already been
51 * opened, <subscribe> closes the socket and opens a new socket
52 * bound to the <mcast_addr>. The session object specifies the QoS
53 * session that the socket wants to subscribe to. A socket may
54 * subscribe to multiple QoS sessions by calling this method multiple
55 * times with different session objects.
57 * The <net_if> interface is hardware specific, e.g., use "netstat
58 * -i" to find whether your interface is, such as "le0" or something
59 * else. If net_if == 0, <subscribe> uses the default mcast
60 * interface. Returns: -1 if the call fails.
62 * Note that some platforms, such as pSoS, support only number, not
63 * names, for network interfaces. For these platforms, just give
64 * these numbers in alphanumeric form and <subscribe> will convert
65 * them into numbers via <ACE_OS::atoi>.
67 int subscribe (const ACE_INET_Addr
&mcast_addr
,
68 const ACE_QoS_Params
&qos_params
,
70 const ACE_TCHAR
*net_if
= 0,
71 int protocol_family
= PF_INET
,
73 ACE_Protocol_Info
*protocolinfo
= 0,
76 ACE_QoS_Session
*qos_session
= 0);
78 // = Data transfer routines.
80 /// Send <buffer_count> worth of @a buffers to @a addr using overlapped
81 /// I/O (uses <WSASentTo>). Returns 0 on success.
82 ssize_t
send (const iovec buffers
[],
84 size_t &number_of_bytes_sent
,
87 ACE_OVERLAPPED
*overlapped
,
88 ACE_OVERLAPPED_COMPLETION_FUNC func
) const;
90 /// Send an @a n byte @a buf to the datagram socket (uses <WSASentTo>).
91 ssize_t
send (const void *buf
,
95 ACE_OVERLAPPED
*overlapped
,
96 ACE_OVERLAPPED_COMPLETION_FUNC func
) const;
98 /// Returns the QoS manager for this socket.
99 ACE_QoS_Manager
qos_manager ();
101 /// Declare the dynamic allocation hooks.
102 ACE_ALLOC_HOOK_DECLARE
;
104 int open (const ACE_INET_Addr
&addr
,
105 const ACE_QoS_Params
&qos_params
,
106 int protocol_family
= PF_INET
,
108 ACE_Protocol_Info
*protocolinfo
= 0,
109 ACE_SOCK_GROUP g
= 0,
114 // = Disable public <open> method to ensure class used properly.
116 /// Subscribe to the multicast interface using QoS-enabled semantics.
117 int subscribe_ifs (const ACE_INET_Addr
&mcast_addr
,
118 const ACE_QoS_Params
&qos_params
,
119 const ACE_TCHAR
*net_if
,
123 ACE_Protocol_Info
*protocolinfo
);
125 /// Manages the QoS sessions that this socket subscribes to.
126 ACE_QoS_Manager qos_manager_
;
129 ACE_END_VERSIONED_NAMESPACE_DECL
131 #if defined (__ACE_INLINE__)
132 #include "SOCK_Dgram_Mcast_QoS.inl"
133 #endif /* __ACE_INLINE__ */
135 #include /**/ "ace/post.h"
136 #endif /* ACE_SOCK_DGRAM_MCAST_QOS_H */