Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / SOCK_Dgram_Bcast.h
blob46e4a2d66b8322e3fa8ee31bfaa64b00534da4ec
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file SOCK_Dgram_Bcast.h
7 * @author Doug Schmidt
8 */
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)
19 # 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
27 /**
28 * @class ACE_Bcast_Node
30 * @brief Linked list of broadcast interfaces.
32 class ACE_Export ACE_Bcast_Node
34 public:
35 /// Default constructor.
36 ACE_Bcast_Node (ACE_INET_Addr &,
37 ACE_Bcast_Node *);
39 /// Destructor.
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;
51 /**
52 * @class ACE_SOCK_Dgram_Bcast
54 * @brief Defines the member functions for the ACE_SOCK datagram
55 * abstraction.
57 class ACE_Export ACE_SOCK_Dgram_Bcast : public ACE_SOCK_Dgram
59 public:
60 /// Default constructor.
61 ACE_SOCK_Dgram_Bcast ();
63 ACE_SOCK_Dgram_Bcast (const ACE_Addr &local,
64 int protocol_family = PF_INET,
65 int protocol = 0,
66 int reuse_addr = 0,
67 const ACE_TCHAR *host_name = 0);
69 /// Default dtor.
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,
77 int protocol = 0,
78 int reuse_addr = 0,
79 const ACE_TCHAR *host_name = 0);
81 /// Close up and release dynamically allocated resources.
82 int close ();
84 /// Broadcast the datagram to every interface. Returns the average
85 /// number of bytes sent.
86 ssize_t send (const void *buf,
87 size_t n,
88 u_short portnum,
89 int flags = 0) const;
91 /// Broadcast the @c iov datagrams to every interface. Returns the
92 /// average number of bytes sent.
93 ssize_t send (const iovec iov[],
94 int n,
95 u_short portnum,
96 int flags = 0) const;
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,
101 size_t n,
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
108 * subnet...)
110 ssize_t send (const iovec iov[],
111 int n,
112 const ACE_Addr &addr,
113 int flags = 0) const;
115 /// Dump the state of an object.
116 void dump () const;
118 /// Declare the dynamic allocation hooks.
119 ACE_ALLOC_HOOK_DECLARE;
121 private:
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 */