00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 #ifndef ACE_SOCK_DGRAM_BCAST_H
00015 #define ACE_SOCK_DGRAM_BCAST_H
00016 #include  "ace/pre.h"
00017 
00018 #include  "ace/ACE_export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif 
00023 
00024 #include "ace/SOCK_Dgram.h"
00025 #include "ace/INET_Addr.h"
00026 
00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 
00030 
00031 
00032 
00033 
00034 class ACE_Export ACE_Bcast_Node
00035 {
00036 public:
00037 
00038   ACE_Bcast_Node (ACE_INET_Addr &,
00039                   ACE_Bcast_Node *);
00040 
00041 
00042   ~ACE_Bcast_Node (void);
00043 
00044 
00045   ACE_INET_Addr bcast_addr_;
00046 
00047 
00048   ACE_Bcast_Node *next_;
00049 };
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 class ACE_Export ACE_SOCK_Dgram_Bcast : public ACE_SOCK_Dgram
00058 {
00059 public:
00060   
00061 
00062   ACE_SOCK_Dgram_Bcast (void);
00063 
00064   ACE_SOCK_Dgram_Bcast (const ACE_Addr &local,
00065                         int protocol_family = PF_INET,
00066                         int protocol = 0,
00067                         int reuse_addr = 0,
00068                         const ACE_TCHAR *host_name = 0);
00069 
00070 
00071   ~ACE_SOCK_Dgram_Bcast (void);
00072 
00073   
00074 
00075 
00076   int open (const ACE_Addr &local,
00077             int protocol_family = PF_INET,
00078             int protocol = 0,
00079             int reuse_addr = 0,
00080             const ACE_TCHAR *host_name = 0);
00081 
00082 
00083   int close (void);
00084 
00085 
00086 
00087   ssize_t send (const void *buf,
00088                 size_t n,
00089                 u_short portnum,
00090                 int flags = 0) const;
00091 
00092 
00093 
00094   ssize_t send (const iovec iov[],
00095                 int n,
00096                 u_short portnum,
00097                 int flags = 0) const;
00098 
00099 
00100 
00101   ssize_t send (const void *buf,
00102                 size_t n,
00103                 const ACE_Addr &addr,
00104                 int flags = 0) const;
00105 
00106 
00107 
00108 
00109 
00110 
00111   ssize_t send (const iovec iov[],
00112                 int n,
00113                 const ACE_Addr &addr,
00114                 int flags = 0) const;
00115 
00116 
00117   void dump (void) const;
00118 
00119 
00120   ACE_ALLOC_HOOK_DECLARE;
00121 
00122 private:
00123 
00124   int mk_broadcast (const ACE_TCHAR *host_name);
00125 
00126 
00127   ACE_Bcast_Node *if_list_;
00128 
00129 
00130   int get_remote_addr (ACE_Addr &) const;
00131 };
00132 
00133 ACE_END_VERSIONED_NAMESPACE_DECL
00134 
00135 #if defined (__ACE_INLINE__)
00136 #include "ace/SOCK_Dgram_Bcast.inl"
00137 #endif 
00138 
00139 #include  "ace/post.h"
00140 #endif