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

ACE_TLI Class Reference

Defines the member functions for the base class of the ACE_TLI abstraction. More...

#include <TLI.h>

Inheritance diagram for ACE_TLI:

Inheritance graph
[legend]
Collaboration diagram for ACE_TLI:

Collaboration graph
[legend]
List of all members.

Public Methods

ACE_HANDLE open (const char device[], int oflag=O_RDWR, struct t_info *info=0)
 Initialize a TLI endpoint. More...

int close (void)
 Close a TLI endpoint and release resources. More...

int set_option (int level, int option, void *optval, int optlen)
 Set underlying protocol options. More...

int get_option (int level, int option, void *optval, int &optlen)
 Get underlying protocol options. More...

int look (void) const
int rcvdis (struct t_discon *=0) const
int snddis (struct t_call *=0) const
int sndrel (void) const
int rcvrel (void) const
int get_local_addr (ACE_Addr &) const
 Return our local endpoint address. More...

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Methods

 ACE_TLI (void)
 Default constructor. More...

 ~ACE_TLI (void)
 Destructor. More...

 ACE_TLI (const char device[], int oflag=O_RDWR, struct t_info *info=0)
 Initialize a TLI endpoint. More...


Detailed Description

Defines the member functions for the base class of the ACE_TLI abstraction.

Definition at line 49 of file TLI.h.


Constructor & Destructor Documentation

ACE_TLI::ACE_TLI void    [protected]
 

Default constructor.

Definition at line 26 of file TLI.cpp.

References ACE_NEW, and ACE_TRACE.

00027 {
00028   ACE_TRACE ("ACE_TLI::ACE_TLI");
00029 #if defined (ACE_HAS_SVR4_TLI)
00030 // Solaris 2.4 ACE_TLI option handling is broken.  Thus, we must do
00031 // the memory allocation ourselves...  Thanks to John P. Hearn
00032 // (jph@ccrl.nj.nec.com) for the help.
00033 
00034   this->so_opt_req.opt.maxlen = sizeof (opthdr) + sizeof (long);
00035   ACE_NEW (this->so_opt_req.opt.buf,
00036            char[this->so_opt_req.opt.maxlen]);
00037 
00038   this->so_opt_ret.opt.maxlen = sizeof (opthdr) + sizeof (long);
00039   ACE_NEW (this->so_opt_ret.opt.buf,
00040            char[this->so_opt_ret.opt.maxlen]);
00041 
00042   if (this->so_opt_ret.opt.buf == 0)
00043     {
00044       delete [] this->so_opt_req.opt.buf;
00045       this->so_opt_req.opt.buf = 0;
00046       return;
00047     }
00048 #endif /* ACE_HAS_SVR4_TLI */
00049 }

ACE_TLI::~ACE_TLI void    [protected]
 

Destructor.

Definition at line 62 of file TLI.cpp.

References ACE_TRACE.

00063 {
00064   ACE_TRACE ("ACE_TLI::~ACE_TLI");
00065 #if defined (ACE_HAS_SVR4_TLI)
00066   if (this->so_opt_req.opt.buf)
00067     {
00068       delete [] this->so_opt_req.opt.buf;
00069       delete [] this->so_opt_ret.opt.buf;
00070       this->so_opt_req.opt.buf = 0;
00071       this->so_opt_ret.opt.buf = 0;
00072     }
00073 #endif /* ACE_HAS_SVR4_TLI */
00074 }

ACE_TLI::ACE_TLI const char    device[],
int    oflag = O_RDWR,
struct t_info *    info = 0
[protected]
 

Initialize a TLI endpoint.

Definition at line 76 of file TLI.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, LM_ERROR, and open.

00077 {
00078   ACE_TRACE ("ACE_TLI::ACE_TLI");
00079   if (this->open (device, oflag, info) == ACE_INVALID_HANDLE)
00080     ACE_ERROR ((LM_ERROR,  ACE_LIB_TEXT ("%p\n"),  ACE_LIB_TEXT ("ACE_TLI::ACE_TLI")));
00081 }


Member Function Documentation

int ACE_TLI::close void   
 

Close a TLI endpoint and release resources.

Reimplemented in ACE_TLI_Acceptor.

Definition at line 105 of file TLI.cpp.

References ACE_TRACE, ACE_IPC_SAP::get_handle, ACE_IPC_SAP::set_handle, and ACE_OS_TLI::t_close.

Referenced by ACE_TLI_Acceptor::close.

00106 {
00107   ACE_TRACE ("ACE_TLI::close");
00108   int result = 0; // Geisler: result must be int
00109 
00110   if (this->get_handle () != ACE_INVALID_HANDLE)
00111     {
00112       result = ACE_OS::t_close (this->get_handle ());
00113       this->set_handle (ACE_INVALID_HANDLE);
00114     }
00115   return result;
00116 }

void ACE_TLI::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_IPC_SAP.

Reimplemented in ACE_TLI_Acceptor.

Definition at line 21 of file TLI.cpp.

References ACE_TRACE.

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

int ACE_TLI::get_local_addr ACE_Addr   const
 

Return our local endpoint address.

Definition at line 84 of file TLI.cpp.

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

00085 {
00086   ACE_TRACE ("ACE_TLI::get_local_addr");
00087 #if defined (ACE_HAS_SVR4_TLI)
00088   struct netbuf name;
00089 
00090   name.maxlen = sa.get_size ();
00091   name.buf    = (char *) sa.get_addr ();
00092 
00093   if (ACE_OS::ioctl (this->get_handle (), TI_GETMYNAME, &name) == -1)
00094 /*  if (ACE_OS::t_getname (this->get_handle (), &name, LOCALNAME) == -1) */
00095     return -1;
00096   else
00097     return 0;
00098 #else /* SunOS4 */
00099   ACE_UNUSED_ARG (sa);
00100   ACE_NOTSUP_RETURN (-1);
00101 #endif /* ACE_HAS_SVR4_TLI */
00102 }

int ACE_TLI::get_option int    level,
int    option,
void *    optval,
int &    optlen
 

Get underlying protocol options.

Definition at line 157 of file TLI.cpp.

References ACE_TRACE, ACE_OS_String::memcpy, and ACE_OS_TLI::t_optmgmt.

00158 {
00159   ACE_TRACE ("ACE_TLI::get_option");
00160 #if defined (ACE_HAS_SVR4_TLI)
00161   struct opthdr *opthdr = 0; /* See <sys/socket.h> for details on this format */
00162 
00163   this->so_opt_req.flags = T_CHECK;
00164   this->so_opt_ret.opt.len = sizeof *opthdr + OPTLEN (optlen);
00165 
00166   if (this->so_opt_ret.opt.len > this->so_opt_ret.opt.maxlen)
00167     {
00168 #if !defined (ACE_HAS_SET_T_ERRNO)
00169       t_errno = TBUFOVFLW;
00170 #else
00171       set_t_errno (TBUFOVFLW);
00172 #endif /* ACE_HAS_SET_T_ERRNO */
00173       return -1;
00174     }
00175 
00176   opthdr        = (struct opthdr *) this->so_opt_req.opt.buf;
00177   opthdr->level = level;
00178   opthdr->name  = option;
00179   opthdr->len   = OPTLEN (optlen);
00180   if (ACE_OS::t_optmgmt (this->get_handle (), &this->so_opt_req, &this->so_opt_ret) == -1)
00181     return -1;
00182   else
00183     {
00184       ACE_OS::memcpy (optval, OPTVAL (opthdr), optlen);
00185       return 0;
00186     }
00187 #else
00188   ACE_UNUSED_ARG (level);
00189   ACE_UNUSED_ARG (option);
00190   ACE_UNUSED_ARG (optval);
00191   ACE_UNUSED_ARG (optlen);
00192   return -1;
00193 #endif /* ACE_HAS_SVR4_TLI */
00194 }

ACE_INLINE int ACE_TLI::look void    const
 

Definition at line 10 of file TLI.i.

References ACE_TRACE, and ACE_OS_TLI::t_look.

Referenced by ACE_TLI_Stream::active_close, ACE_TLI_Connector::connect, and ACE_TLI_Acceptor::handle_async_event.

00011 {
00012   ACE_TRACE ("ACE_TLI::look");
00013   return ACE_OS::t_look (this->get_handle ());
00014 }

ACE_HANDLE ACE_TLI::open const char    device[],
int    oflag = O_RDWR,
struct t_info *    info = 0
 

Initialize a TLI endpoint.

Definition at line 52 of file TLI.cpp.

References ACE_TRACE, ACE_IPC_SAP::get_handle, ACE_IPC_SAP::set_handle, and ACE_OS_TLI::t_open.

Referenced by ACE_TLI, ACE_TLI_Connector::connect, and ACE_TLI_Acceptor::open.

00053 {
00054   ACE_TRACE ("ACE_TLI::open");
00055   if (oflag == 0)
00056     oflag = O_RDWR;
00057   this->set_handle (ACE_OS::t_open ((char *) device, oflag, info));
00058 
00059   return this->get_handle ();
00060 }

ACE_INLINE int ACE_TLI::rcvdis struct t_discon *    = 0 const
 

Definition at line 18 of file TLI.i.

References ACE_TRACE, and ACE_OS_TLI::t_rcvdis.

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

00019 {
00020   ACE_TRACE ("ACE_TLI::rcvdis");
00021   return ACE_OS::t_rcvdis (this->get_handle (), discon);
00022 }

ACE_INLINE int ACE_TLI::rcvrel void    const
 

Definition at line 34 of file TLI.i.

References ACE_TRACE, and ACE_OS_TLI::t_rcvrel.

Referenced by ACE_TLI_Stream::active_close, and ACE_TLI_Stream::passive_close.

00035 {
00036   ACE_TRACE ("ACE_TLI::rcvrel");
00037   return ACE_OS::t_rcvrel (this->get_handle ());
00038 }

int ACE_TLI::set_option int    level,
int    option,
void *    optval,
int    optlen
 

Set underlying protocol options.

Definition at line 119 of file TLI.cpp.

References ACE_TRACE, ACE_OS_String::memcpy, and ACE_OS_TLI::t_optmgmt.

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

00120 {
00121   ACE_TRACE ("ACE_TLI::set_option");
00122 #if defined (ACE_HAS_SVR4_TLI)
00123   /* Set up options for ACE_TLI */
00124 
00125   struct opthdr *opthdr = 0; /* See <sys/socket.h> for details on this format */
00126 
00127   this->so_opt_req.flags = T_NEGOTIATE;
00128   this->so_opt_req.opt.len = sizeof *opthdr + OPTLEN (optlen);
00129 
00130   if (this->so_opt_req.opt.len > this->so_opt_req.opt.maxlen)
00131     {
00132 #if !defined (ACE_HAS_SET_T_ERRNO)
00133       t_errno = TBUFOVFLW;
00134 #else
00135       set_t_errno (TBUFOVFLW);
00136 #endif /* ACE_HAS_SET_T_ERRNO */
00137       return -1;
00138     }
00139 
00140   opthdr        = (struct opthdr *) this->so_opt_req.opt.buf;
00141   opthdr->level = level;
00142   opthdr->name  = option;
00143   opthdr->len   = OPTLEN (optlen);
00144   ACE_OS::memcpy (OPTVAL (opthdr), optval, optlen);
00145 
00146   return ACE_OS::t_optmgmt (this->get_handle (), &this->so_opt_req, &this->so_opt_ret);
00147 #else
00148   ACE_UNUSED_ARG (level);
00149   ACE_UNUSED_ARG (option);
00150   ACE_UNUSED_ARG (optval);
00151   ACE_UNUSED_ARG (optlen);
00152   return -1;
00153 #endif /* ACE_HAS_SVR4_TLI */
00154 }

ACE_INLINE int ACE_TLI::snddis struct t_call *    = 0 const
 

Definition at line 26 of file TLI.i.

References ACE_TRACE, and ACE_OS_TLI::t_snddis.

00027 {
00028   ACE_TRACE ("ACE_TLI::snddis");
00029   return ACE_OS::t_snddis (this->get_handle (), call);
00030 }

ACE_INLINE int ACE_TLI::sndrel void    const
 

Definition at line 42 of file TLI.i.

References ACE_TRACE, and ACE_OS_TLI::t_sndrel.

Referenced by ACE_TLI_Stream::active_close, and ACE_TLI_Stream::passive_close.

00043 {
00044   ACE_TRACE ("ACE_TLI::sndrel");
00045   return ACE_OS::t_sndrel (this->get_handle ());
00046 }


Member Data Documentation

ACE_TLI::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_IPC_SAP.

Reimplemented in ACE_TLI_Acceptor.

Definition at line 81 of file TLI.h.


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