Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_TLI_Stream Class Reference

Defines the member functions for ACE_TLI_Stream abstraction. More...

#include <TLI_Stream.h>

Inheritance diagram for ACE_TLI_Stream:

Inheritance graph
[legend]
Collaboration diagram for ACE_TLI_Stream:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_INET_Addr PEER_ADDR

Public Methods

 ACE_TLI_Stream (void)
 Default constructor. More...

int close (void)
 Close down and release resources. More...

int active_close (void)
 Send a release and then await the release from the other side. More...

int passive_close (void)
 Acknowledge the release from the other side and then send the release to the other side. More...

int get_remote_addr (ACE_Addr &) const
 Return address of remotely connected peer. More...

ssize_t send (const void *buf, size_t n, int flags, const ACE_Time_Value *timeout=0) const
 Send an n byte buffer to the connected socket (uses t_snd(3)). More...

ssize_t recv (void *buf, size_t n, int *flags, const ACE_Time_Value *timeout=0) const
 Recv an n byte buffer from the connected socket (uses t_rcv(3)). More...

ssize_t send_n (const void *buf, size_t n, int flags, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Send exactly n bytes to the connected socket (uses t_snd(3)). More...

ssize_t recv_n (void *buf, size_t n, int *flags, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Recv exactly n bytes from the connected socket (uses t_rcv(3)). More...

ssize_t send (const void *buf, size_t n, const ACE_Time_Value *timeout=0) const
 Send an n byte buffer to the connected socket (uses write(2)). More...

ssize_t recv (void *buf, size_t n, const ACE_Time_Value *timeout=0) const
 Recv an n byte buffer from the connected socket (uses read(2)). More...

ssize_t send_n (const void *buf, size_t n, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Send n bytes, keep trying until n are sent (uses write(2)). More...

ssize_t recv_n (void *buf, size_t n, const ACE_Time_Value *timeout=0, size_t *bytes_transferred=0) const
 Recv n bytes, keep trying until n are received (uses read (2)). More...

void dump (void) const
 Dump the state of an object. More...


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Methods

int get_rwflag (void)
 Get rwflag. More...

void set_rwflag (int)
 Set rwflag. More...


Private Attributes

int rwflag_
 Indicates whether the tirdwr module should be pushed. More...


Friends

class ACE_TLI_Acceptor
class ACE_TLI_Connector

Detailed Description

Defines the member functions for ACE_TLI_Stream abstraction.

Definition at line 33 of file TLI_Stream.h.


Member Typedef Documentation

typedef ACE_INET_Addr ACE_TLI_Stream::PEER_ADDR
 

Definition at line 108 of file TLI_Stream.h.


Constructor & Destructor Documentation

ACE_TLI_Stream::ACE_TLI_Stream void   
 

Default constructor.

Definition at line 26 of file TLI_Stream.cpp.

References ACE_TRACE.

00027   : rwflag_ (0)
00028 {
00029   ACE_TRACE ("ACE_TLI_Stream::ACE_TLI_Stream");
00030 }


Member Function Documentation

int ACE_TLI_Stream::active_close void   
 

Send a release and then await the release from the other side.

Definition at line 58 of file TLI_Stream.cpp.

References ACE_TRACE, close, ACE_TLI::look, ACE_TLI::rcvrel, recv, and ACE_TLI::sndrel.

00059 {
00060   ACE_TRACE ("ACE_TLI_Stream::active_close");
00061   char buf;
00062 
00063   if (this->sndrel () == -1)
00064     return -1;
00065   else if (this->recv (&buf, sizeof buf) == -1)
00066     {
00067       if (t_errno == TLOOK && this->look () == T_ORDREL)
00068         {
00069           if (this->rcvrel () == -1)
00070             return -1;
00071         }
00072       else
00073         return -1;
00074     }
00075 
00076   return this->close ();
00077 }

int ACE_TLI_Stream::close void   
 

Close down and release resources.

Reimplemented from ACE_TLI.

Definition at line 96 of file TLI_Stream.cpp.

References ACE_TRACE, ACE_OS::close, ACE_IPC_SAP::get_handle, rwflag_, ACE_IPC_SAP::set_handle, and ACE_OS_TLI::t_close.

Referenced by active_close, ACE_TLI_Connector::complete, ACE_TLI_Connector::connect, and passive_close.

00097 {
00098   ACE_TRACE ("ACE_TLI_Stream::close");
00099 
00100   ACE_HANDLE fd = this->get_handle ();
00101 
00102   this->set_handle (ACE_INVALID_HANDLE);
00103 
00104 #if !defined (ACE_WIN32)
00105   if (this->rwflag_)
00106     return ACE_OS::close (fd);
00107   else
00108 #endif /* ACE_WIN32 */
00109     return ACE_OS::t_close (fd);
00110 }

void ACE_TLI_Stream::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_TLI.

Definition at line 21 of file TLI_Stream.cpp.

References ACE_TRACE.

00022 {
00023   ACE_TRACE ("ACE_TLI_Stream::dump");
00024 }

int ACE_TLI_Stream::get_remote_addr ACE_Addr   const
 

Return address of remotely connected peer.

Definition at line 33 of file TLI_Stream.cpp.

References ACE_TRACE, ACE_Addr::get_addr, ACE_Addr::get_size, and ACE_OS::ioctl.

00034 {
00035   ACE_TRACE ("ACE_TLI_Stream::get_remote_addr");
00036 
00037 #if defined (ACE_HAS_SVR4_TLI)
00038   struct netbuf name;
00039   name.maxlen = sa.get_size ();
00040   name.buf = (char *) sa.get_addr ();
00041 
00042   // if (ACE_OS::t_getname (this->get_handle (), &name, REMOTENAME) == -1)
00043   if (ACE_OS::ioctl (this->get_handle (),
00044                      TI_GETPEERNAME,
00045                      &name) == -1)
00046     return -1;
00047   else
00048     return 0;
00049 #else /* SunOS4 */
00050   ACE_UNUSED_ARG (sa);
00051   ACE_NOTSUP_RETURN (-1);
00052 #endif /* ACE_HAS_SVR4_TLI */
00053 }

ACE_INLINE int ACE_TLI_Stream::get_rwflag void    [private]
 

Get rwflag.

Definition at line 18 of file TLI_Stream.i.

References ACE_TRACE, and rwflag_.

Referenced by ACE_TLI_Connector::connect.

00019 {
00020   ACE_TRACE ("ACE_TLI_Stream::get_rwflag");
00021   return this->rwflag_;
00022 }

int ACE_TLI_Stream::passive_close void   
 

Acknowledge the release from the other side and then send the release to the other side.

Definition at line 83 of file TLI_Stream.cpp.

References ACE_TRACE, close, ACE_TLI::rcvrel, and ACE_TLI::sndrel.

00084 {
00085   ACE_TRACE ("ACE_TLI_Stream::passive_close");
00086 
00087   if (this->rcvrel () == -1)
00088     return -1;
00089   else if (this->sndrel () == -1)
00090     return -1;
00091 
00092   return this->close ();
00093 }

ssize_t ACE_TLI_Stream::recv void *    buf,
size_t    n,
const ACE_Time_Value   timeout = 0
const
 

Recv an n byte buffer from the connected socket (uses read(2)).

Definition at line 139 of file TLI_Stream.cpp.

References ACE_TRACE, and ACE::recv.

00142 {
00143   ACE_TRACE ("ACE_TLI_Stream::recv");
00144   return ACE::recv (this->get_handle (),
00145                     buf,
00146                     n,
00147                     timeout);
00148 }

ssize_t ACE_TLI_Stream::recv void *    buf,
size_t    n,
int *    flags,
const ACE_Time_Value   timeout = 0
const
 

Recv an n byte buffer from the connected socket (uses t_rcv(3)).

Definition at line 151 of file TLI_Stream.cpp.

References ACE_TRACE, and ACE::t_rcv.

Referenced by active_close.

00155 {
00156   ACE_TRACE ("ACE_TLI_Stream::recv");
00157   int f = 0;
00158 
00159   if (flags == 0)
00160     flags = &f;
00161 
00162   return ACE::t_rcv (this->get_handle (),
00163                      buf,
00164                      n,
00165                      flags,
00166                      timeout);
00167 }

ssize_t ACE_TLI_Stream::recv_n void *    buf,
size_t    n,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Recv n bytes, keep trying until n are received (uses read (2)).

Definition at line 201 of file TLI_Stream.cpp.

References ACE_TRACE, and ACE::recv_n.

00205 {
00206   ACE_TRACE ("ACE_TLI_Stream::recv_n");
00207   return ACE::recv_n (this->get_handle (),
00208                       buf,
00209                       n,
00210                       timeout,
00211                       bytes_transferred);
00212 }

ssize_t ACE_TLI_Stream::recv_n void *    buf,
size_t    n,
int *    flags,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Recv exactly n bytes from the connected socket (uses t_rcv(3)).

Definition at line 215 of file TLI_Stream.cpp.

References ACE_TRACE, and ACE::t_rcv_n.

00220 {
00221   ACE_TRACE ("ACE_TLI_Stream::recv_n");
00222 
00223   return ACE::t_rcv_n (this->get_handle (),
00224                        buf,
00225                        n,
00226                        flags,
00227                        timeout,
00228                        bytes_transferred);
00229 }

ssize_t ACE_TLI_Stream::send const void *    buf,
size_t    n,
const ACE_Time_Value   timeout = 0
const
 

Send an n byte buffer to the connected socket (uses write(2)).

Definition at line 113 of file TLI_Stream.cpp.

References ACE_TRACE, and ACE::send.

00116 {
00117   ACE_TRACE ("ACE_TLI_Stream::send");
00118   return ACE::send (this->get_handle (),
00119                     buf,
00120                     n,
00121                     timeout);
00122 }

ssize_t ACE_TLI_Stream::send const void *    buf,
size_t    n,
int    flags,
const ACE_Time_Value   timeout = 0
const
 

Send an n byte buffer to the connected socket (uses t_snd(3)).

Definition at line 125 of file TLI_Stream.cpp.

References ACE_TRACE, and ACE::t_snd.

00129 {
00130   ACE_TRACE ("ACE_TLI_Stream::send");
00131   return ACE::t_snd (this->get_handle (),
00132                      buf,
00133                      n,
00134                      flags,
00135                      timeout);
00136 }

ssize_t ACE_TLI_Stream::send_n const void *    buf,
size_t    n,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Send n bytes, keep trying until n are sent (uses write(2)).

Definition at line 170 of file TLI_Stream.cpp.

References ACE_TRACE, and ACE::send_n.

00174 {
00175   ACE_TRACE ("ACE_TLI_Stream::send_n");
00176   return ACE::send_n (this->get_handle (),
00177                       buf,
00178                       n,
00179                       timeout,
00180                       bytes_transferred);
00181 }

ssize_t ACE_TLI_Stream::send_n const void *    buf,
size_t    n,
int    flags,
const ACE_Time_Value   timeout = 0,
size_t *    bytes_transferred = 0
const
 

Send exactly n bytes to the connected socket (uses t_snd(3)).

Definition at line 184 of file TLI_Stream.cpp.

References ACE_TRACE, and ACE::t_snd_n.

00189 {
00190   ACE_TRACE ("ACE_TLI_Stream::send_n");
00191 
00192   return ACE::t_snd_n (this->get_handle (),
00193                        buf,
00194                        n,
00195                        flags,
00196                        timeout,
00197                        bytes_transferred);
00198 }

ACE_INLINE void ACE_TLI_Stream::set_rwflag int    [private]
 

Set rwflag.

Definition at line 10 of file TLI_Stream.i.

References ACE_TRACE, and rwflag_.

Referenced by ACE_TLI_Acceptor::accept, and ACE_TLI_Connector::connect.

00011 {
00012   ACE_TRACE ("ACE_TLI_Stream::set_rwflag");
00013   this->rwflag_ = value;
00014 }


Friends And Related Function Documentation

friend class ACE_TLI_Acceptor [friend]
 

Definition at line 36 of file TLI_Stream.h.

friend class ACE_TLI_Connector [friend]
 

Definition at line 37 of file TLI_Stream.h.


Member Data Documentation

ACE_TLI_Stream::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_TLI.

Definition at line 114 of file TLI_Stream.h.

int ACE_TLI_Stream::rwflag_ [private]
 

Indicates whether the tirdwr module should be pushed.

Definition at line 118 of file TLI_Stream.h.

Referenced by close, get_rwflag, and set_rwflag.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:58:21 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002