3 //=============================================================================
7 * $Id: OS_TLI.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Doug Schmidt <schmidt@cs.wustl.edu>
11 //=============================================================================
16 # include /**/ "ace/pre.h"
18 # include "ace/config-all.h"
20 # if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # endif /* ACE_LACKS_PRAGMA_ONCE */
24 # include "ace/OS_Errno.h"
25 # include "ace/ACE_export.h"
27 # if defined (ACE_EXPORT_MACRO)
28 # undef ACE_EXPORT_MACRO
30 # define ACE_EXPORT_MACRO ACE_Export
32 # if !(defined(ACE_HAS_TLI) || defined(ACE_HAS_XTI))
33 // Dummies to help compilation.
39 struct t_unitdata
{ };
43 # else /* !(ACE_HAS_TLI || ACE_HAS_XTI) */
45 # if defined (ACE_HAS_CONFLICTING_XTI_MACROS)
46 // Make sure tcp.h gets included before sys/xti.h.
47 # include "ace/os_include/netinet/os_tcp.h"
50 # endif /* ACE_HAS_CONFLICTING_XTI_MACROS */
52 # if defined (ACE_HAS_XTI)
53 # if defined (ACE_HAS_SYS_XTI_H) /* Nonstandard header placement */
54 # define class ace_xti_class
55 # include /**/ <sys/xti.h>
57 # elif defined (ACE_HAS_FORE_ATM_XTI)
58 # include /**/ <fore_xti/xti_user_types.h>
59 # include /**/ <fore_xti/xti.h>
60 # include /**/ <fore_xti/xti_atm.h>
61 # include /**/ <fore_xti/netatm/atm.h>
62 # include /**/ <fore_xti/ans.h>
64 # include /**/ <xti.h>
65 # endif /* ACE_HAS_SYS_XTI_H */
67 // The XTI API for obtaining local/peer addresses is t_getprotaddr().
68 // The ACE API was developed in TLI days and so uses t_getname().
69 // t_getname() has a type argument that specifies which address is
70 // desired, local or peer, while t_getprotaddr() gets both at once.
71 // t_getname() has values defined for the type, so these aren't defined
72 // for XTI systems. So, define them here for ACE API users to use.
73 // These values were taken from sys/tiuser.h on Solaris.
74 # if !defined (LOCALNAME)
77 # if !defined (REMOTENAME)
81 # else /* !ACE_HAS_XTI, so this is a TLI system */
82 # if !defined (ACE_HAS_TLI_PROTOTYPES)
84 // Define ACE_TLI headers for systems that don't prototype them....
87 int t_accept(int fildes
, int resfd
, struct t_call
*call
);
88 char *t_alloc(int fildes
, int struct_type
, int fields
);
89 int t_bind(int fildes
, struct t_bind
*req
, struct t_bind
*ret
);
90 int t_close(int fildes
);
91 int t_connect(int fildes
, struct t_call
*sndcall
,
92 struct t_call
*rcvcall
);
93 void t_error(const char *errmsg
);
94 int t_free(char *ptr
, int struct_type
);
95 int t_getinfo(int fildes
, struct t_info
*info
);
96 int t_getname (int fildes
, struct netbuf
*namep
, int type
);
97 int t_getstate(int fildes
);
98 int t_listen(int fildes
, struct t_call
*call
);
99 int t_look(int fildes
);
100 int t_open(char *path
, int oflag
, struct t_info
*info
);
101 int t_optmgmt(int fildes
, struct t_optmgmt
*req
,
102 struct t_optmgmt
*ret
);
103 int t_rcv(int fildes
, char *buf
, unsigned int nbytes
, int *flags
);
104 int t_rcvconnect(int fildes
, struct t_call
*call
);
105 int t_rcvdis(int fildes
, struct t_discon
*discon
);
106 int t_rcvrel(int fildes
);
107 int t_rcvudata(int fildes
, struct t_unitdata
*unitdata
, int *flags
);
108 int t_rcvuderr(int fildes
, struct t_uderr
*uderr
);
109 int t_snd(int fildes
, const char *buf
, unsigned int nbytes
, int flags
);
110 int t_snddis(int fildes
, struct t_call
*call
);
111 int t_sndrel(int fildes
);
112 int t_sndudata(int fildes
, struct t_unitdata
*unitdata
);
113 int t_sync(int fildes
);
114 int t_unbind(int fildes
);
116 # endif /* !ACE_HAS_TLI_PROTOTYPES */
118 # if defined (ACE_HAS_TIUSER_H_BROKEN_EXTERN_C)
120 # endif /* ACE_HAS_TIUSER_H_BROKEN_EXTERN_C */
121 # if defined (ACE_HAS_TIUSER_H)
122 # include /**/ <tiuser.h>
124 /* What to do here??? Is there a tli.h? */
125 # endif /* ACE_HAS_TIUSER_H */
126 # if defined (ACE_HAS_TIUSER_H_BROKEN_EXTERN_C)
128 # endif /* ACE_HAS_TIUSER_H_BROKEN_EXTERN_C */
130 # if defined (ACE_HAS_SVR4_TLI)
131 // t_getname is a TLI extension added by some platforms before XTI
132 // was widely available. However, it's not often in the system's
133 // header files. Sun OS, for example, is like this.
134 extern "C" int t_getname (int, struct netbuf
*, int);
135 # endif /* ACE_HAS_SVR4_TLI */
136 # endif /* !ACE_HAS_XTI */
138 # endif /* ACE_HAS_XTI || ACE_HAS_TLI */
140 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
142 // This hack is needed to get around an odd and hard-to-reproduce problem
143 // with HP aC++. If struct sigaction is defined extern "C" and the sigaction
144 // function in namespace ACE_OS, the compiler sometimes gets confused.
145 // If we help it with this typedef, it's fine. User code should not use
146 // the ACE typedef - it will be removed without warning as soon as we can
147 // either drop support for the broken compilers or figure out how to reproduce
148 // it so it can be reported to HP and fixed.
149 // There's a similar hack in OS_TLI.h for struct t_optmgmt.
150 // Also see ChangeLog entries:
151 // Mon Jan 23 16:35:40 UTC 2006 Steve Huston <shuston@riverace.com>
152 // Mon Jan 23 22:08:56 UTC 2006 Steve Huston <shuston@riverace.com>
153 #if defined (__HP_aCC) && (__HP_aCC <= 37300)
154 typedef extern "C" struct t_optmgmt ACE_TOPTMGMT
;
155 typedef extern "C" struct t_bind ACE_TBIND
;
157 typedef struct t_optmgmt ACE_TOPTMGMT
;
158 typedef struct t_bind ACE_TBIND
;
164 * @brief This class is a wrapper for the XTI/TLI operations
169 // = A set of wrappers for XTI/TLI.
170 ACE_NAMESPACE_INLINE_FUNCTION
171 int t_accept (ACE_HANDLE fildes
,
176 ACE_NAMESPACE_INLINE_FUNCTION
177 char *t_alloc (ACE_HANDLE fildes
,
182 ACE_NAMESPACE_INLINE_FUNCTION
183 int t_bind (ACE_HANDLE fildes
,
187 ACE_NAMESPACE_INLINE_FUNCTION
188 int t_close (ACE_HANDLE fildes
);
190 ACE_NAMESPACE_INLINE_FUNCTION
191 int t_connect (ACE_HANDLE fildes
,
192 struct t_call
*sndcall
,
193 struct t_call
*rcvcall
);
195 ACE_NAMESPACE_INLINE_FUNCTION
196 void t_error (const char *errmsg
);
198 ACE_NAMESPACE_INLINE_FUNCTION
199 int t_free (char *ptr
,
202 ACE_NAMESPACE_INLINE_FUNCTION
203 int t_getinfo (ACE_HANDLE fildes
,
204 struct t_info
*info
);
206 ACE_NAMESPACE_INLINE_FUNCTION
207 int t_getname (ACE_HANDLE fildes
,
208 struct netbuf
*namep
,
211 ACE_NAMESPACE_INLINE_FUNCTION
212 int t_getstate (ACE_HANDLE fildes
);
214 ACE_NAMESPACE_INLINE_FUNCTION
215 int t_listen (ACE_HANDLE fildes
,
216 struct t_call
*call
);
218 ACE_NAMESPACE_INLINE_FUNCTION
219 int t_look (ACE_HANDLE fildes
);
221 ACE_NAMESPACE_INLINE_FUNCTION
222 ACE_HANDLE
t_open (char *path
,
224 struct t_info
*info
);
226 ACE_NAMESPACE_INLINE_FUNCTION
227 int t_optmgmt (ACE_HANDLE handle
,
231 ACE_NAMESPACE_INLINE_FUNCTION
232 int t_rcv (ACE_HANDLE fildes
,
237 ACE_NAMESPACE_INLINE_FUNCTION
238 int t_rcvdis (ACE_HANDLE fildes
,
239 struct t_discon
*discon
);
241 ACE_NAMESPACE_INLINE_FUNCTION
242 int t_rcvrel (ACE_HANDLE fildes
);
244 ACE_NAMESPACE_INLINE_FUNCTION
245 int t_rcvudata (ACE_HANDLE fildes
,
246 struct t_unitdata
*unitdata
,
249 ACE_NAMESPACE_INLINE_FUNCTION
250 int t_rcvuderr (ACE_HANDLE fildes
,
251 struct t_uderr
*uderr
);
253 ACE_NAMESPACE_INLINE_FUNCTION
254 int t_snd (ACE_HANDLE fildes
,
259 ACE_NAMESPACE_INLINE_FUNCTION
260 int t_snddis (ACE_HANDLE fildes
,
261 struct t_call
*call
);
263 ACE_NAMESPACE_INLINE_FUNCTION
264 int t_sndrel (ACE_HANDLE fildes
);
266 ACE_NAMESPACE_INLINE_FUNCTION
267 int t_sync (ACE_HANDLE fildes
);
269 ACE_NAMESPACE_INLINE_FUNCTION
270 int t_unbind (ACE_HANDLE fildes
);
272 } /* namespace ACE_OS */
274 ACE_END_VERSIONED_NAMESPACE_DECL
276 # if defined (ACE_HAS_INLINED_OSCALLS)
277 # if defined (ACE_INLINE)
279 # endif /* ACE_INLINE */
280 # define ACE_INLINE inline
281 # include "ace/OS_TLI.inl"
282 # endif /* ACE_HAS_INLINED_OSCALLS */
284 #include /**/ "ace/post.h"
285 #endif /* ACE_OS_TLI_H */