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
9 #include "ace/INET_Addr.h"
10 #include "ace/Time_Value.h"
12 #include "RMCast_Export.h"
13 #include "Parameters.h"
20 class ACE_RMCast_Export 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
,
31 Parameters
const& params
= Parameters ());
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.
44 recv (void* buf
, size_t s
);
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.
57 recv (void* buf
, size_t s
, ACE_Time_Value
const& timeout
);
62 ACE_Time_Value
const& timeout
,
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.
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.
82 size (ACE_Time_Value
const& timeout
);
85 // Reactor interface. Note that the handle returned by get_handle()
86 // is for signalling purposes only.
92 std::unique_ptr
<Socket_Impl
> impl_
;
97 #endif // ACE_RMCAST_SOCKET_H