#include <TLI.h>
Inheritance diagram for ACE_TLI:


Public Member Functions | |
| ACE_HANDLE | open (const char device[], int oflag=O_RDWR, struct t_info *info=0) |
| Initialize a TLI endpoint. | |
| int | close (void) |
| Close a TLI endpoint and release resources. | |
| int | set_option (int level, int option, void *optval, int optlen) |
| Set underlying protocol options. | |
| int | get_option (int level, int option, void *optval, int &optlen) |
| Get underlying protocol options. | |
| 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. | |
| void | dump (void) const |
| Dump the state of an object. | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Protected Member Functions | |
| ACE_TLI (void) | |
| Default constructor. | |
| ~ACE_TLI (void) | |
| Destructor. | |
| ACE_TLI (const char device[], int oflag=O_RDWR, struct t_info *info=0) | |
| Initialize a TLI endpoint. | |
Definition at line 55 of file TLI.h.
|
|
Default constructor.
Definition at line 34 of file TLI.cpp. References ACE_NEW, and ACE_TRACE.
00035 {
00036 ACE_TRACE ("ACE_TLI::ACE_TLI");
00037 #if defined (ACE_HAS_SVR4_TLI)
00038 // Solaris 2.4 ACE_TLI option handling is broken. Thus, we must do
00039 // the memory allocation ourselves... Thanks to John P. Hearn
00040 // (jph@ccrl.nj.nec.com) for the help.
00041
00042 this->so_opt_req.opt.maxlen = sizeof (opthdr) + sizeof (long);
00043 ACE_NEW (this->so_opt_req.opt.buf,
00044 char[this->so_opt_req.opt.maxlen]);
00045
00046 this->so_opt_ret.opt.maxlen = sizeof (opthdr) + sizeof (long);
00047 ACE_NEW (this->so_opt_ret.opt.buf,
00048 char[this->so_opt_ret.opt.maxlen]);
00049
00050 if (this->so_opt_ret.opt.buf == 0)
00051 {
00052 delete [] this->so_opt_req.opt.buf;
00053 this->so_opt_req.opt.buf = 0;
00054 return;
00055 }
00056 #endif /* ACE_HAS_SVR4_TLI */
00057 }
|
|
|
Destructor.
Definition at line 70 of file TLI.cpp. References ACE_TRACE.
00071 {
00072 ACE_TRACE ("ACE_TLI::~ACE_TLI");
00073 #if defined (ACE_HAS_SVR4_TLI)
00074 if (this->so_opt_req.opt.buf)
00075 {
00076 delete [] this->so_opt_req.opt.buf;
00077 delete [] this->so_opt_ret.opt.buf;
00078 this->so_opt_req.opt.buf = 0;
00079 this->so_opt_ret.opt.buf = 0;
00080 }
00081 #endif /* ACE_HAS_SVR4_TLI */
00082 }
|
|
||||||||||||||||
|
Initialize a TLI endpoint.
Definition at line 84 of file TLI.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, LM_ERROR, and open().
|
|
|
Close a TLI endpoint and release resources.
Reimplemented in ACE_TLI_Acceptor, and ACE_TLI_Stream. Definition at line 109 of file TLI.cpp. References ACE_TRACE, ACE_IPC_SAP::get_handle(), ACE_IPC_SAP::set_handle(), and ACE_OS::t_close(). Referenced by ACE_TLI_Acceptor::close().
00110 {
00111 ACE_TRACE ("ACE_TLI::close");
00112 int result = 0; // Geisler: result must be int
00113
00114 if (this->get_handle () != ACE_INVALID_HANDLE)
00115 {
00116 result = ACE_OS::t_close (this->get_handle ());
00117 this->set_handle (ACE_INVALID_HANDLE);
00118 }
00119 return result;
00120 }
|
|
|
Dump the state of an object.
Reimplemented from ACE_IPC_SAP. Reimplemented in ACE_TLI_Acceptor, and ACE_TLI_Stream. Definition at line 27 of file TLI.cpp. References ACE_TRACE.
00028 {
00029 #if defined (ACE_HAS_DUMP)
00030 ACE_TRACE ("ACE_TLI::dump");
00031 #endif /* ACE_HAS_DUMP */
00032 }
|
|
|
Return our local endpoint address.
Definition at line 94 of file TLI.cpp. References ACE_TRACE, ACE_Addr::get_addr(), ACE_Addr::get_size(), and ACE_OS::t_getname().
00095 {
00096 ACE_TRACE ("ACE_TLI::get_local_addr");
00097 struct netbuf name;
00098
00099 name.maxlen = sa.get_size ();
00100 name.buf = (char *) sa.get_addr ();
00101
00102 if (ACE_OS::t_getname (this->get_handle (), &name, LOCALNAME) == -1)
00103 return -1;
00104 else
00105 return 0;
00106 }
|
|
||||||||||||||||||||
|
Get underlying protocol options.
Definition at line 191 of file TLI.cpp. References ACE_NEW_RETURN, ACE_TRACE, ENOTSUP, ACE_OS::memcpy(), ACE_OS::t_optmgmt(), and t_optmgmt().
00192 {
00193 ACE_TRACE ("ACE_TLI::get_option");
00194 #if defined (ACE_HAS_XTI)
00195 // ret will get the option requested in req.
00196 struct t_optmgmt req, ret;
00197 ACE_NEW_RETURN (req.opt.buf, char[sizeof (struct t_opthdr)], -1);
00198 # if (_XOPEN_SOURCE - 0 >= 500)
00199 auto_ptr<char> req_opt_buf_p (reinterpret_cast<char*> (req.opt.buf));
00200 # else
00201 ACE_Auto_Array_Ptr<char> req_opt_buf_p (req.opt.buf);
00202 # endif /* XPG5 vs XPG4 */
00203 struct t_opthdr *opthdr =
00204 reinterpret_cast<struct t_opthdr *> (req.opt.buf);
00205 ACE_NEW_RETURN (ret.opt.buf, char[sizeof (struct t_opthdr) + optlen], -1);
00206 # if (_XOPEN_SOURCE - 0 >= 500)
00207 auto_ptr<char> ret_opt_buf_p (reinterpret_cast<char*> (ret.opt.buf));
00208 # else
00209 ACE_Auto_Array_Ptr<char> ret_opt_buf_p (ret.opt.buf);
00210 # endif /* XPG5 vs XPG4 */
00211
00212 req.flags = T_CURRENT;
00213 req.opt.len = sizeof *opthdr;
00214 ret.opt.maxlen = sizeof (struct t_opthdr) + optlen;
00215 opthdr->level = level;
00216 opthdr->name = option;
00217 opthdr->len = sizeof (*opthdr); // Just the header on the request
00218 if (ACE_OS::t_optmgmt (this->get_handle (), &req, &ret) == -1)
00219 return -1;
00220 else
00221 {
00222 opthdr = reinterpret_cast<struct t_opthdr *> (ret.opt.buf);
00223 if (opthdr->status == T_NOTSUPPORT)
00224 {
00225 errno = ENOTSUP;
00226 return -1;
00227 }
00228 else
00229 {
00230 ACE_OS::memcpy (optval, &opthdr[1], optlen);
00231 return 0;
00232 }
00233 }
00234
00235 #elif defined (ACE_HAS_SVR4_TLI)
00236 struct opthdr *opthdr = 0; /* See <sys/socket.h> for details on this format */
00237
00238 this->so_opt_req.flags = T_CHECK;
00239 this->so_opt_ret.opt.len = sizeof *opthdr + OPTLEN (optlen);
00240
00241 if (this->so_opt_ret.opt.len > this->so_opt_ret.opt.maxlen)
00242 {
00243 #if !defined (ACE_HAS_SET_T_ERRNO)
00244 t_errno = TBUFOVFLW;
00245 #else
00246 set_t_errno (TBUFOVFLW);
00247 #endif /* ACE_HAS_SET_T_ERRNO */
00248 return -1;
00249 }
00250
00251 opthdr = (struct opthdr *) this->so_opt_req.opt.buf;
00252 opthdr->level = level;
00253 opthdr->name = option;
00254 opthdr->len = OPTLEN (optlen);
00255 if (ACE_OS::t_optmgmt (this->get_handle (), &this->so_opt_req, &this->so_opt_ret) == -1)
00256 return -1;
00257 else
00258 {
00259 ACE_OS::memcpy (optval, OPTVAL (opthdr), optlen);
00260 return 0;
00261 }
00262 #else
00263 ACE_UNUSED_ARG (level);
00264 ACE_UNUSED_ARG (option);
00265 ACE_UNUSED_ARG (optval);
00266 ACE_UNUSED_ARG (optlen);
00267 return -1;
00268 #endif /* ACE_HAS_SVR4_TLI */
00269 }
|
|
|
Definition at line 12 of file TLI.inl. References ACE_TRACE, and ACE_OS::t_look(). Referenced by ACE_TLI_Stream::active_close(), ACE_TLI_Connector::connect(), and ACE_TLI_Acceptor::handle_async_event().
00013 {
00014 ACE_TRACE ("ACE_TLI::look");
00015 return ACE_OS::t_look (this->get_handle ());
00016 }
|
|
||||||||||||||||
|
Initialize a TLI endpoint.
Definition at line 60 of file TLI.cpp. References ACE_TRACE, ACE_IPC_SAP::get_handle(), and ACE_IPC_SAP::set_handle(). Referenced by ACE_TLI(), ACE_TLI_Connector::connect(), and ACE_TLI_Acceptor::open().
00061 {
00062 ACE_TRACE ("ACE_TLI::open");
00063 if (oflag == 0)
00064 oflag = O_RDWR;
00065 this->set_handle (ACE_OS::t_open ((char *) device, oflag, info));
00066
00067 return this->get_handle ();
00068 }
|
|
|
Definition at line 20 of file TLI.inl. References ACE_TRACE, and ACE_OS::t_rcvdis(). Referenced by ACE_TLI_Connector::connect(), and ACE_TLI_Acceptor::handle_async_event().
00021 {
00022 ACE_TRACE ("ACE_TLI::rcvdis");
00023 return ACE_OS::t_rcvdis (this->get_handle (), discon);
00024 }
|
|
|
Definition at line 36 of file TLI.inl. References ACE_TRACE, and ACE_OS::t_rcvrel(). Referenced by ACE_TLI_Stream::active_close(), and ACE_TLI_Stream::passive_close().
00037 {
00038 ACE_TRACE ("ACE_TLI::rcvrel");
00039 return ACE_OS::t_rcvrel (this->get_handle ());
00040 }
|
|
||||||||||||||||||||
|
Set underlying protocol options.
Definition at line 123 of file TLI.cpp. References ACE_NEW_RETURN, ACE_TRACE, ACE_OS::memcpy(), ACE_OS::t_optmgmt(), and t_optmgmt(). Referenced by ACE_TLI_Connector::connect(), and ACE_TLI_Acceptor::open().
00124 {
00125 /* Set up options for ACE_TLI */
00126 ACE_TRACE ("ACE_TLI::set_option");
00127
00128 #if defined (ACE_HAS_XTI)
00129 // ret will get the negotiated option back after attempting to set it.
00130 // Assume this will fit in the requested size.
00131 struct t_optmgmt req, ret;
00132 ACE_NEW_RETURN (req.opt.buf, char[sizeof (struct t_opthdr) + optlen], -1);
00133 # if (_XOPEN_SOURCE - 0 >= 500)
00134 auto_ptr<char> req_opt_buf_p (reinterpret_cast<char*> (req.opt.buf));
00135 # else
00136 ACE_Auto_Array_Ptr<char> req_opt_buf_p (req.opt.buf);
00137 # endif /* XPG5 vs XPG4 */
00138 struct t_opthdr *opthdr =
00139 reinterpret_cast<struct t_opthdr *> (req.opt.buf);
00140 ACE_NEW_RETURN (ret.opt.buf, char[sizeof (struct t_opthdr) + optlen], -1);
00141 # if (_XOPEN_SOURCE - 0 >= 500)
00142 auto_ptr<char> ret_opt_buf_p (reinterpret_cast<char*> (ret.opt.buf));
00143 # else
00144 ACE_Auto_Array_Ptr<char> ret_opt_buf_p (ret.opt.buf);
00145 # endif /* XPG5 vs XPG4 */
00146
00147 req.flags = T_NEGOTIATE;
00148 req.opt.len = sizeof *opthdr + optlen;
00149 ret.opt.maxlen = req.opt.len;
00150 opthdr->level = level;
00151 opthdr->name = option;
00152 opthdr->len = req.opt.len; // We only request one option at a time.
00153 ACE_OS::memcpy (&opthdr[1], optval, optlen);
00154 return ACE_OS::t_optmgmt (this->get_handle (), &req, &ret);
00155
00156 #elif defined (ACE_HAS_SVR4_TLI)
00157 struct opthdr *opthdr = 0; /* See <sys/socket.h> for info on this format */
00158
00159 this->so_opt_req.flags = T_NEGOTIATE;
00160 this->so_opt_req.opt.len = sizeof *opthdr + OPTLEN (optlen);
00161
00162 if (this->so_opt_req.opt.len > this->so_opt_req.opt.maxlen)
00163 {
00164 # if !defined (ACE_HAS_SET_T_ERRNO)
00165 t_errno = TBUFOVFLW;
00166 # else
00167 set_t_errno (TBUFOVFLW);
00168 # endif /* ACE_HAS_SET_T_ERRNO */
00169 return -1;
00170 }
00171
00172 opthdr = reinterpret_cast<struct opthdr *> (this->so_opt_req.opt.buf);
00173 opthdr->level = level;
00174 opthdr->name = option;
00175 opthdr->len = OPTLEN (optlen);
00176 ACE_OS::memcpy (OPTVAL (opthdr), optval, optlen);
00177
00178 return ACE_OS::t_optmgmt (this->get_handle (),
00179 &this->so_opt_req,
00180 &this->so_opt_ret);
00181 #else
00182 ACE_UNUSED_ARG (level);
00183 ACE_UNUSED_ARG (option);
00184 ACE_UNUSED_ARG (optval);
00185 ACE_UNUSED_ARG (optlen);
00186 return -1;
00187 #endif /* ACE_HAS_XTI, else ACE_HAS_SVR4_TLI */
00188 }
|
|
|
Definition at line 28 of file TLI.inl. References ACE_TRACE, and ACE_OS::t_snddis().
00029 {
00030 ACE_TRACE ("ACE_TLI::snddis");
00031 return ACE_OS::t_snddis (this->get_handle (), call);
00032 }
|
|
|
Definition at line 44 of file TLI.inl. References ACE_TRACE, and ACE_OS::t_sndrel(). Referenced by ACE_TLI_Stream::active_close(), and ACE_TLI_Stream::passive_close().
00045 {
00046 ACE_TRACE ("ACE_TLI::sndrel");
00047 return ACE_OS::t_sndrel (this->get_handle ());
00048 }
|
|
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_IPC_SAP. Reimplemented in ACE_TLI_Acceptor, and ACE_TLI_Stream. |
1.3.6