summaryrefslogtreecommitdiff
path: root/ace/LSOCK_Stream.cpp
blob: 108401fc1a14d0209e82f1d36314b8a09cc2d425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// LSOCK_Stream.cpp
// $Id$

#define ACE_BUILD_DLL
#include "ace/Log_Msg.h"
#include "ace/LSOCK_Stream.h"

#if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS)

ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Stream)

void
ACE_LSOCK_Stream::dump (void) const
{
  ACE_TRACE ("ACE_LSOCK_Stream::dump");

  ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
  ACE_SOCK_Stream::dump ();
  ACE_LSOCK::dump ();
  ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}

#if defined (ACE_HAS_MSG)

// Send a readv-style vector of buffers, along with an open I/O
// handle.

ssize_t
ACE_LSOCK_Stream::send_msg (const iovec iov[], 
			    size_t n, 
			    int fd)
{
  ACE_TRACE ("ACE_LSOCK_Stream::send_msg");
  msghdr send_msg;

  send_msg.msg_iov	    = (iovec *) iov;
  send_msg.msg_iovlen	    = n;
  send_msg.msg_name	    = (char *) 0;
  send_msg.msg_namelen	    = 0;
  send_msg.msg_accrights    = (char *) &fd;
  send_msg.msg_accrightslen = sizeof fd;

  return ACE_OS::sendmsg (this->ACE_SOCK_Stream::get_handle (), 
		    &send_msg, 0);
}

// Read a readv-style vector of buffers, along with an open I/O
// handle.

ssize_t
ACE_LSOCK_Stream::recv_msg (iovec iov[], 
			    size_t n, 
			    int &fd)
{
  ACE_TRACE ("ACE_LSOCK_Stream::recv_msg");
  msghdr recv_msg;
  
  recv_msg.msg_iov	    = (iovec *) iov;
  recv_msg.msg_iovlen	    = n;
  recv_msg.msg_name	    = (char *) 0;
  recv_msg.msg_namelen	    = 0;
  recv_msg.msg_accrights    = (char *) &fd;
  recv_msg.msg_accrightslen = sizeof fd;

  return ACE_OS::recvmsg (this->ACE_SOCK_Stream::get_handle (), 
		    &recv_msg, 0);
}
#endif /* ACE_HAS_MSG */
#endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */