diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1996-10-21 21:41:34 +0000 |
commit | a5fdebc5f6375078ec1763850a4ca23ec7fe6458 (patch) | |
tree | bcf0a25c3d45a209a6e3ac37b233a4812f29c732 /ace/TLI_Stream.i | |
download | ATCD-a5fdebc5f6375078ec1763850a4ca23ec7fe6458.tar.gz |
Initial revision
Diffstat (limited to 'ace/TLI_Stream.i')
-rw-r--r-- | ace/TLI_Stream.i | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/ace/TLI_Stream.i b/ace/TLI_Stream.i new file mode 100644 index 00000000000..646c25d8008 --- /dev/null +++ b/ace/TLI_Stream.i @@ -0,0 +1,105 @@ +/* -*- C++ -*- */ +// $Id$ + +// TLI_Stream.i + +#include "ace/TLI_Stream.h" + +inline ssize_t +ACE_TLI_Stream::send (const void *buf, size_t n) const +{ + ACE_TRACE ("ACE_TLI_Stream::send"); + return ACE_OS::write (this->get_handle (), (const char *) buf, n); +} + +inline ssize_t +ACE_TLI_Stream::send (const void *buf, size_t n, int flags) const +{ + ACE_TRACE ("ACE_TLI_Stream::send"); + return ACE_OS::t_snd (this->get_handle (), (char *) buf, n, flags); +} + +inline ssize_t +ACE_TLI_Stream::recv (void *buf, size_t n) const +{ + ACE_TRACE ("ACE_TLI_Stream::recv"); + return ACE_OS::read (this->get_handle (), (char *) buf, n); +} + +inline ssize_t +ACE_TLI_Stream::recv (void *buf, size_t n, int *flags) const +{ + ACE_TRACE ("ACE_TLI_Stream::recv"); + int f = 0; + + if (flags == 0) + flags = &f; + return ACE_OS::t_rcv (this->get_handle (), (char *) buf, n, flags); +} + +inline ssize_t +ACE_TLI_Stream::send_n (const void *buf, size_t n) const +{ + ACE_TRACE ("ACE_TLI_Stream::send_n"); + return ACE::send_n (this->get_handle (), buf, n); +} + +inline ssize_t +ACE_TLI_Stream::send_n (const void *buf, size_t n, int flags) const +{ + ACE_TRACE ("ACE_TLI_Stream::send_n"); + int b_sent; + int b_written; + + for (b_sent = 0; b_sent < n; b_sent += b_written) + if ((b_written = ACE_OS::t_snd (this->get_handle (), + (char *) buf + b_sent, + n - b_sent, flags)) == -1) + return -1; + + return b_sent; +} + +inline ssize_t +ACE_TLI_Stream::recv_n (void *buf, size_t n) const +{ + ACE_TRACE ("ACE_TLI_Stream::recv_n"); + return ACE::recv_n (this->get_handle (), buf, n); +} + +inline ssize_t +ACE_TLI_Stream::recv_n (void *buf, size_t n, int *flags) const +{ + ACE_TRACE ("ACE_TLI_Stream::recv_n"); + int b_read = 0; + int b_recv = 0; + int f = 0; + + if (flags == 0) + flags = &f; + + for (b_read = 0; b_read < n; b_read += b_recv) + if ((b_recv = ACE_OS::t_rcv (this->get_handle (), + (char *) buf + b_read, + n - b_read, flags)) == -1) + return -1; + else if (b_recv == 0) + break; + + return b_read; +} + +inline void +ACE_TLI_Stream::set_rwflag (int value) +{ + ACE_TRACE ("ACE_TLI_Stream::set_rwflag"); + this->rwflag_ = value; +} + +inline int +ACE_TLI_Stream::get_rwflag (void) +{ + ACE_TRACE ("ACE_TLI_Stream::get_rwflag"); + return this->rwflag_; +} + |