📄 xti.h
字号:
/***************************************************************************** @(#) xti.h,v 0.9.2.3 2004/05/16 04:12:33 brian Exp ----------------------------------------------------------------------------- Copyright (C) 2001-2004 OpenSS7 Corporation <http://www.openss7.com> Copyright (C) 1997-2000 Brian F. G. Bidulock <bidulock@openss7.org> All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ----------------------------------------------------------------------------- U.S. GOVERNMENT RESTRICTED RIGHTS. If you are licensing this Software on behalf of the U.S. Government ("Government"), the following provisions apply to you. If the Software is supplied by the Department of Defense ("DoD"), it is classified as "Commercial Computer Software" under paragraph 252.227-7014 of the DoD Supplement to the Federal Acquisition Regulations ("DFARS") (or any successor regulations) and the Government is acquiring only the license rights granted herein (the license rights customarily provided to non-Government users). If the Software is supplied to any unit or agency of the Government other than DoD, it is classified as "Restricted Computer Software" and the Government's rights in the Software are defined in paragraph 52.227-19 of the Federal Acquisition Regulations ("FAR") (or any success regulations) or, in the cases of NASA, in paragraph 18.52.227-86 of the NASA Supplement to the FAR (or any successor regulations). ----------------------------------------------------------------------------- Commercial licensing and support of this software is available from OpenSS7 Corporation at a fee. See http://www.openss7.com/ ----------------------------------------------------------------------------- Last Modified 2004/05/16 04:12:33 by brian *****************************************************************************/#ifndef _SYS_XTI_H#define _SYS_XTI_H#ident "@(#) xti.h,v strxnet-0_9_2-4(0.9.2.3) Copyright (c) 1997-2004 OpenSS7 Corporation."#ifndef t_scalar_t/** * \ingroup libxti * XTI signed scalar type. * * Strangely enough, t_uscalar_t is defined in stropts.h for SUSv2 and SUSv3 * systems, however, t_scalar_t is only defined here. */typedef int32_t t_scalar_t;#define t_scalar_t t_scalar_t#endif /* !defined t_scalar_t */#if !defined _STROPTS_H || defined NEED_T_USCALAR_T#ifndef t_uscalar_t/** * \ingroup libxti * XTI unsigned scalar type. * * This type is not defined in the XTI Library as it is supposed to be defined * in stropts.h according to SUSv2 and SUSv3. */typedef u_int32_t t_uscalar_t;#define t_uscalar_t t_uscalar_t#endif /* !defined t_uscalar_t */#endif /* !defined _STROPTS_H || defined NEED_T_USCALAR_T */#include <sys/tpi.h> /* common TLI, XTI, TI definitions */#include <sys/xti_xti.h> /* for XTI_GENERIC level options */#define T_ALIGN(p) (((uintptr_t)(p) + sizeof(long)-1) & ~(sizeof(long)-1))#if 0#if !defined _SYS_TIHDR_H/* * 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)#endif /* !defined _SYS_TIHDR_H */#endif/* * extern int t_errno; * * XTI error return. t_errno is a modifiable lvalue of type int. The above * definition is typical of a single-threaded environment. In a * multi-threading environment a typical definition of t_errno is: */extern int *_t_errno(void);#define t_errno (*(_t_errno()))/* * iov maximum */#define T_IOV_MAX 16 /* Maximum number of scatter/gather buffers. The value is not mandatory. The value must be at least 16. *//* * IO vector structure. */struct t_iovec { void *iov_base; /* The base of the vector component. */ size_t iov_len; /* The length of the vector component. */};/* * netbuf structure. */struct netbuf { unsigned int maxlen; unsigned int len; char *buf;};/* * \struct t_info * Protocol-specific service limits. Provides information on protocol * service limits for the transport endpoint. */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(), t_rcvdis(), t_sndreldata() and t_rcvreldata() functions. */ t_scalar_t servtype; /* Service type supported by transport provider. */#if defined(_XOPEN_SOURCE) t_scalar_t flags; /* Other info about the transport provider. */ t_scalar_t tidu; /* max size of interface transport data unit. */#endif};/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -