00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 #ifndef ACE_SOCK_DGRAM_H
00014 #define ACE_SOCK_DGRAM_H
00015 #include  "ace/pre.h"
00016 
00017 #include "ace/SOCK.h"
00018 #include "ace/INET_Addr.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif 
00023 
00024 #include "ace/Addr.h"
00025 
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027 
00028 class ACE_Time_Value;
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 class ACE_Export ACE_SOCK_Dgram : public ACE_SOCK
00037 {
00038 public:
00039   
00040 
00041   ACE_SOCK_Dgram (void);
00042 
00043 
00044 
00045   ACE_SOCK_Dgram (const ACE_Addr &local,
00046                   int protocol_family = ACE_PROTOCOL_FAMILY_INET,
00047                   int protocol = 0,
00048                   int reuse_addr = 0);
00049 
00050 
00051 
00052 
00053 
00054 
00055   ACE_SOCK_Dgram (const ACE_Addr &local,
00056                   int protocol_family,
00057                   int protocol,
00058                   ACE_Protocol_Info *protocolinfo,
00059                   ACE_SOCK_GROUP g = 0,
00060                   u_long flags = 0,
00061                   int reuse_addr = 0);
00062 
00063 
00064 
00065   int open (const ACE_Addr &local,
00066             int protocol_family = ACE_PROTOCOL_FAMILY_INET,
00067             int protocol = 0,
00068             int reuse_addr = 0);
00069 
00070 
00071 
00072 
00073 
00074 
00075   int open (const ACE_Addr &local,
00076             int protocol_family,
00077             int protocol,
00078             ACE_Protocol_Info *protocolinfo,
00079             ACE_SOCK_GROUP g = 0,
00080             u_long flags = 0,
00081             int reuse_addr = 0);
00082 
00083 
00084   ~ACE_SOCK_Dgram (void);
00085 
00086   
00087 
00088   ssize_t send (const void *buf,
00089                 size_t n,
00090                 const ACE_Addr &addr,
00091                 int flags = 0) const;
00092 
00093 
00094 
00095   ssize_t recv (void *buf,
00096                 size_t n,
00097                 ACE_Addr &addr,
00098                 int flags = 0) const;
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108   ssize_t recv (iovec *io_vec,
00109                 ACE_Addr &addr,
00110                 int flags = 0,
00111                 const ACE_Time_Value *timeout = 0) const;
00112 
00113 
00114 
00115   ssize_t send (const iovec iov[],
00116                 int n,
00117                 const ACE_Addr &addr,
00118                 int flags = 0) const;
00119 
00120 
00121 
00122   ssize_t recv (iovec iov[],
00123                 int n,
00124                 ACE_Addr &addr,
00125                 int flags = 0) const;
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136   ssize_t recv (void *buf,
00137                 size_t n,
00138                 ACE_Addr &addr,
00139                 int flags,
00140                 const ACE_Time_Value *timeout) const;
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151   ssize_t send (const void *buf,
00152                 size_t n,
00153                 const ACE_Addr &addr,
00154                 int flags,
00155                 const ACE_Time_Value *timeout) const;
00156 
00157 
00158 
00159   ssize_t send (const iovec buffers[],
00160                 int buffer_count,
00161                 size_t &number_of_bytes_sent,
00162                 int flags,
00163                 const ACE_Addr &addr,
00164                 ACE_OVERLAPPED *overlapped,
00165                 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
00166 
00167 
00168 
00169   ssize_t recv (iovec buffers[],
00170                 int buffer_count,
00171                 size_t &number_of_bytes_recvd,
00172                 int &flags,
00173                 ACE_Addr &addr,
00174                 ACE_OVERLAPPED *overlapped,
00175                 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
00176 
00177 
00178   ssize_t send (const void *buf,
00179                 size_t n,
00180                 const ACE_Addr &addr,
00181                 int flags,
00182                 ACE_OVERLAPPED *overlapped,
00183                 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
00184 
00185 
00186 
00187   ssize_t recv (void *buf,
00188                 size_t n,
00189                 ACE_Addr &addr,
00190                 int flags,
00191                 ACE_OVERLAPPED *overlapped,
00192                 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
00193 
00194   
00195   typedef ACE_INET_Addr PEER_ADDR;
00196 
00197 
00198   void dump (void) const;
00199 
00200 
00201   int set_nic (const ACE_TCHAR *net_if,
00202                int addr_family = AF_UNSPEC);
00203 
00204 
00205   ACE_ALLOC_HOOK_DECLARE;
00206 
00207 protected:
00208 
00209   int shared_open (const ACE_Addr &local,
00210                    int protocol_family);
00211 
00212 
00213 
00214   int make_multicast_ifaddr (ip_mreq *mreq,     
00215                              const ACE_INET_Addr &mcast_addr,
00216                              const ACE_TCHAR *net_if);
00217 
00218 #if defined (ACE_HAS_IPV6)
00219 
00220 
00221   int make_multicast_ifaddr6 (ipv6_mreq *mreq,   // Put result here, if != NULL.
00222                               const ACE_INET_Addr &mcast_addr,
00223                               const ACE_TCHAR *net_if);
00224 
00225 #endif 
00226 
00227 private:
00228 
00229   int  get_remote_addr (ACE_Addr &) const;
00230 };
00231 
00232 ACE_END_VERSIONED_NAMESPACE_DECL
00233 
00234 #if defined (__ACE_INLINE__)
00235 #include "ace/SOCK_Dgram.inl"
00236 #endif 
00237 
00238 #include  "ace/post.h"
00239 #endif