[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / SOCK_Dgram.h
blobc26c5ff2c3545190a7f3425b543b73397312a14f
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file SOCK_Dgram.h
7 * $Id: SOCK_Dgram.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
11 //=============================================================================
13 #ifndef ACE_SOCK_DGRAM_H
14 #define ACE_SOCK_DGRAM_H
15 #include /**/ "ace/pre.h"
17 #include "ace/SOCK.h"
18 #include "ace/INET_Addr.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "ace/Addr.h"
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 class ACE_Time_Value;
30 /**
31 * @class ACE_SOCK_Dgram
33 * @brief Defines the member functions for the ACE_SOCK datagram
34 * abstraction.
36 class ACE_Export ACE_SOCK_Dgram : public ACE_SOCK
38 public:
39 // = Initialization and termination methods.
40 /// Default constructor.
41 ACE_SOCK_Dgram (void);
43 /// This is a BSD-style method (i.e., no QoS) for initiating a socket
44 /// dgram that will accept datagrams at the <local> address.
45 ACE_SOCK_Dgram (const ACE_Addr &local,
46 int protocol_family = ACE_PROTOCOL_FAMILY_INET,
47 int protocol = 0,
48 int reuse_addr = 0);
50 /**
51 * This is a QoS-enabed method for initiating a socket dgram that
52 * will accept datagrams at the <local> address. The @a qos_params
53 * are passed to <ACE_OS::join_leaf>.
55 ACE_SOCK_Dgram (const ACE_Addr &local,
56 int protocol_family,
57 int protocol,
58 ACE_Protocol_Info *protocolinfo,
59 ACE_SOCK_GROUP g = 0,
60 u_long flags = 0,
61 int reuse_addr = 0);
63 /// This is a BSD-style method (i.e., no QoS) for initiating a socket
64 /// dgram that will accept datagrams at the <local> address.
65 int open (const ACE_Addr &local,
66 int protocol_family = ACE_PROTOCOL_FAMILY_INET,
67 int protocol = 0,
68 int reuse_addr = 0);
70 /**
71 * This is a QoS-enabed method for initiating a socket dgram that
72 * will accept datagrams at the <local> address. The @a qos_params
73 * are passed to <ACE_OS::join_leaf>.
75 int open (const ACE_Addr &local,
76 int protocol_family,
77 int protocol,
78 ACE_Protocol_Info *protocolinfo,
79 ACE_SOCK_GROUP g = 0,
80 u_long flags = 0,
81 int reuse_addr = 0);
83 /// Default dtor.
84 ~ACE_SOCK_Dgram (void);
86 // = Data transfer routines.
87 /// Send an @a n byte @a buf to the datagram socket (uses <sendto(3)>).
88 ssize_t send (const void *buf,
89 size_t n,
90 const ACE_Addr &addr,
91 int flags = 0) const;
93 /// Receive an @a n byte @a buf from the datagram socket (uses
94 /// <recvfrom(3)>).
95 ssize_t recv (void *buf,
96 size_t n,
97 ACE_Addr &addr,
98 int flags = 0) const;
101 * Allows a client to read from a socket without having to provide a
102 * buffer to read. This method determines how much data is in the
103 * socket, allocates a buffer of this size, reads in the data, and
104 * returns the number of bytes read. The caller is responsible for
105 * deleting the member in the <iov_base> field of <io_vec> using the
106 * ``delete []'' syntax.
108 ssize_t recv (iovec *io_vec,
109 ACE_Addr &addr,
110 int flags = 0,
111 const ACE_Time_Value *timeout = 0) const;
113 /// Send an <iovec> of size @a n to the datagram socket (uses
114 /// <sendmsg(3)>).
115 ssize_t send (const iovec iov[],
116 int n,
117 const ACE_Addr &addr,
118 int flags = 0) const;
120 /// Recv an <iovec> of size @a n to the datagram socket (uses
121 /// <recvmsg(3)>).
122 ssize_t recv (iovec iov[],
123 int n,
124 ACE_Addr &addr,
125 int flags = 0) const;
128 * Wait up to @a timeout amount of time to receive a datagram into
129 * @a buf. The ACE_Time_Value indicates how long to blocking
130 * trying to receive. If @a timeout == 0, the caller will block
131 * until action is possible, else will wait until the relative time
132 * specified in *@a timeout elapses). If <recv> times out a -1 is
133 * returned with @c errno == ETIME. If it succeeds the number of
134 * bytes received is returned.
136 ssize_t recv (void *buf,
137 size_t n,
138 ACE_Addr &addr,
139 int flags,
140 const ACE_Time_Value *timeout) const;
143 * Wait up to @a timeout amount of time to send a datagram to
144 * @a buf. The ACE_Time_Value indicates how long to blocking
145 * trying to receive. If @a timeout == 0, the caller will block
146 * until action is possible, else will wait until the relative time
147 * specified in *@a timeout elapses). If <send> times out a -1 is
148 * returned with @c errno == ETIME. If it succeeds the number of
149 * bytes sent is returned.
151 ssize_t send (const void *buf,
152 size_t n,
153 const ACE_Addr &addr,
154 int flags,
155 const ACE_Time_Value *timeout) const;
157 /// Send <buffer_count> worth of @a buffers to @a addr using overlapped
158 /// I/O (uses <WSASendTo>). Returns 0 on success.
159 ssize_t send (const iovec buffers[],
160 int buffer_count,
161 size_t &number_of_bytes_sent,
162 int flags,
163 const ACE_Addr &addr,
164 ACE_OVERLAPPED *overlapped,
165 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
167 /// Recv <buffer_count> worth of @a buffers from @a addr using
168 /// overlapped I/O (uses <WSARecvFrom>). Returns 0 on success.
169 ssize_t recv (iovec buffers[],
170 int buffer_count,
171 size_t &number_of_bytes_recvd,
172 int &flags,
173 ACE_Addr &addr,
174 ACE_OVERLAPPED *overlapped,
175 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
177 /// Send an @a n byte @a buf to the datagram socket (uses <WSASendTo>).
178 ssize_t send (const void *buf,
179 size_t n,
180 const ACE_Addr &addr,
181 int flags,
182 ACE_OVERLAPPED *overlapped,
183 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
185 /// Receive an @a n byte @a buf from the datagram socket (uses
186 /// <WSARecvFrom>).
187 ssize_t recv (void *buf,
188 size_t n,
189 ACE_Addr &addr,
190 int flags,
191 ACE_OVERLAPPED *overlapped,
192 ACE_OVERLAPPED_COMPLETION_FUNC func) const;
194 // = Meta-type info.
195 typedef ACE_INET_Addr PEER_ADDR;
197 /// Dump the state of an object.
198 void dump (void) const;
200 /// Set NIC to use as multicast interface.
201 int set_nic (const ACE_TCHAR *net_if,
202 int addr_family = AF_UNSPEC);
204 /// Declare the dynamic allocation hooks.
205 ACE_ALLOC_HOOK_DECLARE;
207 protected:
208 /// Open is shared by this and by <LSOCK_Dgram>.
209 int shared_open (const ACE_Addr &local,
210 int protocol_family);
212 /// Create a multicast addr/if pair, in format useful for system calls.
213 /// If mreq param is NULL, just verify the passed addr/interface specs.
214 int make_multicast_ifaddr (ip_mreq *mreq, // Put result here, if != NULL.
215 const ACE_INET_Addr &mcast_addr,
216 const ACE_TCHAR *net_if);
218 #if defined (ACE_HAS_IPV6)
219 /// Create a multicast addr/if pair, in format useful for system calls.
220 /// If mreq param is NULL, just verify the passed addr/interface specs.
221 int make_multicast_ifaddr6 (ipv6_mreq *mreq, // Put result here, if != NULL.
222 const ACE_INET_Addr &mcast_addr,
223 const ACE_TCHAR *net_if);
225 #endif /* ACE_HAS_IPV6 */
227 private:
228 /// Do not allow this function to percolate up to this interface...
229 int get_remote_addr (ACE_Addr &) const;
232 ACE_END_VERSIONED_NAMESPACE_DECL
234 #if defined (__ACE_INLINE__)
235 #include "ace/SOCK_Dgram.inl"
236 #endif /* __ACE_INLINE__ */
238 #include /**/ "ace/post.h"
239 #endif /* ACE_SOCK_DGRAM_H */