⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xti.h

📁 7号信令功能代码,为开源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*  * Unitdata error structure. */struct t_uderr {	struct netbuf addr;		/* address */	struct netbuf opt;		/* options */	t_scalar_t error;		/* error code */};/*  * Leaf status structure. */struct t_leaf_status {	int leafid;			/* leaf whose address has changed */	int status;			/* status: T_CONNECT or T_DISCONNECT */	int reason;			/* disconnect reason */};/*  *  XTI LIBRARY FUNCTIONS *//* XTI Library Function: t_accept - accept a connection request */extern int t_accept __P((int, int, const struct t_call *));/* XTI Library Function: t_addleaf - add a leaf to point to multipoint connection */extern int t_addleaf __P((int, int, struct netbuf *));/* XTI Library Function: t_alloc - allocate a library structure */extern char *t_alloc __P((int, int, int));/* XTI Library Function: t_bind - bind an address to a transport endpoint */extern int t_bind __P((int, const struct t_bind *, struct t_bind *));/* XTI Library Function: t_close - close a transport endpoint */extern int t_close __P((int));/* XTI Library Function: t_connect - establish a connection */extern int t_connect __P((int, const struct t_call *, struct t_call *));/* XTI Library Function: t_error - produce error message */extern int t_error __P((const char *));/* XTI Library Function: t_free - free a library structure */extern int t_free __P((void *, int));/* XTI Library Function: t_getinfo - get protocol-specific service information */extern int t_getinfo __P((int, struct t_info *));/* XTI Library Function: t_getprotaddr - get protocol addresses */extern int t_getprotaddr __P((int, struct t_bind *, struct t_bind *));/* XTI Library Function: t_getstate - get the current state */extern int t_getstate __P((int));/* XTI Library Function: t_listen - listen for a connection indication */extern int t_listen __P((int, struct t_call *));/* XTI Library Function: t_look - look at current event on a transport endpoint */extern int t_look __P((int));/* XTI Library Function: t_open - establish a transport endpoint */extern int t_open __P((const char *, int, struct t_info *));/* XTI Library Function: t_optmgmt - manage options for a transport endpoint */extern int t_optmgmt __P((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 __P((int, char *, unsigned int, int *));/* XTI Library Function: t_rcvconnect - receive the confirmation from a connection request */extern int t_rcvconnect __P((int, struct t_call *));/* XTI Library Function: t_rcvdis - retrieve information from disconnect */extern int t_rcvdis __P((int, struct t_discon *));/* XTI Library Function: t_rcvleafchange - acknowledge receipt of a leaf change indication */extern int t_rcvleafchange __P((int, struct t_leaf_status *));/* XTI Library Function: t_rcvrel - acknowledge receipt of an orderly release indication */extern int t_rcvrel __P((int));/* XTI Library Function: t_rcvreldata - receive an orderly release indication or confirmation   containing user data */extern int t_rcvreldata __P((int, struct t_discon *));/* XTI Library Function: t_rcvudata - receive a data unit */extern int t_rcvudata __P((int, struct t_unitdata *, int *));/* XTI Library Function: t_rcvuderr - receive a unit data error indication */extern int t_rcvuderr __P((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 __P((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 __P((int, struct t_unitdata *, struct t_iovec *, unsigned int, int *));/* XTI Library Function: t_removeleaf - remove a leaf from a point to multipoint connection */extern int t_removeleaf __P((int, int, int));/* XTI Library Function: t_snd - send data or expedited data over a connection */extern int t_snd __P((int, char *, unsigned int, int));/* XTI Library Function: t_snddis - send user-initiated disconnect request */extern int t_snddis __P((int, const struct t_call *));/* XTI Library Function: t_sndrel - initiate an orderly release */extern int t_sndrel __P((int));/* XTI Library Function: t_sndreldata - initiate or respond to an orderly release with user data */extern int t_sndreldata __P((int, struct t_discon *));/* XTI Library Function: t_sndudata - send a data unit */extern int t_sndudata __P((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 __P((int, const struct t_iovec *, unsigned int, int));/* XTI Library Function: t_sndvudata - send a data unit from one or more non-contiguous buffers */extern int t_sndvudata __P((int, struct t_unitdata *, struct t_iovec *, unsigned int));/* XTI Library Function: t_strerror - generate error message string */extern const char *t_strerror __P((int));/* XTI Library Function: t_sync - synchronise transport library */extern int t_sync __P((int));/* XTI Library Function: t_sysconf - get configurable XTI variables */extern int t_sysconf __P((int));/* XTI Library Function: t_unbind - disable a transport endpoint */extern int t_unbind __P((int));#if defined(_XOPEN_SOURCE)/*  * The following are structure types used when dynamically allocating the * above structures via t_alloc(). */#define T_BIND		1	/* allocate t_bind structure */#define T_OPTMGMT	2	/* allocate t_optmgmt structure */#define T_CALL		3	/* allocate t_call structure */#define T_DIS		4	/* allocate t_discon structure */#define T_UNITDATA	5	/* allocate t_unitdata structure */#define T_UDERROR	6	/* allocate t_uderr structure */#define T_INFO		7	/* allocate t_info structure */#else#define T_BIND_STR	1	/* allocate t_bind structure */#define T_OPTMGMT_STR	2	/* allocate t_optmgmt structure */#define T_CALL_STR	3	/* allocate t_call structure */#define T_DIS_STR	4	/* allocate t_discon structure */#define T_UNITDATA_STR	5	/* allocate t_unitdata structure */#define T_UDERROR_STR	6	/* allocate t_uderr structure */#define T_INFO_STR	7	/* allocate t_info structure */#endif/*  * The following bits specify which fields of the above structures should be * allocated by t_alloc(). */#define T_ADDR		0x0001	/* address */#define T_OPT		0x0002	/* options */#define T_UDATA		0x0004	/* user data */#define T_ALL		0xffff	/* all the above fields supported *//*  * The following are the states for the user. */#define T_UNINIT	0	/* unitialized state */#define T_UNBND		1	/* unbound */#define T_IDLE		2	/* idle */#define T_OUTCON	3	/* outgoing connection pending */#define T_INCON		4	/* incoming connection pending */#define T_DATAXFER	5	/* data transfer */#define T_OUTREL	6	/* outgoing release pending */#define T_INREL		7	/* incoming release pending *//*  * General purpose defines. */#define T_YES		1#define T_NO		0#define T_UNUSED	(-1)#define T_NULL		0#define T_ABSREQ	0x8000#define T_LEAF_NOCHANGE		0#define T_LEAF_CONNECTED	1#define T_LEAF_DISCONNECTED	2#if defined(_XOPEN_SOURCE)#define T_INFINITE	(-1)	/* The corresponding size is unbounded. */#define T_INVALID	(-2)	/* The corresponding element is invalid. *//*  *  Definitions for t_sysconf */#ifndef _SC_T_IOV_MAX#define _SC_T_IOV_MAX	1#endif/*  * General definitions for option management */#define T_UNSPEC  (~0 - 2)	/* applicable to u_long, t_scalar_t, char .. */#define T_ALLOPT  0#define T_ALIGN(p)	(((uintptr_t)(p) + sizeof(long)-1) & ~(sizeof(long)-1))/*  * The following T_OPT_FIRSTHDR, T_OPT_NEXTHDR and T_OPT_DATA macros have the * semantics required by the standard. They are used to store and read * multiple variable length objects delimited by a 'header' descriptor and the * variable length value content while allowing aligned access to each in an * arbitrary memory buffer. * * The required minimum alignment (based on types used internally in the * specification for header and data alignment is "sizeof(t_uscalar_t)" * * The definitions shown for macro bodies are examples only and other forms * are not only possible but are specifically permitted. * * The examples shown assume that the implementation chooses to align the * header and data parts at the required minimum of "sizeof(t_uscalar_t). * Stricter alignment is permitted by an implementation. * * Helper macros starting with "_T" prefix are used below.  These are not a * requirement of the specification and only used for constructing example * macro body definitions. *//*  * Helper macro aligns to sizeof(t_uscalar_t) boundary. */#define _T_USCALAR_ALIGN(p) \	(((uintptr_t)(p) + (sizeof (t_scalar_t)-1)) & ~(sizeof (t_scalar_t)-1))/*  * Get aligned start of first option header.  This implementation assumes * option buffers are allocated by t_alloc() and hence aligned to start any * sized object (including option header) is guaranteed. * * \code * struct t_opthdr *T_OPT_FIRSTHDR(struct netbuf *nbp): * \endcode * */#define T_OPT_FIRSTHDR(nbp) \	((((char *)(nbp)->buf + sizeof (struct t_opthdr)) <= \	  (char *)(nbp)->buf + (nbp)->len) ? \	 (struct t_opthdr *)(nbp)->buf : (struct t_opthdr *)0)/*  * unsigned char *T_OPT_DATA(struct t_opthdr *tohp): * Get aligned start of data part after option header * * This implementation assumes "sizeof (t_uscalar_t)" as the alignment size * for its option data and option header with no padding in "struct t_opthdr" * definition. */#define T_OPT_DATA(tohp) \	((unsigned char *)(tohp) + sizeof (struct t_opthdr))/*  * struct t_opthdr *_T_NEXTHDR(char *pbuf, unsigned int buflen, struct t_opthdr *popt): * * Helper macro for defining T_OPT_NEXTHDR macro.  This implementation assumes * "sizeof (t_uscalar_t)" as the alignment for its option data and option * header.  Also it assumes "struct t_opthdr" definitions contain no padding. */#define _T_NEXTHDR(pbuf, buflen, popt) \	(((char *) (popt) + _T_USCALAR_ALIGN((popt)->len) + sizeof(struct t_opthdr) <= \	  ((char *) (pbuf) + (buflen))) \	 ? (struct t_opthdr *) ((char *) (popt) + _T_USCALAR_ALIGN((popt)->len)) \	 : (struct t_opthdr *) 0)/*  * struct t_opthdr *T_OPT_NEXTHDR(struct netbuf *nbp, \ * struct t_opthdr *tohp): * Skip to next option header * This implementation assumes "sizeof (t_uscalar_t)" as the alignment size * for its option data and option header. */#define T_OPT_NEXTHDR(nbp, tohp)  _T_NEXTHDR((nbp)->buf, \                                      (nbp)->len, (tohp))#define OPT_NEXTHDR(pbuf, buflen, popt)	(struct t_opthdr *) \	(((char *)(popt) + T_ALIGN((popt)->len) < \	  (char *)(pbuf) + (buflen)) \	 ?  ((char *)(popt) + T_ALIGN((popt)->len)) \	 : 0)/* OPTIONS ON XTI LEVEL *//*  *  XTI Level */#define XTI_GENERIC 0xffff/*  *  XTI-level Options */#define XTI_DEBUG	0x0001	/* enable debugging */#define XTI_LINGER	0x0080	/* linger on close if data present */#define XTI_RCVBUF	0x1002	/* receive buffer size */#define XTI_RCVLOWAT	0x1004	/* receive low-water mark */#define XTI_SNDBUF	0x1001	/* send buffer size */#define XTI_SNDLOWAT	0x1003	/* send low-water mark *//*  * Structure used with linger option. */struct t_linger {	t_scalar_t l_onoff;		/* option on/off */	t_scalar_t l_linger;		/* linger time */};#endif				/* defined(_XOPEN_SOURCE) *//* *INDENT-OFF* */__END_DECLS/* *INDENT-ON* */#endif				/* _XTI_XTI_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -