3 //=============================================================================
5 * @file FIFO_Recv_Msg.h
9 //=============================================================================
12 #ifndef ACE_FIFO_RECV_MSG_H
13 #define ACE_FIFO_RECV_MSG_H
14 #include /**/ "ace/pre.h"
16 #include "ace/FIFO_Recv.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 * @class ACE_FIFO_Recv_Msg
30 * @brief Receiver side for the record oriented C++ wrapper for UNIX FIFOs.
32 * This method works slightly differently on platforms with the
33 * @c ACE_HAS_STREAM_PIPES configuration setting than those without.
34 * With ACE_HAS_STREAM_PIPES, the @c getmsg() system function is used
35 * and it preserves message boundaries internally. Without
36 * @c ACE_HAS_STREAM_PIPES, the message boundaries are emulated by
37 * this class and ACE_FIFO_Send_Msg cooperating. The sending class
38 * first writes an integer number of bytes in the message, then the
39 * message. ACE_FIFO_Recv_Msg reads the count, then the data.
40 * The operational differences occur primarily when a message is larger
41 * than what a caller of this class requests. See recv() for details.
43 class ACE_Export ACE_FIFO_Recv_Msg
: public ACE_FIFO_Recv
46 /// Default constructor.
49 /// Open up a record-oriented named pipe for reading.
50 ACE_FIFO_Recv_Msg (const ACE_TCHAR
*rendezvous
,
51 int flags
= O_CREAT
| O_RDONLY
,
52 mode_t perms
= ACE_DEFAULT_FILE_PERMS
,
54 LPSECURITY_ATTRIBUTES sa
= 0);
56 /// Open up a record-oriented named pipe for reading.
57 int open (const ACE_TCHAR
*rendezvous
,
58 int flags
= O_CREAT
| O_RDONLY
,
59 mode_t perms
= ACE_DEFAULT_FILE_PERMS
,
61 LPSECURITY_ATTRIBUTES sa
= 0);
63 /// Receive a message based on attributes in an ACE_Str_Buf.
65 * @param msg Reference to an ACE_Str_Buf whose @c buf member points
66 * to the memory to receive the data and @c maxlen member
67 * contains the maximum number of bytes to receive.
68 * On return after successfully reading data, the
69 * @c len member contains the number of bytes received and
70 * placed in the buffer pointed to by @c msg.buf.
72 * @retval -1 Error; consult @c errno for specific error number.
73 * @return If the @c ACE_HAS_STREAM_PIPES configuration setting is
74 * defined, the return value is the number of bytes received
75 * in the message and will be the same as @c buf.len.
76 * The return value from the @c getmsg() system function
78 * If @c ACE_HAS_STREAM_PIPES is not defined, the number
79 * of bytes in the message read from the FIFO is returned.
80 * If the message is larger than the maximum length
81 * requested in @c msg.maxlen, the return value reflects
82 * the entire message length, and the @c msg.len member
83 * reflects how many bytes were actually placed in the
84 * caller's buffer. Any part of the message longer than
85 * @c msg.maxlen is discarded.
87 ssize_t
recv (ACE_Str_Buf
&msg
);
89 /// Receive a message based on buffer pointer and maximum size.
91 * @param buf Pointer to the memory to receive the data.
92 * @param len The maximum number of bytes to receive.
94 * @retval -1 Error; consult @c errno for specific error number.
95 * @return The number of bytes received in the message. For messages
96 * that are larger than the requested maximum size, the
97 * behavior is different depending on the @c ACE_HAS_STREAM_PIPES
98 * configuration setting. With @c ACE_HAS_STREAM_PIPES,
99 * the return value will be the same as @arg len (this is
100 * also possible if the message is exactly the same length
101 * as @arg len, and the two cases are indistinguishable).
102 * Without @c ACE_HAS_STREAM_PIPES, the return value is
103 * the total length of the message, including bytes in
104 * excess of @arg len. The excess bytes are discarded.
106 ssize_t
recv (void *buf
, size_t len
);
108 #if defined (ACE_HAS_STREAM_PIPES)
109 /// Recv @a data and @a cntl message via Stream pipes.
110 ssize_t
recv (ACE_Str_Buf
*data
,
114 /// Recv @a data and @a cntl message via Stream pipes in "band" mode.
115 ssize_t
recv (int *band
,
119 #endif /* ACE_HAS_STREAM_PIPES */
121 /// Dump the state of an object.
124 /// Declare the dynamic allocation hooks.
125 ACE_ALLOC_HOOK_DECLARE
;
128 ACE_END_VERSIONED_NAMESPACE_DECL
130 #if defined (__ACE_INLINE__)
131 #include "ace/FIFO_Recv_Msg.inl"
132 #endif /* __ACE_INLINE__ */
134 #include /**/ "ace/post.h"
135 #endif /* ACE_FIFO_RECV_MSG_H */