Include changes memory
[ACE_TAO.git] / ACE / protocols / ace / RMCast / Socket.h
blobbb5f73d7fa302b415a51c20376f9ebfbe008029d
1 // author : Boris Kolpackov <boris@kolpackov.net>
3 #ifndef ACE_RMCAST_SOCKET_H
4 #define ACE_RMCAST_SOCKET_H
6 #include "ace/config-lite.h" // ACE_HANDLE
8 #include <memory>
9 #include "ace/INET_Addr.h"
10 #include "ace/Time_Value.h"
12 #include "RMCast_Export.h"
13 #include "Parameters.h"
16 namespace ACE_RMCast
18 class Socket_Impl;
20 class ACE_RMCast_Export Socket
22 public:
23 virtual
24 ~Socket ();
26 // If 'simulator' is 'true' then internal message loss and
27 // reordering simulator (on IPv4 level) is turned on.
29 Socket (ACE_INET_Addr const& a,
30 bool loop = true,
31 Parameters const& params = Parameters ());
33 public:
34 virtual void
35 send (void const* buf, size_t s);
38 // Block if message is not available. Upon successful completion
39 // return the next message. Otherwise return -1 and errno set to
40 // indicate the error. ENOENT indicates that the sender does not
41 // retain the data for this message anymore.
43 virtual ssize_t
44 recv (void* buf, size_t s);
46 virtual ssize_t
47 recv (void* buf, size_t s, ACE_INET_Addr& from);
50 // Block for up to <timeout> until message is available. Upon
51 // successful completion return the next message. Otherwise
52 // return -1 and errno set to indicate the error. ETIME indicates
53 // that the operation timed out. ENOENT indicates that the sender
54 // does not retain the data for this message anymore.
56 virtual ssize_t
57 recv (void* buf, size_t s, ACE_Time_Value const& timeout);
59 virtual ssize_t
60 recv (void* buf,
61 size_t s,
62 ACE_Time_Value const& timeout,
63 ACE_INET_Addr& from);
66 // Block if message is not available. Upon successful completion
67 // return the size of the next message. Otherwise return -1 and
68 // errno set to indicate the error. ENOENT indicates that the
69 // sender does not retain the data for this message anymore.
71 virtual ssize_t
72 size ();
75 // Block for up to <timeout> until message is available. Upon
76 // successful completion return the size of the next message.
77 // Otherwise return -1 and errno set to indicate the error.
78 // ETIME indicates that the operation timed out. ENOENT indicates
79 // that the sender does not retain the data for this message anymore.
81 virtual ssize_t
82 size (ACE_Time_Value const& timeout);
84 public:
85 // Reactor interface. Note that the handle returned by get_handle()
86 // is for signalling purposes only.
88 ACE_HANDLE
89 get_handle ();
91 private:
92 std::unique_ptr<Socket_Impl> impl_;
97 #endif // ACE_RMCAST_SOCKET_H