3 //=============================================================================
5 * @file SOCK_Dgram_Bcast.h
9 //=============================================================================
12 #ifndef ACE_SOCK_DGRAM_BCAST_H
13 #define ACE_SOCK_DGRAM_BCAST_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/ACE_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/SOCK_Dgram.h"
23 #include "ace/INET_Addr.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 * @class ACE_Bcast_Node
30 * @brief Linked list of broadcast interfaces.
32 class ACE_Export ACE_Bcast_Node
35 /// Default constructor.
36 ACE_Bcast_Node (ACE_INET_Addr
&,
40 ~ACE_Bcast_Node () = default;
42 /// Broadcast address for the interface.
43 ACE_INET_Addr bcast_addr_
;
45 /// Pointer to the next interface in the chain.
46 ACE_Bcast_Node
*next_
;
48 ACE_ALLOC_HOOK_DECLARE
;
52 * @class ACE_SOCK_Dgram_Bcast
54 * @brief Defines the member functions for the ACE_SOCK datagram
57 class ACE_Export ACE_SOCK_Dgram_Bcast
: public ACE_SOCK_Dgram
60 /// Default constructor.
61 ACE_SOCK_Dgram_Bcast ();
63 ACE_SOCK_Dgram_Bcast (const ACE_Addr
&local
,
64 int protocol_family
= PF_INET
,
67 const ACE_TCHAR
*host_name
= 0);
70 ~ACE_SOCK_Dgram_Bcast ();
72 // Initiate a connectionless datagram broadcast endpoint.
74 /// Initiate a connectionless datagram broadcast endpoint.
75 int open (const ACE_Addr
&local
,
76 int protocol_family
= PF_INET
,
79 const ACE_TCHAR
*host_name
= 0);
81 /// Close up and release dynamically allocated resources.
84 /// Broadcast the datagram to every interface. Returns the average
85 /// number of bytes sent.
86 ssize_t
send (const void *buf
,
91 /// Broadcast the @c iov datagrams to every interface. Returns the
92 /// average number of bytes sent.
93 ssize_t
send (const iovec iov
[],
98 /// Broadcast an N byte datagram to ADDR (note that addr must be
99 /// preassigned to the broadcast address of the subnet...).
100 ssize_t
send (const void *buf
,
102 const ACE_Addr
&addr
,
103 int flags
= 0) const;
106 * Broadcast an @a iovec of size @a n to @a addr as a datagram (note
107 * that addr must be preassigned to the broadcast address of the
110 ssize_t
send (const iovec iov
[],
112 const ACE_Addr
&addr
,
113 int flags
= 0) const;
115 /// Dump the state of an object.
118 /// Declare the dynamic allocation hooks.
119 ACE_ALLOC_HOOK_DECLARE
;
122 /// Make broadcast available for Datagram socket.
123 int mk_broadcast (const ACE_TCHAR
*host_name
);
125 /// Points to the head of the list of broadcast interfaces.
126 ACE_Bcast_Node
*if_list_
;
128 /// Do not allow this function to percolate up to this interface...
129 int get_remote_addr (ACE_Addr
&) const;
132 ACE_END_VERSIONED_NAMESPACE_DECL
134 #if defined (__ACE_INLINE__)
135 #include "ace/SOCK_Dgram_Bcast.inl"
136 #endif /* __ACE_INLINE__ */
138 #include /**/ "ace/post.h"
139 #endif /* ACE_SOCK_DGRAM_BCAST_H */