00001 #include "ace_pch.h"
00002
00003
00004 #include "ace/FIFO_Send_Msg.h"
00005 #include "ace/Log_Msg.h"
00006
00007 #if defined (ACE_LACKS_INLINE_FUNCTIONS)
00008 #include "ace/FIFO_Send_Msg.i"
00009 #endif
00010
00011 ACE_RCSID(ace, FIFO_Send_Msg, "$Id: FIFO_Send_Msg.cpp,v 1.1.1.4.2.2 2003/04/21 19:14:54 chad Exp $")
00012
00013 ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg)
00014
00015 void
00016 ACE_FIFO_Send_Msg::dump (void) const
00017 {
00018 ACE_TRACE ("ACE_FIFO_Send_Msg::dump");
00019 ACE_FIFO_Send::dump ();
00020 }
00021
00022 ssize_t
00023 ACE_FIFO_Send_Msg::send (const ACE_Str_Buf &send_msg)
00024 {
00025
00026 #if defined (ACE_HAS_STREAM_PIPES)
00027 if (ACE_OS::putmsg (this->get_handle (),
00028 (strbuf *) 0,
00029 (strbuf *) &send_msg,
00030 0) == -1)
00031 return -1;
00032 else
00033 return send_msg.len;
00034 #else
00035 iovec iov[2];
00036
00037 iov[0].iov_base = (char *) &send_msg.len;
00038 iov[0].iov_len = sizeof send_msg.len;
00039
00040 iov[1].iov_base = (char *) send_msg.buf;
00041 iov[1].iov_len = ACE_static_cast (u_long, send_msg.len);
00042
00043 ssize_t sent = ACE_OS::writev (this->get_handle (), iov, 2);
00044 if (sent > 0)
00045 sent -= iov[0].iov_len;
00046 return sent;
00047 #endif
00048 }
00049
00050 ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (void)
00051 {
00052
00053 }
00054
00055 int
00056 ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name,
00057 int flags,
00058 int perms,
00059 LPSECURITY_ATTRIBUTES sa)
00060 {
00061 ACE_TRACE ("ACE_FIFO_Send_Msg::open");
00062 return ACE_FIFO_Send::open (fifo_name, flags | O_WRONLY, perms, sa);
00063 }
00064
00065 ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name,
00066 int flags,
00067 int perms,
00068 LPSECURITY_ATTRIBUTES sa)
00069 {
00070 ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg");
00071 if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1)
00072 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Send_Msg")));
00073 }