📄 xti.h.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><title><xti.h></title><!-- Copyright 1997 The Open Group, All Rights Reserved --></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><blockquote><h2>Headers and Definitions for XTI</h2><xref type="1" name="headersXTI"></xref><xref href=prepareapps></xref>This contains a normative requirement that the contents and structures found inthis document appear in the<i><xti.h></i>header.<xref type="1" name="hands"></xref><p>Applications written to compilation environments earlier thanthose required by this issue of the specificationand defining _XOPEN_SOURCE to be less than 500, will have these datastructures and constants of certain protocol specific headersautomatically exposed by the inclusion of <i><xti.h></i>for compatibility. The individual protocol-specific appendices document the providers for which this may be the case. <p>The function definitionsin this appendix conform to the ISO C standard.<p>Values specified for some of the symbolic constantsin this XTI header definition are designated as <B>not mandatory</B>for conformance purposes. These are identified by the comment:<pre><code>/* value is recommended-only, not mandatory */</code></pre>in the following definitions.<p><i><xti.h></i>defines t_scalar_t and t_uscalar_t respectively asa signed and unsigned opaque integral type of equal length ofat least 32 bits.<p>Certain items in this appendix are marked <B>LEGACY</B>.This which means that they are being retained for compatibility with olderapplications, but have limitations which make them inappropriate fordeveloping portable applications.New applications should use alternative means of obtaining equivalentfunctionality.<p><pre><code>/* * The following are the error codes needed by both the kernel * level transport providers and the user level library. */<P><table <tr valign=top><td align=left>#define TBADADDR<td align=left>1<td align=left>/* incorrect addr format */<tr valign=top><td align=left>#define TBADOPT<td align=left>2<td align=left>/* incorrect option format */<tr valign=top><td align=left>#define TACCES<td align=left>3<td align=left>/* incorrect permissions */<tr valign=top><td align=left>#define TBADF<td align=left>4<td align=left>/* illegal transport fd */<tr valign=top><td align=left>#define TNOADDR<td align=left>5<td align=left>/* couldn't allocate addr */<tr valign=top><td align=left>#define TOUTSTATE<td align=left>6<td align=left>/* out of state */<tr valign=top><td align=left>#define TBADSEQ<td align=left>7<td align=left>/* bad call sequence number */<tr valign=top><td align=left>#define TSYSERR<td align=left>8<td align=left>/* system error */<tr valign=top><td align=left>#define TLOOK<td align=left>9<td align=left>/* event requires attention */<tr valign=top><td align=left>#define TBADDATA<td align=left>10<td align=left>/* illegal amount of data */<tr valign=top><td align=left>#define TBUFOVFLW<td align=left>11<td align=left>/* buffer not large enough */<tr valign=top><td align=left>#define TFLOW<td align=left>12<td align=left>/* flow control */<tr valign=top><td align=left>#define TNODATA<td align=left>13<td align=left>/* no data */<tr valign=top><td align=left>#define TNODIS<td align=left>14<td align=left>/* discon_ind not found on queue */<tr valign=top><td align=left>#define TNOUDERR<td align=left>15<td align=left>/* unitdata error not found */<tr valign=top><td align=left>#define TBADFLAG<td align=left>16<td align=left>/* bad flags */<tr valign=top><td align=left>#define TNOREL<td align=left>17<td align=left>/* no ord rel found on queue */<tr valign=top><td align=left>#define TNOTSUPPORT<td align=left>18<td align=left>/* primitive/action not supported */<tr valign=top><td align=left>#define TSTATECHNG<td align=left>19<td align=left>/* state is in process of changing */<tr valign=top><td align=left>#define TNOSTRUCTYPE<td align=left>20<td align=left>/* unsupported struct-type requested */<tr valign=top><td align=left>#define TBADNAME<td align=left>21<td align=left>/* invalid transport provider name */<tr valign=top><td align=left>#define TBADQLEN<td align=left>22<td align=left>/* qlen is zero */<tr valign=top><td align=left>#define TADDRBUSY<td align=left>23<td align=left>/* address in use */<tr valign=top><td align=left>#define TINDOUT<td align=left>24<td align=left>/* outstanding connection indications */<tr valign=top><td align=left>#define TPROVMISMATCH<td align=left>25<td align=left>/* transport provider mismatch */<tr valign=top><td align=left>#define TRESQLEN<td align=left>26<td align=left>/* resfd specified to accept w/qlen >0 */<tr valign=top><td align=left>#define TRESADDR<td align=left>27<td align=left>/* resfd not bound to same addr as fd */<tr valign=top><td align=left>#define TQFULL<td align=left>28<td align=left>/* incoming connection queue full */<tr valign=top><td align=left>#define TPROTO<td align=left>29<td align=left>/* XTI protocol error */</table></code></pre><p><br><pre><code>/* * The following are the events returned. */<P><table <tr valign=top><td align=left>#define T_LISTEN<td align=left>0x0001<td align=left>/* connection indication received */<tr valign=top><td align=left>#define T_CONNECT<td align=left>0x0002<td align=left>/* connection confirmation received */<tr valign=top><td align=left>#define T_DATA<td align=left>0x0004<td align=left>/* normal data received */<tr valign=top><td align=left>#define T_EXDATA<td align=left>0x0008<td align=left>/* expedited data received */<tr valign=top><td align=left>#define T_DISCONNECT<td align=left>0x0010<td align=left>/* disconnection received */<tr valign=top><td align=left>#define T_UDERR<td align=left>0x0040<td align=left>/* datagram error indication */<tr valign=top><td align=left>#define T_ORDREL<td align=left>0x0080<td align=left>/* orderly release indication */<tr valign=top><td align=left>#define T_GODATA<td align=left>0x0100<td align=left>/* sending normal data is again possible */<tr valign=top><td align=left>#define T_GOEXDATA<td align=left>0x0200<td align=left>/* sending expedited data is again */<tr valign=top><td align=left>"/* possible */</table></code></pre><p><pre><code>/* * The following are the flag definitions needed by the * user level library routines. */<P><table <tr valign=top><td align=left>#define T_MORE<td align=left>0x001<td align=left>/* more data */<tr valign=top><td align=left>#define T_EXPEDITED<td align=left>0x002<td align=left>/* expedited data */<tr valign=top><td align=left>#define T_PUSH<td align=left>0x004<td align=left>/* send data immediately */<tr valign=top><td align=left>#define T_NEGOTIATE<td align=left>0x004<td align=left>/* set opts */<tr valign=top><td align=left>#define T_CHECK<td align=left>0x008<td align=left>/* check opts */<tr valign=top><td align=left>#define T_DEFAULT<td align=left>0x010<td align=left>/* get default opts */<tr valign=top><td align=left>#define T_SUCCESS<td align=left>0x020<td align=left>/* successful */<tr valign=top><td align=left>#define T_FAILURE<td align=left>0x040<td align=left>/* failure */<tr valign=top><td align=left>#define T_CURRENT<td align=left>0x080<td align=left>/* get current options */<tr valign=top><td align=left>#define T_PARTSUCCESS<td align=left>0x100<td align=left>/* partial success */<tr valign=top><td align=left>#define T_READONLY<td align=left>0x200<td align=left>/* read-only */<tr valign=top><td align=left>#define T_NOTSUPPORT<td align=left>0x400<td align=left>/* not supported */</table></code></pre><p><pre><code>/* * XTI error return. *//* t_errno is a modifiable lvalue of type int *//* In a single threaded environment a typical definition of t_errno is: */extern int t_errno;/* In a multi-threading environment a typical definition of t_errno is: */extern int *_t_errno(void);#define t_errno (*(_t_errno()))</code></pre><p><pre><code>/* * iov maximum */#define T_IOV_MAX 16 /* maximum number of scatter/gather buffers */ /* value is not mandatory but if present */ /* must be at least 16. */struct t_iovec { void *iov_base; size_t iov_len;};</code></pre><p><pre><code>/* * XTI LIBRARY FUNCTIONS *//* XTI Library Function: t_accept - accept a connection request*/extern int t_accept(int, int, const struct t_call *);/* XTI Library Function: t_alloc - allocate a library structure*/extern void *t_alloc(int, int, int);/* XTI Library Function: t_bind - bind an address to a transport endpoint*/extern int t_bind(int, const struct t_bind *, struct t_bind *);/* XTI Library Function: t_close - close a transport endpoint*/extern int t_close(int);/* XTI Library Function: t_connect - establish a connection */extern int t_connect(int, const struct t_call *, struct t_call *);/* XTI Library Function: t_error - produce error message*/extern int t_error(const char *);/* XTI Library Function: t_free - free a library structure*/extern int t_free(void *, int);/* XTI Library Function: t_getinfo - get protocol-specific service */ /* information*/extern int t_getinfo(int, struct t_info *);/* XTI Library Function: t_getprotaddr - get protocol addresses*/extern int t_getprotaddr(int, struct t_bind *, struct t_bind *);/* XTI Library Function: t_getstate - get the current state*/extern int t_getstate(int);/* XTI Library Function: t_listen - listen for a connection indication*/extern int t_listen(int, struct t_call *);/* XTI Library Function: t_look - look at current event on a transport */ /* endpoint*/extern int t_look(int);/* XTI Library Function: t_open - establish a transport endpoint*/extern int t_open(const char *, int, struct t_info *);/* XTI Library Function: t_optmgmt - manage options for a transport */ /* endpoint*/extern int t_optmgmt(int, const struct t_optmgmt *, struct t_optmgmt *);/* XTI Library Function: t_rcv - receive data or expedited data on a */ /* connection*/extern int t_rcv(int, void *, unsigned int, int *);/* XTI Library Function: t_rcvconnect - receive the confirmation from */ /* a connection request */extern int t_rcvconnect(int, struct t_call *);/* XTI Library Function: t_rcvdis - retrieve information from disconnect*/extern int t_rcvdis(int, struct t_discon *);/* XTI Library Function: t_rcvrel - acknowledge receipt of *//* an orderly release indication */extern int t_rcvrel(int);/* XTI Library Function: t_rcvreldata - receive an orderly release */ indication or confirmation containing user data */extern int t_rcvreldata(int, struct t_discon *discon)/* XTI Library Function: t_rcvudata - receive a data unit*/extern int t_rcvudata(int, struct t_unitdata *, int *);/* XTI Library Function: t_rcvuderr - receive a unit data error indication*/extern int t_rcvuderr(int, struct t_uderr *);/* XTI Library Function: t_rcvv - receive data or expedited data sent*//* over a connection and put the data *//* into one or more noncontiguous buffers*/extern int t_rcvv(int, struct t_iovec *, unsigned int, int *);/* XTI Library Function: t_rcvvudata - receive a data unit into one *//* or more noncontiguous buffers*/extern int t_rcvvudata(int, struct t_unitdata *, struct t_iovec *, \ unsigned int, int *);/* XTI Library Function: t_snd - send data or expedited data over a */ /* connection */extern int t_snd(int, void *, unsigned int, int);/* XTI Library Function: t_snddis - send user-initiated disconnect request*/extern int t_snddis(int, const struct t_call *);/* XTI Library Function: t_sndrel - initiate an orderly release*/extern int t_sndrel(int);/* XTI Library Function: t_sndreldata - initiate or respond to an */ /* orderly release with user data */extern int t_sndreldata(int, struct t_discon *);/* XTI Library Function: t_sndudata - send a data unit*/extern int t_sndudata(int, const struct t_unitdata *);/* XTI Library Function: t_sndv - send data or expedited data, *//* from one or more noncontiguous buffers, on a connection*/extern int t_sndv(int, const struct t_iovec *, unsigned int iovcount, int);/* XTI Library Function: t_sndvudata - send a data unit from one or *//* more non-contiguous buffers*/extern int t_sndvudata(int, struct t_unitdata *, struct t_iovec *, unsigned int);/* XTI Library Function: t_strerror - generate error message string */extern const char *t_strerror(int);/* XTI Library Function: t_sync - synchronise transport library*/extern int t_sync(int);/* XTI Library Function: t_sysconf - get configurable XTI variables */extern int t_sysconf(int);/* XTI Library Function: t_unbind - disable a transport endpoint*/extern int t_unbind(int);</code></pre><p><pre><code>/* * Protocol-specific service limits. */struct t_info { t_scalar_t addr; /*max size of the transport protocol address */ t_scalar_t options; /*max number of bytes of protocol-specific options */ t_scalar_t tsdu; /*max size of a transport service data unit */ t_scalar_t etsdu; /*max size of expedited transport service data unit */ t_scalar_t connect; /*max amount of data allowed on connection */ /*establishment functions */ t_scalar_t discon; /*max data allowed on t_snddis and t_rcvdis functions*/ t_scalar_t servtype; /*service type supported by transport provider */ t_scalar_t flags; /*other info about the transport provider */};</code></pre><p><pre><code>/* * Service type defines. */<P><table <tr valign=top><td align=left>#define T_COTS<td align=left>01<td align=left>/* connection-mode transport service */<tr valign=top><td align=left>#define T_COTS_ORD<td align=left>02<td align=left>/* connection-mode with orderly release */<tr valign=top><td align=left>#define T_CLTS<td align=left>03<td align=left>/* connectionless-mode transport service */</table></code></pre><p><pre><code>/* * Flags defines (other info about the transport provider). */<P><table <tr valign=top><td align=left>#define T_SENDZERO<td align=left>0x001<td align=left>/* supports 0-length TSDUs */<tr valign=top><td align=left>#define T_ORDRELDATA<td align=left>0x002<td align=left>/* supports orderly release data */</table></code></pre><p><pre><code>/* * netbuf structure. */<P><table <tr valign=top><td align=left>struct netbuf {<tr valign=top><td align=left> unsigned int<td align=left>maxlen;<tr valign=top><td align=left> unsigned int<td align=left>len;<tr valign=top><td align=left> void<td align=left>*buf;<tr valign=top><td align=left>};</table></code></pre><p><br><pre><code>/* * t_opthdr structure */struct t_opthdr { t_uscalar_t len; /* total length of option; that is, */ /* sizeof (struct t_opthdr) + length */ /* of option value in bytes */ t_uscalar_t level; /* protocol affected */ t_uscalar_t name; /* option name */ t_uscalar_t status; /* status value *//* followed by the option value */};</code></pre><p><pre><code>/* * t_bind - format of the address arguments of bind. */<P><table <tr valign=top><td align=left>struct t_bind {<tr valign=top><td align=left> struct netbuf<td align=left>addr;<tr valign=top><td align=left> unsigned int<td align=left>qlen;<tr valign=top><td align=left>};</table></code></pre><p><pre><code>/* * Options management structure. */<P><table <tr valign=top><td align=left>struct t_optmgmt {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -