OS_TLI.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   OS_TLI.h
00006  *
00007  *  $Id: OS_TLI.h 76119 2006-12-21 09:45:38Z sma $
00008  *
00009  *  @author Doug Schmidt <schmidt@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_OS_TLI_H
00015 # define ACE_OS_TLI_H
00016 # include /**/ "ace/pre.h"
00017 
00018 # include "ace/config-all.h"
00019 
00020 # if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 #  pragma once
00022 # endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 # include "ace/OS_Errno.h"
00025 # include "ace/ACE_export.h"
00026 
00027 # if defined (ACE_EXPORT_MACRO)
00028 #  undef ACE_EXPORT_MACRO
00029 # endif
00030 # define ACE_EXPORT_MACRO ACE_Export
00031 
00032 # if !(defined(ACE_HAS_TLI) || defined(ACE_HAS_XTI))
00033 // Dummies to help compilation.
00034 struct t_call { };
00035 struct t_bind { };
00036 struct t_info { };
00037 struct t_optmgmt { };
00038 struct t_discon { };
00039 struct t_unitdata { };
00040 struct t_uderr { };
00041 struct netbuf { };
00042 
00043 # else /* !(ACE_HAS_TLI || ACE_HAS_XTI) */
00044 
00045 #   if defined (ACE_HAS_CONFLICTING_XTI_MACROS)
00046       // Make sure tcp.h gets included before sys/xti.h.
00047 #     include "ace/os_include/netinet/os_tcp.h"
00048 #     undef TCP_NODELAY
00049 #     undef TCP_MAXSEG
00050 #   endif /* ACE_HAS_CONFLICTING_XTI_MACROS */
00051 
00052 #   if defined (ACE_HAS_XTI)
00053 #     if defined (ACE_HAS_SYS_XTI_H)   /* Nonstandard header placement */
00054 #       define class ace_xti_class
00055 #       include /**/ <sys/xti.h>
00056 #       undef class
00057 #     elif defined (ACE_HAS_FORE_ATM_XTI)
00058 #       include /**/ <fore_xti/xti_user_types.h>
00059 #       include /**/ <fore_xti/xti.h>
00060 #       include /**/ <fore_xti/xti_atm.h>
00061 #       include /**/ <fore_xti/netatm/atm.h>
00062 #       include /**/ <fore_xti/ans.h>
00063 #     else
00064 #       include /**/ <xti.h>
00065 #     endif /* ACE_HAS_SYS_XTI_H */
00066 
00067       // If the xti.h file redefines the function names, do it now, else
00068       // when the function definitions are encountered, they won't match the
00069       // declaration here.
00070 #     if defined (ACE_REDEFINES_XTI_FUNCTIONS)
00071 #       include /**/ <xti.h>
00072 #       if defined (UNIXWARE_2_0)         /* They apparently forgot one... */
00073            extern "C" int _xti_error(char *);
00074 #       endif /* UNIXWARE_2_0 */
00075 #     endif /* ACE_REDEFINES_XTI_FUNCTIONS */
00076 
00077       // The XTI API for obtaining local/peer addresses is t_getprotaddr().
00078       // The ACE API was developed in TLI days and so uses t_getname().
00079       // t_getname() has a type argument that specifies which address is
00080       // desired, local or peer, while t_getprotaddr() gets both at once.
00081       // t_getname() has values defined for the type, so these aren't defined
00082       // for XTI systems. So, define them here for ACE API users to use.
00083       // These values were taken from sys/tiuser.h on Solaris.
00084 #     if !defined (LOCALNAME)
00085 #       define LOCALNAME  0
00086 #     endif
00087 #     if !defined (REMOTENAME)
00088 #       define REMOTENAME 1
00089 #     endif
00090 
00091 #   else /* !ACE_HAS_XTI, so this is a TLI system */
00092 #     if !defined (ACE_HAS_TLI_PROTOTYPES)
00093 
00094 // Define ACE_TLI headers for systems that don't prototype them....
00095 extern "C"
00096 {
00097   int t_accept(int fildes, int resfd, struct t_call *call);
00098   char *t_alloc(int fildes, int struct_type, int fields);
00099   int t_bind(int fildes, struct t_bind *req, struct t_bind *ret);
00100   int t_close(int fildes);
00101   int t_connect(int fildes, struct t_call *sndcall,
00102                 struct t_call *rcvcall);
00103   void t_error(const char *errmsg);
00104   int t_free(char *ptr, int struct_type);
00105   int t_getinfo(int fildes, struct t_info *info);
00106   int t_getname (int fildes, struct netbuf *namep, int type);
00107   int t_getstate(int fildes);
00108   int t_listen(int fildes, struct t_call *call);
00109   int t_look(int fildes);
00110   int t_open(char *path, int oflag, struct t_info *info);
00111   int t_optmgmt(int fildes, struct t_optmgmt *req,
00112                 struct t_optmgmt *ret);
00113   int t_rcv(int fildes, char *buf, unsigned int nbytes, int *flags);
00114   int t_rcvconnect(int fildes, struct t_call *call);
00115   int t_rcvdis(int fildes, struct t_discon *discon);
00116   int t_rcvrel(int fildes);
00117   int t_rcvudata(int fildes, struct t_unitdata *unitdata, int *flags);
00118   int t_rcvuderr(int fildes, struct t_uderr *uderr);
00119   int t_snd(int fildes, const char *buf, unsigned int nbytes, int flags);
00120   int t_snddis(int fildes, struct t_call *call);
00121   int t_sndrel(int fildes);
00122   int t_sndudata(int fildes, struct t_unitdata *unitdata);
00123   int t_sync(int fildes);
00124   int t_unbind(int fildes);
00125 }
00126 #     endif /* !ACE_HAS_TLI_PROTOTYPES */
00127 
00128 #     if defined (ACE_HAS_TIUSER_H_BROKEN_EXTERN_C)
00129 extern "C" {
00130 #     endif /* ACE_HAS_TIUSER_H_BROKEN_EXTERN_C */
00131 #     if defined (ACE_HAS_TIUSER_H)
00132 #       include /**/ <tiuser.h>
00133 #     else
00134        /* What to do here??? Is there a tli.h? */
00135 #     endif /* ACE_HAS_TIUSER_H */
00136 #     if defined (ACE_HAS_TIUSER_H_BROKEN_EXTERN_C)
00137 }
00138 #     endif /* ACE_HAS_TIUSER_H_BROKEN_EXTERN_C */
00139 
00140 #     if defined (ACE_HAS_SVR4_TLI)
00141          // t_getname is a TLI extension added by some platforms before XTI
00142          // was widely available. However, it's not often in the system's
00143          // header files. Sun OS, for example, is like this.
00144          extern "C" int t_getname (int, struct netbuf *, int);
00145 #     endif /* ACE_HAS_SVR4_TLI */
00146 #   endif /* !ACE_HAS_XTI */
00147 
00148 # endif /* ACE_HAS_XTI || ACE_HAS_TLI */
00149 
00150 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00151 
00152 // This hack is needed to get around an odd and hard-to-reproduce problem
00153 // with HP aC++. If struct sigaction is defined extern "C" and the sigaction
00154 // function in namespace ACE_OS, the compiler sometimes gets confused.
00155 // If we help it with this typedef, it's fine. User code should not use
00156 // the ACE typedef - it will be removed without warning as soon as we can
00157 // either drop support for the broken compilers or figure out how to reproduce
00158 // it so it can be reported to HP and fixed.
00159 // There's a similar hack in OS_TLI.h for struct t_optmgmt.
00160 // Also see ChangeLog entries:
00161 // Mon Jan 23 16:35:40 UTC 2006  Steve Huston  <shuston@riverace.com>
00162 // Mon Jan 23 22:08:56 UTC 2006  Steve Huston  <shuston@riverace.com>
00163 #if defined (__HP_aCC) && (__HP_aCC <= 37300)
00164 typedef extern "C" struct t_optmgmt  ACE_TOPTMGMT;
00165 typedef extern "C" struct t_bind  ACE_TBIND;
00166 #else
00167 typedef struct t_optmgmt ACE_TOPTMGMT;
00168 typedef struct t_bind  ACE_TBIND;
00169 #endif
00170 
00171 /**
00172  * @namespace ACE_OS
00173  *
00174  * @brief This class is a wrapper for the XTI/TLI operations
00175  *
00176  */
00177 namespace ACE_OS
00178 {
00179   // = A set of wrappers for XTI/TLI.
00180   ACE_NAMESPACE_INLINE_FUNCTION
00181   int t_accept (ACE_HANDLE fildes,
00182                 ACE_HANDLE resfd,
00183                 struct t_call
00184                 *call);
00185 
00186   ACE_NAMESPACE_INLINE_FUNCTION
00187   char *t_alloc (ACE_HANDLE fildes,
00188                  int struct_type,
00189                  int
00190                  fields);
00191 
00192   ACE_NAMESPACE_INLINE_FUNCTION
00193   int t_bind (ACE_HANDLE fildes,
00194               ACE_TBIND *req,
00195               ACE_TBIND *ret);
00196 
00197   ACE_NAMESPACE_INLINE_FUNCTION
00198   int t_close (ACE_HANDLE fildes);
00199 
00200   ACE_NAMESPACE_INLINE_FUNCTION
00201   int t_connect (ACE_HANDLE fildes,
00202                  struct t_call *sndcall,
00203                  struct t_call *rcvcall);
00204 
00205   ACE_NAMESPACE_INLINE_FUNCTION
00206   void t_error (const char *errmsg);
00207 
00208   ACE_NAMESPACE_INLINE_FUNCTION
00209   int t_free (char *ptr,
00210               int struct_type);
00211 
00212   ACE_NAMESPACE_INLINE_FUNCTION
00213   int t_getinfo (ACE_HANDLE fildes,
00214                  struct t_info *info);
00215 
00216   ACE_NAMESPACE_INLINE_FUNCTION
00217   int t_getname (ACE_HANDLE fildes,
00218                  struct netbuf *namep,
00219                  int type);
00220 
00221   ACE_NAMESPACE_INLINE_FUNCTION
00222   int t_getstate (ACE_HANDLE fildes);
00223 
00224   ACE_NAMESPACE_INLINE_FUNCTION
00225   int t_listen (ACE_HANDLE fildes,
00226                 struct t_call *call);
00227 
00228   ACE_NAMESPACE_INLINE_FUNCTION
00229   int t_look (ACE_HANDLE fildes);
00230 
00231   ACE_NAMESPACE_INLINE_FUNCTION
00232   ACE_HANDLE t_open (char *path,
00233                      int oflag,
00234                      struct t_info *info);
00235 
00236   ACE_NAMESPACE_INLINE_FUNCTION
00237   int t_optmgmt (ACE_HANDLE handle,
00238                  ACE_TOPTMGMT *req,
00239                  ACE_TOPTMGMT *ret);
00240 
00241   ACE_NAMESPACE_INLINE_FUNCTION
00242   int t_rcv (ACE_HANDLE fildes,
00243              char *buf,
00244              unsigned int nbytes,
00245              int *flags);
00246 
00247   ACE_NAMESPACE_INLINE_FUNCTION
00248   int t_rcvdis (ACE_HANDLE fildes,
00249                 struct t_discon *discon);
00250 
00251   ACE_NAMESPACE_INLINE_FUNCTION
00252   int t_rcvrel (ACE_HANDLE fildes);
00253 
00254   ACE_NAMESPACE_INLINE_FUNCTION
00255   int t_rcvudata (ACE_HANDLE fildes,
00256                   struct t_unitdata *unitdata,
00257                   int *flags);
00258 
00259   ACE_NAMESPACE_INLINE_FUNCTION
00260   int t_rcvuderr (ACE_HANDLE fildes,
00261                   struct t_uderr *uderr);
00262 
00263   ACE_NAMESPACE_INLINE_FUNCTION
00264   int t_snd (ACE_HANDLE fildes,
00265              const char *buf,
00266              unsigned int nbytes,
00267              int flags);
00268 
00269   ACE_NAMESPACE_INLINE_FUNCTION
00270   int t_snddis (ACE_HANDLE fildes,
00271                 struct t_call *call);
00272 
00273   ACE_NAMESPACE_INLINE_FUNCTION
00274   int t_sndrel (ACE_HANDLE fildes);
00275 
00276   ACE_NAMESPACE_INLINE_FUNCTION
00277   int t_sync (ACE_HANDLE fildes);
00278 
00279   ACE_NAMESPACE_INLINE_FUNCTION
00280   int t_unbind (ACE_HANDLE fildes);
00281 
00282 } /* namespace ACE_OS */
00283 
00284 ACE_END_VERSIONED_NAMESPACE_DECL
00285 
00286 # if defined (ACE_HAS_INLINED_OSCALLS)
00287 #   if defined (ACE_INLINE)
00288 #     undef ACE_INLINE
00289 #   endif /* ACE_INLINE */
00290 #   define ACE_INLINE inline
00291 #   include "ace/OS_TLI.inl"
00292 # endif /* ACE_HAS_INLINED_OSCALLS */
00293 
00294 #include /**/ "ace/post.h"
00295 #endif /* ACE_OS_TLI_H */

Generated on Sun Jan 27 12:05:34 2008 for ACE by doxygen 1.3.6